1import ./make-test-python.nix (
2 { pkgs, ... }: {
3 name = "dnsdist";
4 meta = with pkgs.lib; {
5 maintainers = with maintainers; [ jojosch ];
6 };
7
8 nodes.machine = { pkgs, lib, ... }: {
9 services.bind = {
10 enable = true;
11 extraOptions = "empty-zones-enable no;";
12 zones = lib.singleton {
13 name = ".";
14 master = true;
15 file = pkgs.writeText "root.zone" ''
16 $TTL 3600
17 . IN SOA ns.example.org. admin.example.org. ( 1 3h 1h 1w 1d )
18 . IN NS ns.example.org.
19
20 ns.example.org. IN A 192.168.0.1
21 ns.example.org. IN AAAA abcd::1
22
23 1.0.168.192.in-addr.arpa IN PTR ns.example.org.
24 '';
25 };
26 };
27 services.dnsdist = {
28 enable = true;
29 listenPort = 5353;
30 extraConfig = ''
31 newServer({address="127.0.0.1:53", name="local-bind"})
32 '';
33 };
34
35 environment.systemPackages = with pkgs; [ dig ];
36 };
37
38 testScript = ''
39 machine.wait_for_unit("bind.service")
40 machine.wait_for_open_port(53)
41 machine.succeed("dig @127.0.0.1 +short -x 192.168.0.1 | grep -qF ns.example.org")
42
43 machine.wait_for_unit("dnsdist.service")
44 machine.wait_for_open_port(5353)
45 machine.succeed("dig @127.0.0.1 -p 5353 +short -x 192.168.0.1 | grep -qF ns.example.org")
46 '';
47 }
48)