mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 03:23:29 +03:00
parent
d1e14a925a
commit
b0b64316bc
2 changed files with 44 additions and 47 deletions
|
@ -1,58 +1,55 @@
|
||||||
import ./make-test-python.nix (
|
{
|
||||||
{ ... }:
|
name = "acme-dns";
|
||||||
{
|
|
||||||
name = "acme-dns";
|
|
||||||
|
|
||||||
nodes.machine =
|
nodes.machine =
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
{
|
{
|
||||||
services.acme-dns = {
|
services.acme-dns = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
general = rec {
|
general = rec {
|
||||||
domain = "acme-dns.home.arpa";
|
domain = "acme-dns.home.arpa";
|
||||||
nsname = domain;
|
nsname = domain;
|
||||||
nsadmin = "admin.home.arpa";
|
nsadmin = "admin.home.arpa";
|
||||||
records = [
|
records = [
|
||||||
"${domain}. A 127.0.0.1"
|
"${domain}. A 127.0.0.1"
|
||||||
"${domain}. AAAA ::1"
|
"${domain}. AAAA ::1"
|
||||||
"${domain}. NS ${domain}."
|
"${domain}. NS ${domain}."
|
||||||
];
|
];
|
||||||
};
|
|
||||||
logconfig.loglevel = "debug";
|
|
||||||
};
|
};
|
||||||
|
logconfig.loglevel = "debug";
|
||||||
};
|
};
|
||||||
environment.systemPackages = with pkgs; [
|
|
||||||
curl
|
|
||||||
bind
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
curl
|
||||||
|
bind
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
testScript = ''
|
testScript = ''
|
||||||
import json
|
import json
|
||||||
|
|
||||||
machine.wait_for_unit("acme-dns.service")
|
machine.wait_for_unit("acme-dns.service")
|
||||||
machine.wait_for_open_port(53) # dns
|
machine.wait_for_open_port(53) # dns
|
||||||
machine.wait_for_open_port(8080) # http api
|
machine.wait_for_open_port(8080) # http api
|
||||||
|
|
||||||
result = machine.succeed("curl --fail -X POST http://localhost:8080/register")
|
result = machine.succeed("curl --fail -X POST http://localhost:8080/register")
|
||||||
print(result)
|
print(result)
|
||||||
|
|
||||||
registration = json.loads(result)
|
registration = json.loads(result)
|
||||||
|
|
||||||
machine.succeed(f'dig -t TXT @localhost {registration["fulldomain"]} | grep "SOA" | grep "admin.home.arpa"')
|
machine.succeed(f'dig -t TXT @localhost {registration["fulldomain"]} | grep "SOA" | grep "admin.home.arpa"')
|
||||||
|
|
||||||
# acme-dns exspects a TXT value string length of exactly 43 chars
|
# acme-dns exspects a TXT value string length of exactly 43 chars
|
||||||
txt = "___dummy_validation_token_for_txt_record___"
|
txt = "___dummy_validation_token_for_txt_record___"
|
||||||
|
|
||||||
machine.succeed(
|
machine.succeed(
|
||||||
"curl --fail -X POST http://localhost:8080/update "
|
"curl --fail -X POST http://localhost:8080/update "
|
||||||
+ f' -H "X-Api-User: {registration["username"]}"'
|
+ f' -H "X-Api-User: {registration["username"]}"'
|
||||||
+ f' -H "X-Api-Key: {registration["password"]}"'
|
+ f' -H "X-Api-Key: {registration["password"]}"'
|
||||||
+ f' -d \'{{"subdomain":"{registration["subdomain"]}", "txt":"{txt}"}}\'''
|
+ f' -d \'{{"subdomain":"{registration["subdomain"]}", "txt":"{txt}"}}\'''
|
||||||
)
|
)
|
||||||
|
|
||||||
assert txt in machine.succeed(f'dig -t TXT +short @localhost {registration["fulldomain"]}')
|
assert txt in machine.succeed(f'dig -t TXT +short @localhost {registration["fulldomain"]}')
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
)
|
|
||||||
|
|
|
@ -147,7 +147,7 @@ in {
|
||||||
_3proxy = runTest ./3proxy.nix;
|
_3proxy = runTest ./3proxy.nix;
|
||||||
aaaaxy = runTest ./aaaaxy.nix;
|
aaaaxy = runTest ./aaaaxy.nix;
|
||||||
acme = import ./acme/default.nix { inherit runTest; };
|
acme = import ./acme/default.nix { inherit runTest; };
|
||||||
acme-dns = handleTest ./acme-dns.nix {};
|
acme-dns = runTest ./acme-dns.nix;
|
||||||
actual = handleTest ./actual.nix {};
|
actual = handleTest ./actual.nix {};
|
||||||
adguardhome = runTest ./adguardhome.nix;
|
adguardhome = runTest ./adguardhome.nix;
|
||||||
aesmd = runTestOn ["x86_64-linux"] ./aesmd.nix;
|
aesmd = runTestOn ["x86_64-linux"] ./aesmd.nix;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue