system/roles/auth-dns.nix (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | {
config,
pkgs,
...
}:
let
domain = config.networking.domain;
in
{
imports = [
../settings/programs/sqlite.nix
];
age.secrets.powerdns.file = ../../secrets/powerdns.age;
networking.firewall = {
allowedTCPPorts = [ 53 ];
allowedUDPPorts = [ 53 ];
};
services.powerdns = {
enable = true;
secretFile = config.age.secrets.powerdns.path;
extraConfig = ''
local-address=::
launch=gsqlite3
dnsupdate=yes
allow-dnsupdate-from=0.0.0.0/0,::/0
dnsupdate-require-tsig=yes
expand-alias=yes
outgoing-axfr-expand-alias=yes # needed with DNSSEC
svc-autohints=yes
resolver=2606:4700:4700::1111
log-dns-details=no
log-dns-queries=no
loglevel=5
primary=yes
default-api-rectify=yes
default-soa-edit=inception-increment
api=yes
# replaced by secretFile/envsubst
api-key=$API_KEY
gsqlite3-database=/var/db/pdns/zones.db
gsqlite3-pragma-foreign-keys=yes
gsqlite3-dnssec=yes
'';
};
environment.systemPackages = [ pkgs.pdns ];
services.caddy.virtualHosts = {
"pdns.${domain}" = {
extraConfig = ''
log {
output discard
}
reverse_proxy 127.0.0.1:8081
'';
};
};
}
|