···
1
-
import ./make-test-python.nix (
9
-
services.acme-dns = {
13
-
domain = "acme-dns.home.arpa";
15
-
nsadmin = "admin.home.arpa";
17
-
"${domain}. A 127.0.0.1"
18
-
"${domain}. AAAA ::1"
19
-
"${domain}. NS ${domain}."
22
-
logconfig.loglevel = "debug";
7
+
services.acme-dns = {
11
+
domain = "acme-dns.home.arpa";
13
+
nsadmin = "admin.home.arpa";
15
+
"${domain}. A 127.0.0.1"
16
+
"${domain}. AAAA ::1"
17
+
"${domain}. NS ${domain}."
20
+
logconfig.loglevel = "debug";
25
-
environment.systemPackages = with pkgs; [
23
+
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
32
+
machine.wait_for_unit("acme-dns.service")
33
+
machine.wait_for_open_port(53) # dns
34
+
machine.wait_for_open_port(8080) # http api
38
-
result = machine.succeed("curl --fail -X POST http://localhost:8080/register")
36
+
result = machine.succeed("curl --fail -X POST http://localhost:8080/register")
41
-
registration = json.loads(result)
39
+
registration = json.loads(result)
43
-
machine.succeed(f'dig -t TXT @localhost {registration["fulldomain"]} | grep "SOA" | grep "admin.home.arpa"')
41
+
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___"
43
+
# acme-dns exspects a TXT value string length of exactly 43 chars
44
+
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}"}}\'''
47
+
"curl --fail -X POST http://localhost:8080/update "
48
+
+ f' -H "X-Api-User: {registration["username"]}"'
49
+
+ f' -H "X-Api-Key: {registration["password"]}"'
50
+
+ f' -d \'{{"subdomain":"{registration["subdomain"]}", "txt":"{txt}"}}\'''
55
-
assert txt in machine.succeed(f'dig -t TXT +short @localhost {registration["fulldomain"]}')
53
+
assert txt in machine.succeed(f'dig -t TXT +short @localhost {registration["fulldomain"]}')