mirror of
https://github.com/CHN-beta/nixpkgs.git
synced 2026-01-11 18:32:23 +08:00
nixos/tests/systemd-initrd-credentials: init
(cherry picked from commit dd15d6c248)
This commit is contained in:
committed by
Florian Klink
parent
96f0f8b632
commit
8253d26e46
@@ -1304,6 +1304,7 @@ in
|
||||
systemd-escaping = handleTest ./systemd-escaping.nix { };
|
||||
systemd-initrd-bridge = handleTest ./systemd-initrd-bridge.nix { };
|
||||
systemd-initrd-btrfs-raid = handleTest ./systemd-initrd-btrfs-raid.nix { };
|
||||
systemd-initrd-credentials = handleTest ./systemd-initrd-credentials.nix { };
|
||||
systemd-initrd-luks-fido2 = handleTest ./systemd-initrd-luks-fido2.nix { };
|
||||
systemd-initrd-luks-keyfile = handleTest ./systemd-initrd-luks-keyfile.nix { };
|
||||
systemd-initrd-luks-empty-passphrase = handleTest ./initrd-luks-empty-passphrase.nix {
|
||||
|
||||
35
nixos/tests/systemd-initrd-credentials.nix
Normal file
35
nixos/tests/systemd-initrd-credentials.nix
Normal file
@@ -0,0 +1,35 @@
|
||||
import ./make-test-python.nix (
|
||||
|
||||
{ lib, pkgs, ... }:
|
||||
{
|
||||
name = "systemd-initrd-credentials";
|
||||
|
||||
nodes.machine =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
virtualisation = {
|
||||
qemu.options = [
|
||||
"-smbios type=11,value=io.systemd.credential:cred-smbios=secret-smbios"
|
||||
];
|
||||
};
|
||||
|
||||
boot.initrd.availableKernelModules = [ "dmi_sysfs" ];
|
||||
|
||||
boot.kernelParams = [ "systemd.set_credential=cred-cmdline:secret-cmdline" ];
|
||||
|
||||
boot.initrd.systemd = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
machine.wait_for_unit("multi-user.target")
|
||||
|
||||
# Check credential passed via kernel command line
|
||||
assert "secret-cmdline" in machine.succeed("systemd-creds --system cat cred-cmdline")
|
||||
|
||||
# Check credential passed via SMBIOS
|
||||
assert "secret-smbios" in machine.succeed("systemd-creds --system cat cred-smbios")
|
||||
'';
|
||||
}
|
||||
)
|
||||
Reference in New Issue
Block a user