1 import ./make-test-python.nix ({ lib, ... }: {
2 name = "systemd-initrd-network-ssh";
3 meta.maintainers = [ lib.maintainers.elvishjerricco ];
6 server = { config, pkgs, ... }: {
7 testing.initrdBackdoor = true;
8 boot.initrd.systemd.enable = true;
9 boot.initrd.systemd.contents."/etc/msg".text = "foo";
10 boot.initrd.network = {
14 authorizedKeys = [ (lib.readFile ./initrd-network-ssh/id_ed25519.pub) ];
16 hostKeys = [ ./initrd-network-ssh/ssh_host_ed25519_key ];
21 client = { config, ... }: {
24 text = lib.concatStrings [
27 toString (lib.head (lib.splitString " " (toString
28 (lib.elemAt (lib.splitString "\n" config.networking.extraHosts) 2))))
30 "${lib.readFile ./initrd-network-ssh/ssh_host_ed25519_key.pub}"
34 source = ./initrd-network-ssh/id_ed25519;
44 def ssh_is_up(_) -> bool:
45 status, _ = client.execute("nc -z server 22")
48 client.wait_for_unit("network.target")
49 with client.nested("waiting for SSH server to come up"):
53 "ssh -i /etc/sshKey -o UserKnownHostsFile=/etc/knownHosts server 'cat /etc/msg'"
58 server.wait_for_unit("multi-user.target")