about summary refs log tree commit diff
path: root/nixos/tests/nebula.nix
diff options
context:
space:
mode:
authorMorgan Jones <me@numin.it>2022-12-28 19:48:59 -0800
committerMorgan Jones <me@numin.it>2023-02-04 16:24:45 -0800
commit90581c977ff1dc2442a79fd9d173ae1e307f6e53 (patch)
treee68e7be619006213ac9913bfaa12a053dbdd73b5 /nixos/tests/nebula.nix
parent9f7227625987ef43f6881ea8905c85f02f057da6 (diff)
nixos/nebula: don't run as root; support relays
Diffstat (limited to 'nixos/tests/nebula.nix')
-rw-r--r--nixos/tests/nebula.nix17
1 files changed, 9 insertions, 8 deletions
diff --git a/nixos/tests/nebula.nix b/nixos/tests/nebula.nix
index 372cfebdf801b..1617430b38907 100644
--- a/nixos/tests/nebula.nix
+++ b/nixos/tests/nebula.nix
@@ -123,12 +123,13 @@ in
   testScript = let
 
     setUpPrivateKey = name: ''
-    ${name}.succeed(
-        "mkdir -p /root/.ssh",
-        "chown 700 /root/.ssh",
-        "cat '${snakeOilPrivateKey}' > /root/.ssh/id_snakeoil",
-        "chown 600 /root/.ssh/id_snakeoil",
-    )
+      ${name}.start()
+      ${name}.succeed(
+          "mkdir -p /root/.ssh",
+          "chown 700 /root/.ssh",
+          "cat '${snakeOilPrivateKey}' > /root/.ssh/id_snakeoil",
+          "chown 600 /root/.ssh/id_snakeoil",
+      )
     '';
 
     # From what I can tell, StrictHostKeyChecking=no is necessary for ssh to work between machines.
@@ -154,18 +155,18 @@ in
       ${name}.succeed(
           "scp ${sshOpts} 192.168.1.1:/tmp/${name}.crt /etc/nebula/${name}.crt",
           "scp ${sshOpts} 192.168.1.1:/etc/nebula/ca.crt /etc/nebula/ca.crt",
+          '(id nebula-smoke >/dev/null && chown -R nebula-smoke:nebula-smoke /etc/nebula) || true'
       )
     '';
 
   in ''
-    start_all()
-
     # Create the certificate and sign the lighthouse's keys.
     ${setUpPrivateKey "lighthouse"}
     lighthouse.succeed(
         "mkdir -p /etc/nebula",
         'nebula-cert ca -name "Smoke Test" -out-crt /etc/nebula/ca.crt -out-key /etc/nebula/ca.key',
         'nebula-cert sign -ca-crt /etc/nebula/ca.crt -ca-key /etc/nebula/ca.key -name "lighthouse" -groups "lighthouse" -ip "10.0.100.1/24" -out-crt /etc/nebula/lighthouse.crt -out-key /etc/nebula/lighthouse.key',
+        'chown -R nebula-smoke:nebula-smoke /etc/nebula'
     )
 
     # Reboot the lighthouse and verify that the nebula service comes up on boot.