1 import ./make-test-python.nix (
13 domain = "acme-dns.home.arpa";
15 nsadmin = "admin.home.arpa";
17 "${domain}. A 127.0.0.1"
19 "${domain}. NS ${domain}."
22 logconfig.loglevel = "debug";
25 environment.systemPackages = with pkgs; [
34 machine.wait_for_unit("acme-dns.service")
35 machine.wait_for_open_port(53) # dns
36 machine.wait_for_open_port(8080) # http api
38 result = machine.succeed("curl --fail -X POST http://localhost:8080/register")
41 registration = json.loads(result)
43 machine.succeed(f'dig -t TXT @localhost {registration["fulldomain"]} | grep "SOA" | grep "admin.home.arpa"')
45 # acme-dns exspects a TXT value string length of exactly 43 chars
46 txt = "___dummy_validation_token_for_txt_record___"
49 "curl --fail -X POST http://localhost:8080/update "
50 + f' -H "X-Api-User: {registration["username"]}"'
51 + f' -H "X-Api-Key: {registration["password"]}"'
52 + f' -d \'{{"subdomain":"{registration["subdomain"]}", "txt":"{txt}"}}\'''
55 assert txt in machine.succeed(f'dig -t TXT +short @localhost {registration["fulldomain"]}')