Nella descrizione del flag -K ( --keep-dirlinks ), la pagina man di rsync fornisce questo avviso (il mio accento):
One note of caution: if you use --keep-dirlinks, you must trust all the symlinks in the copy! If it is possible for an untrusted user to create their own symlink to any directory, the user could then (on a subsequent copy) replace the symlink with a real directory and affect the content of whatever directory the symlink references. For backup copies, you are better off using something like a bind mount instead of a symlink to modify your receiving hierarchy.
Ho letto la frase evidenziata più volte e non riesco ancora a visualizzare l'exploit a cui si riferisce.
Qualcuno potrebbe dare un esempio dettagliato dell'exploit? (Si prega di includere una spiegazione di come un "bind mount" evita il problema.)
FWIW, questa è la mia comprensione di cosa fa l'opzione -K .
Ad esempio, se lo stato iniziale è questo:
sender:/path/to/sourcedir
└── foo/
└── file
receiver:/path/to/targetdir
├── bar/
│ └── stuff
└── foo@ -> bar/
Quindi, dopo rsync sender:/path/to/sourcedir/ receiver:/path/to/targetdir , il destinatario sarà simile a questo:
receiver:/path/to/targetdir
├── bar/
│ └── stuff
└── foo/
└── file
(nota che foo non è più un link simbolico.)
Dopo rsync -K sender:/path/to/sourcedir/ receiver:/path/to/targetdir , d'altra parte, assomiglierà a questo:
receiver:/path/to/targetdir ├── bar/ │ ├── file │ └── stuff └── foo@ -> bar/