cryptsetup: make sure we invoke the cryptsetup tools with a shared keyring
authorLennart Poettering <lennart@poettering.net>
Thu, 14 Sep 2017 19:23:56 +0000 (21:23 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 15 Sep 2017 14:53:35 +0000 (16:53 +0200)
We want that cryptsetup can cache keys between multiple invocations, and
it does so via the root user's user keyring, hence let's share it among
services.

Replaces: #6286

src/cryptsetup/cryptsetup-generator.c
src/gpt-auto-generator/gpt-auto-generator.c

index 11d9892..f882a4f 100644 (file)
@@ -170,6 +170,7 @@ static int create_disk(
                 "Type=oneshot\n"
                 "RemainAfterExit=yes\n"
                 "TimeoutSec=0\n" /* the binary handles timeouts anyway */
+                "KeyringMode=shared\n" /* make sure we can share cached keys among instances */
                 "ExecStart=" SYSTEMD_CRYPTSETUP_PATH " attach '%s' '%s' '%s' '%s'\n"
                 "ExecStop=" SYSTEMD_CRYPTSETUP_PATH " detach '%s'\n",
                 name, u, strempty(password), strempty(filtered),
index dcbf3ff..bf28af0 100644 (file)
@@ -99,6 +99,7 @@ static int add_cryptsetup(const char *id, const char *what, bool rw, bool requir
                 "Type=oneshot\n"
                 "RemainAfterExit=yes\n"
                 "TimeoutSec=0\n" /* the binary handles timeouts anyway */
+                "KeyringMode=shared\n" /* make sure we can share cached keys among instances */
                 "ExecStart=" SYSTEMD_CRYPTSETUP_PATH " attach '%s' '%s' '' '%s'\n"
                 "ExecStop=" SYSTEMD_CRYPTSETUP_PATH " detach '%s'\n",
                 d, d,