mirror of
https://github.com/nix-community/disko.git
synced 2026-12-03 06:23:28 +01:00
add additionalKeyFiles option to luks
This commit is contained in:
1 parent
68eb09b183
commit
7eb0940839
4 files changed
+10
No files matched your search
@@ -32,6 +32,7 @@
|
|||||||
type = "luks";
|
type = "luks";
|
||||||
name = "crypted1";
|
name = "crypted1";
|
||||||
settings.keyFile = "/tmp/secret.key";
|
settings.keyFile = "/tmp/secret.key";
|
||||||
|
additionalKeyFiles = ["/tmp/additionalSecret.key"];
|
||||||
extraFormatArgs = [
|
extraFormatArgs = [
|
||||||
"--iter-time 1" # unsecure but fast for tests
|
"--iter-time 1" # unsecure but fast for tests
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
# if you want to use the key for interactive login be sure there is no trailing newline
|
# if you want to use the key for interactive login be sure there is no trailing newline
|
||||||
# for example use `echo -n "password" > /tmp/secret.key`
|
# for example use `echo -n "password" > /tmp/secret.key`
|
||||||
settings.keyFile = "/tmp/secret.key";
|
settings.keyFile = "/tmp/secret.key";
|
||||||
|
additionalKeyFiles = ["/tmp/additionalSecret.key"];
|
||||||
content = {
|
content = {
|
||||||
type = "lvm_pv";
|
type = "lvm_pv";
|
||||||
vg = "pool";
|
vg = "pool";
|
||||||
|
|||||||
@@ -44,6 +44,12 @@ in
|
|||||||
};
|
};
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
additionalKeyFiles = lib.mkOption {
|
||||||
|
type = lib.types.listOf diskoLib.optionTypes.absolute-pathname;
|
||||||
|
default = [];
|
||||||
|
description = "Path to additional key files for encryption";
|
||||||
|
example = ["/tmp/disk2.key"];
|
||||||
|
};
|
||||||
initrdUnlock = lib.mkOption {
|
initrdUnlock = lib.mkOption {
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
@@ -82,6 +88,7 @@ in
|
|||||||
cryptsetup luksOpen ${config.device} ${config.name} \
|
cryptsetup luksOpen ${config.device} ${config.name} \
|
||||||
${toString config.extraOpenArgs} \
|
${toString config.extraOpenArgs} \
|
||||||
${keyFileArgs}
|
${keyFileArgs}
|
||||||
|
${toString (lib.lists.forEach config.additionalKeyFiles (x: "cryptsetup luksAddKey ${config.device} ${x} ${keyFileArgs}"))}
|
||||||
${lib.optionalString (config.content != null) config.content._create}
|
${lib.optionalString (config.content != null) config.content._create}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -135,6 +135,7 @@
|
|||||||
|
|
||||||
machine.start()
|
machine.start()
|
||||||
machine.succeed("echo -n 'secretsecret' > /tmp/secret.key")
|
machine.succeed("echo -n 'secretsecret' > /tmp/secret.key")
|
||||||
|
machine.succeed("echo -n 'additionalSecret' > /tmp/additionalSecret.key")
|
||||||
${lib.optionalString (testMode == "direct") ''
|
${lib.optionalString (testMode == "direct") ''
|
||||||
machine.succeed("${tsp-create}")
|
machine.succeed("${tsp-create}")
|
||||||
machine.succeed("${tsp-mount}")
|
machine.succeed("${tsp-mount}")
|
||||||
|
|||||||
Reference in new issue
Block a user