Skip to content

Commit

Permalink
nixos/nebula: add DNS tests
Browse files Browse the repository at this point in the history
Signed-off-by: Sirio Balmelli <[email protected]>
  • Loading branch information
siriobalmelli committed Jan 13, 2025
1 parent 56ca4e0 commit 53fe558
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion nixos/tests/nebula.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import ./make-test-python.nix (
lib.mkMerge [
{
# Expose nebula for doing cert signing.
environment.systemPackages = [ pkgs.nebula ];
environment.systemPackages = [ pkgs.dig pkgs.nebula ];
users.users.root.openssh.authorizedKeys.keys = [ snakeOilPublicKey ];
services.openssh.enable = true;
networking.firewall.enable = true; # Implicitly true, but let's make sure.
Expand Down Expand Up @@ -51,6 +51,7 @@ import ./make-test-python.nix (
lighthouse =
{ ... }@args:
makeNebulaNode args "lighthouse" {
networking.firewall.allowedUDPPorts = [ 53 ];
networking.interfaces.eth1.ipv4.addresses = lib.mkForce [
{
address = "192.168.1.1";
Expand All @@ -77,6 +78,13 @@ import ./make-test-python.nix (
}
];
};
lighthouse = {
serveDns = true;
dns = {
host = "10.0.100.1"; # bind to lighthouse interface
port = 53; # answer on standard DNS port
};
};
};
};

Expand Down Expand Up @@ -338,6 +346,8 @@ import ./make-test-python.nix (
# allowAny can ping the lighthouse, but not allowFromLighthouse because of its inbound firewall
allowAny.succeed("ping -c3 10.0.100.1")
allowAny.fail("ping -c3 10.0.100.3")
# allowAny can also resolve DNS on lighthouse
allowAny.succeed("dig @10.0.100.1 allowToLighthouse")
# allowFromLighthouse can ping the lighthouse and allowAny
allowFromLighthouse.succeed("ping -c3 10.0.100.1")
Expand Down

0 comments on commit 53fe558

Please sign in to comment.