cryptsetup: document that keyfile-erase does not apply to auto-discovered key files
keyfile-erase only erases a key file explicitly configured in the third field of crypttab. Key files automatically discovered in /etc/cryptsetup-keys.d/ and /run/cryptsetup-keys.d/ are considered shared resources not owned by an individual volume, and are never erased. Make this explicit in the documentation and add a code comment clarifying the intent. Fixes: https://github.com/systemd/systemd/issues/41127 Co-developed-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
c0400c8b2e
commit
c280a16ab7
@@ -2639,6 +2639,9 @@ static int verb_attach(int argc, char *argv[], uintptr_t _data, void *userdata)
|
||||
/* A delicious drop of snake oil */
|
||||
(void) safe_mlockall(MCL_CURRENT|MCL_FUTURE|MCL_ONFAULT);
|
||||
|
||||
/* Only erase key files explicitly configured on the command line, never the ones we
|
||||
* auto-discover in /etc/cryptsetup-keys.d/ and /run/cryptsetup-keys.d/: those are shared
|
||||
* resources not owned by an individual volume. (key_file is NULL when auto-discovery is used.) */
|
||||
if (key_file && arg_keyfile_erase)
|
||||
destroy_key_file = key_file; /* let's get this baby erased when we leave */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user