diff --git a/nixos/release.nix b/nixos/release.nix index 6eb896106a14..ac4dd3d78923 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -263,7 +263,7 @@ in rec { tests.hibernate = callTest tests/hibernate.nix {}; tests.hound = callTest tests/hound.nix {}; tests.i3wm = callTest tests/i3wm.nix {}; - tests.initrd-network-ssh = callTest tests/initrd-network-ssh.nix {}; + tests.initrd-network-ssh = callTest tests/initrd-network-ssh {}; tests.installer = callSubTests tests/installer.nix {}; tests.influxdb = callTest tests/influxdb.nix {}; tests.ipv6 = callTest tests/ipv6.nix {}; diff --git a/nixos/tests/initrd-network-ssh.nix b/nixos/tests/initrd-network-ssh/default.nix similarity index 69% rename from nixos/tests/initrd-network-ssh.nix rename to nixos/tests/initrd-network-ssh/default.nix index 596610493921..9d476cb1a967 100644 --- a/nixos/tests/initrd-network-ssh.nix +++ b/nixos/tests/initrd-network-ssh/default.nix @@ -1,19 +1,6 @@ -import ./make-test.nix ({ pkgs, lib, ... }: +import ../make-test.nix ({ pkgs, lib, ... }: -let - keys = pkgs.runCommand "gen-keys" { - outputs = [ "out" "dbPub" "dbPriv" "sshPub" "sshPriv" ]; - buildInputs = with pkgs; [ dropbear openssh ]; - } - '' - touch $out - dropbearkey -t rsa -f $dbPriv -s 4096 | sed -n 2p > $dbPub - ssh-keygen -q -t rsa -b 4096 -N "" -f client - mv client $sshPriv - mv client.pub $sshPub - ''; - -in { +{ name = "initrd-network-ssh"; meta = with lib.maintainers; { maintainers = [ willibutz ]; @@ -32,9 +19,9 @@ in { enable = true; ssh = { enable = true; - authorizedKeys = [ "${readFile keys.sshPub}" ]; + authorizedKeys = [ "${readFile ./openssh.pub}" ]; port = 22; - hostRSAKey = keys.dbPriv; + hostRSAKey = ./dropbear.priv; }; }; boot.initrd.preLVMCommands = '' @@ -56,7 +43,7 @@ in { "${toString (head (splitString " " ( toString (elemAt (splitString "\n" config.networking.extraHosts) 2) )))} " - "${readFile keys.dbPub}" + "${readFile ./dropbear.pub}" ]; }; }; @@ -65,7 +52,7 @@ in { testScript = '' startAll; $client->waitForUnit("network.target"); - $client->copyFileFromHost("${keys.sshPriv}","/etc/sshKey"); + $client->copyFileFromHost("${./openssh.priv}","/etc/sshKey"); $client->succeed("chmod 0600 /etc/sshKey"); $client->waitUntilSucceeds("ping -c 1 server"); $client->succeed("ssh -i /etc/sshKey -o UserKnownHostsFile=/etc/knownHosts server 'touch /fnord'"); diff --git a/nixos/tests/initrd-network-ssh/dropbear.priv b/nixos/tests/initrd-network-ssh/dropbear.priv new file mode 100644 index 000000000000..af340535f0a3 Binary files /dev/null and b/nixos/tests/initrd-network-ssh/dropbear.priv differ diff --git a/nixos/tests/initrd-network-ssh/dropbear.pub b/nixos/tests/initrd-network-ssh/dropbear.pub new file mode 100644 index 000000000000..385c625522aa --- /dev/null +++ b/nixos/tests/initrd-network-ssh/dropbear.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCzJ0OniLB91MpPC86I1m3wwJeAc+Gme7bAuaLIU/cSfPwxT5NO7MfCp0Pu94gYDKtDXMs/wXg0bTAVDeAFFkdIj6kBBumEmQLCTL48q2UxDIXVLT/E/AAgj6q7WwgCg7fwm4Vjn4z7aUyBx8EfRy+5/SQyeYla3D/lFYgMi5x4D6J+yeR+JPAptDE/IR5IizNV7mY0ZcoXYyHrrehI1tTYEEqjX13ZqS4OCBFWwHe1QHhRNM+jHhcATbgikjAj8FyFPtLvc+dSVtkuhQktQl36Bi8zMUQcV6+mM7Ln6DBcDlM9urHKLYPTWmUAyhxM955iglOn5z0RaAIcyNMT6hz0rHaNf0BIlmbXoTC0XGjHh/OnoOEC/zg0JqgQTnPiU45K4TnRSSXp2GfiDfiQAK0+HaXACkjuFR68u7WCZpB1Bse1OgKNClFqtRhIr5DilUb2/e5DCCmFkddMUcjmYqzZdbXNt7fo8CFULe+mbiCp8+tMg4aRTaDZ/Hk93nCvGE5TP2ypEMbfL6nRVKvXOjhdvSQQgKwx+O003FDEHCSG0Bpageh7yVpna+SPrbGklce7MjTpbx3iIwmvKpQ6asnK1L3KkahpY1S3NhQ+/S3Gs8KWQ5LAU+d3xiPX3jfIVHsCIIyxHDbwcJvxM4MFBFQpqRMD6E+LoM9RHjl4C9k2iQ== tmtynkky@duuni diff --git a/nixos/tests/initrd-network-ssh/generate-keys.nix b/nixos/tests/initrd-network-ssh/generate-keys.nix new file mode 100644 index 000000000000..0183e12d7a88 --- /dev/null +++ b/nixos/tests/initrd-network-ssh/generate-keys.nix @@ -0,0 +1,12 @@ +with import ../../.. {}; + +runCommand "gen-keys" { + buildInputs = [ dropbear openssh ]; + } + '' + mkdir $out + dropbearkey -t rsa -f $out/dropbear.priv -s 4096 | sed -n 2p > $out/dropbear.pub + ssh-keygen -q -t rsa -b 4096 -N "" -f client + mv client $out/openssh.priv + mv client.pub $out/openssh.pub + '' diff --git a/nixos/tests/initrd-network-ssh/openssh.priv b/nixos/tests/initrd-network-ssh/openssh.priv new file mode 100644 index 000000000000..816d65435fd7 --- /dev/null +++ b/nixos/tests/initrd-network-ssh/openssh.priv @@ -0,0 +1,51 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIJKAIBAAKCAgEA7+9A2PCPOTAlFmrablrUWA+VZdAuLfM6JXeHsOF7ZbC2F6lv +WmvDM925DQqhiAjcgWnt5WHWS5Y+b7lGnuzT7fyKegXd80nCRmqlpSG3srX0/lxR +aQAJLzfoDjcsF+ceswQo6GSsYnCHVxMNs007gbbVY3f7o+sWZtLdxJPD2iHvl5Zr +LK0d1RLMmU6cfIhIABlL0S8EWiv29RROepsCQnS0dnK2b+von1SCYoggvAMe2ToA +IAJ8+uqaYfGAyn9q8fjZiRHxLmKDq90tKoCUL5r/2dmEIE+t8T/3PfHoq1QzZts9 +W9idhBdT21dEXBtGyoMtckp5njk5m82LQDYiOXkuSoIUhSOteh5g7fBv1BtVSERx +Jg3UeJjPeGKFwdnzapmAKC2w/6V8xcIINNA+fhZA7B9fD1RAi2TECZ+gyMY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0NnX/ +u8KNUYcUHbV60ulqOThuYHQ/3I9EUUAijaqqjV2sXts19ke68W0x6HKpBJhuudT9 +ktPzbdhyP8Xyl/pocNnerXwexZBsi3Ye6+eIDFz+8OnsBHVcgNPluS72tvsxgqj7 +ciNTiBGCxKKo55eCWBhRPpXE2WUrf/hGPYsBMl2h6FfZMH1+M/N7B4tgdJmS+woU +Ftws8lTjJEiwA6HFN1ZxrwLNjJobx9yPAoIBAE0igsBuWWn6rXeOPylYg4264XOq +8gb94pte2n9amDgCzyCn8m6AL3snLC/AoCD19DK+gyK0ukoesXPa3iX6w2xv69ZC +urDx36Jhd4zrJb4QsFPoeKfDP+UvNVZaS41vipRRzY/y11em15prUZ4U8FA/UT1Y +FzkBo9r6iUZRnyBLppMuEfWASDtuRNmeIHynoT1AcQOH3l9vR210iEpmAuJr0CYA +bvTuz3UzzGGEAuIUvuaiRtkfKY52jBmiEr7SSPCr1HvLj3Ccz8bgjgR2kiXmcU50 +1zLnaPAD44LZ/0Fjqj+PimQGT6K7CNXPllmYh7MvoU52g3SVPf6rHlIR0Nc= +-----END RSA PRIVATE KEY----- diff --git a/nixos/tests/initrd-network-ssh/openssh.pub b/nixos/tests/initrd-network-ssh/openssh.pub new file mode 100644 index 000000000000..5b72b8085f27 --- /dev/null +++ b/nixos/tests/initrd-network-ssh/openssh.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDv70DY8I85MCUWatpuWtRYD5Vl0C4t8zold4ew4XtlsLYXqW9aa8Mz3bkNCqGICNyBae3lYdZLlj5vuUae7NPt/Ip6Bd3zScJGaqWlIbeytfT+XFFpAAkvN+gONywX5x6zBCjoZKxicIdXEw2zTTuBttVjd/uj6xZm0t3Ek8PaIe+XlmssrR3VEsyZTpx8iEgAGUvRLwRaK/b1FE56mwJCdLR2crZv6+ifVIJiiCC8Ax7ZOgAgAnz66pph8YDKf2rx+NmJEfEuYoOr3S0qgJQvmv/Z2YQgT63xP/c98eirVDNm2z1b2J2EF1PbV0RcG0bKgy1ySnmeOTmbzYtANiI5eS5KghSFI616HmDt8G/UG1VIRHEmDdR4mM94YoXB2fNqmYAoLbD/pXzFwgg00D5+FkDsH18PVECLZMQJn6DIxgNzhP5RKUxKb1x+9I6t/b7meC0VvziceOq8KXEIwu75sJYrwdqapTOET9rkttH7jwTs/IazcpX6xYU30o6dqROOP/qJCFdlGGB4Arf0XZdOTkyzlj4FFJK2cygxkDaCshX6MeLXNtaiRWpc8jlhGjmKxH8+C0oBXoV81a6ZxigUn0XjSkwdDqElUSa2sIHHsQClKXeZIZtAlSaKUsLnWo2HBBFsP/9m2kis3zYdMwrNnqSPuQMJ2x9/7CyeQheaYw== tmtynkky@duuni