]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
cryptsetup: optionally turn off token module support in libcryptsetup
authorLennart Poettering <lennart@poettering.net>
Fri, 8 Oct 2021 16:26:12 +0000 (18:26 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 11 Oct 2021 09:12:29 +0000 (11:12 +0200)
This is useful for debugging purposes.

src/cryptsetup/cryptsetup.c

index f23e671e8e7ac784ae0f276c1e8a227e3a3fbff8..43c6bf529f82586b86cfcc1ed5e79940a7297e50 100644 (file)
@@ -18,6 +18,7 @@
 #include "cryptsetup-util.h"
 #include "device-util.h"
 #include "efi-loader.h"
+#include "env-util.h"
 #include "escape.h"
 #include "fileio.h"
 #include "fs-util.h"
@@ -738,7 +739,16 @@ static int make_security_device_monitor(sd_event *event, sd_device_monitor **ret
 
 static bool libcryptsetup_plugins_support(void) {
 #if HAVE_LIBCRYPTSETUP_PLUGINS
-        return crypt_token_external_path() != NULL;
+        int r;
+
+        /* Permit a way to disable libcryptsetup token module support, for debugging purposes. */
+        r = getenv_bool("SYSTEMD_CRYPTSETUP_USE_TOKEN_MODULE");
+        if (r < 0 && r != -ENXIO)
+                log_debug_errno(r, "Failed to parse $SYSTEMD_CRYPTSETUP_USE_TOKEN_MODULE env var: %m");
+        if (r == 0)
+                return false;
+
+        return crypt_token_external_path();
 #else
         return false;
 #endif