Skip to content

Commit

Permalink
luks-interactive-login: don't use passwordFile
Browse files Browse the repository at this point in the history
  • Loading branch information
Enzime committed Dec 23, 2023
1 parent 7ded58b commit 6b98b81
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion example/luks-btrfs-subvolumes.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
8 changes: 7 additions & 1 deletion example/luks-interactive-login.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
type = "luks";
name = "crypted";
settings.allowDiscards = true;
passwordFile = "/tmp/secret.key";
content = {
type = "filesystem";
format = "ext4";
Expand All @@ -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";
};
}
9 changes: 6 additions & 3 deletions tests/luks-interactive-login.nix
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
{ 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");
'';
bootCommands = ''
machine.wait_for_console_text("vda")
machine.send_console("secretsecret\n")
'';
}
})

0 comments on commit 6b98b81

Please sign in to comment.