Skip to content

Commit a247dd2

Browse files
committed
nixos/nebula: add DNS tests
Signed-off-by: Sirio Balmelli <[email protected]>
1 parent 40567b6 commit a247dd2

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

nixos/tests/nebula.nix

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ import ./make-test-python.nix (
1414
lib.mkMerge [
1515
{
1616
# Expose nebula for doing cert signing.
17-
environment.systemPackages = [ pkgs.nebula ];
17+
environment.systemPackages = [
18+
pkgs.dig
19+
pkgs.nebula
20+
];
1821
users.users.root.openssh.authorizedKeys.keys = [ snakeOilPublicKey ];
1922
services.openssh.enable = true;
2023
networking.firewall.enable = true; # Implicitly true, but let's make sure.
@@ -51,6 +54,7 @@ import ./make-test-python.nix (
5154
lighthouse =
5255
{ ... }@args:
5356
makeNebulaNode args "lighthouse" {
57+
networking.firewall.allowedUDPPorts = [ 53 ];
5458
networking.interfaces.eth1.ipv4.addresses = lib.mkForce [
5559
{
5660
address = "192.168.1.1";
@@ -77,6 +81,13 @@ import ./make-test-python.nix (
7781
}
7882
];
7983
};
84+
lighthouse = {
85+
dns = {
86+
enable = true;
87+
host = "10.0.100.1"; # bind to lighthouse interface
88+
port = 53; # answer on standard DNS port
89+
};
90+
};
8091
};
8192
};
8293

@@ -338,6 +349,8 @@ import ./make-test-python.nix (
338349
# allowAny can ping the lighthouse, but not allowFromLighthouse because of its inbound firewall
339350
allowAny.succeed("ping -c3 10.0.100.1")
340351
allowAny.fail("ping -c3 10.0.100.3")
352+
# allowAny can also resolve DNS on lighthouse
353+
allowAny.succeed("dig @10.0.100.1 allowToLighthouse | grep -E 'allowToLighthouse\.\s+[0-9]+\s+IN\s+A\s+10\.0\.100\.4'")
341354
342355
# allowFromLighthouse can ping the lighthouse and allowAny
343356
allowFromLighthouse.succeed("ping -c3 10.0.100.1")

0 commit comments

Comments
 (0)