luks-interactive-login: don't use passwordFile

This commit is contained in:
Michael Hoang 2023-12-24 00:42:23 +11:00
parent 7ded58beaf
commit 6b98b81b9c
3 changed files with 14 additions and 5 deletions

View file

@ -25,7 +25,7 @@
type = "luks";
name = "crypted";
# disable settings.keyFile if you want to use interactive password entry
#passwordFile = "/tmp/secret.key"; # Interactive
# passwordFile = "/tmp/secret.key"; # Interactive
settings = {
allowDiscards = true;
keyFile = "/tmp/secret.key";

View file

@ -22,7 +22,6 @@
type = "luks";
name = "crypted";
settings.allowDiscards = true;
passwordFile = "/tmp/secret.key";
content = {
type = "filesystem";
format = "ext4";
@ -35,4 +34,11 @@
};
};
};
# If we don't set passwordFile above, we will be interactively prompted by the
# disko script to set the LUKS password. However, as passwordFile is necessary
# for installTest we set it here.
disko.tests.extraDiskoConfig = {
devices.disk.vdb.content.partitions.luks.content.passwordFile = "/tmp/secret.key";
};
}

View file

@ -1,10 +1,13 @@
{ pkgs ? import <nixpkgs> { }
, diskoLib ? pkgs.callPackage ../lib { }
}:
diskoLib.testLib.makeDiskoTest {
diskoLib.testLib.makeDiskoTest (let
disko-config = import ../example/luks-interactive-login.nix;
in {
inherit pkgs;
name = "luks-interactive-login";
disko-config = ../example/luks-interactive-login.nix;
inherit disko-config;
inherit (disko-config.disko.tests) extraDiskoConfig;
extraTestScript = ''
machine.succeed("cryptsetup isLuks /dev/vda2");
'';
@ -12,4 +15,4 @@ diskoLib.testLib.makeDiskoTest {
machine.wait_for_console_text("vda")
machine.send_console("secretsecret\n")
'';
}
})