PowerDNS (local secondary of web01)¶
Poweradmin + PowerDNS Authoritative in the community-scripts
powerdns LXC on node04. It holds a read-only copy (secondary) of every zone that DirectAdmin
serves on web01.discloud.biz, so the homelab can answer for those zones itself and has a
current copy when web01 is down.
DirectAdmin (web01) homelab
BIND primary ──AXFR over TCP/53 (TSIG homelab-axfr)──▶ powerdns LXC (PowerDNS secondary, sqlite)
named-checkconf -l ──zone list──▶ Semaphore "powerdns sync" (*/15) ──▶ pdns-secondary-sync
| Piece | Where |
|---|---|
| Create + configure | playbooks/powerdns.yml (runs ct/powerdns.sh unattended on node04 once) |
| Sync | playbooks/powerdns_sync.yml — Semaphore schedule every 15 min, also in Actions → deploy |
| PowerDNS settings | roles/powerdns_secondary → /etc/powerdns/pdns.d/infra.conf |
| Sync script | /usr/local/sbin/pdns-secondary-sync (adds / re-points / refreshes / prunes secondaries) |
| BIND on web01 | roles/directadmin_axfr: key file next to named.conf, include + allow-transfer { key "homelab-axfr"; … } |
| Metrics | pdns webserver :8081/metrics (scraped as app_metrics), sync textfile pdns_secondary_* |
| Alerts | PowerDNSSecondarySyncStale, PowerDNSSecondarySyncFailing, PowerDNSSecondaryBehind, plus the generic ServiceDown probes (Poweradmin :80, DNS tcp/53, web01 :2222 + tcp/53) |
How the sync works¶
- The TSIG key
homelab-axfris generated on the PowerDNS LXC (pdnsutil generate-tsig-key) and copied into BIND on web01 by the same run — it is not in the repo or the vault. - On web01 a small script adds the key
includeand the key to the options-levelallow-transfer(existing entries stay,noneis replaced).named-checkconfmust pass, otherwise the edited file is restored from its.infra-backupcopy. The edited file is the one that holdsoptions { }:/etc/bind/named.conf.optionson Ubuntu/Debian,named.confon CentOS-style hosts. Thenrndc reconfig. named-checkconf -llists every primary zone;.arpaand localhost zones are skipped (directadmin_zone_exclude*).pdns-secondary-synccreates missing zones as secondary of web01 withAXFR-MASTER-TSIG, asks web01 for the SOA serial of the others and retrieves zones that differ, and deletes secondaries web01 no longer has (powerdns_sync_prune). Zones of other primaries and zones you create yourself in Poweradmin are never touched.
No NOTIFY: that would need UDP/53 from the internet forwarded to the LXC. A change on web01
therefore shows up within 15 minutes (or at the zone's SOA refresh). With a port forward,
set powerdns_allow_notify_from: [<web01 IP>] and add also-notify on web01.
One-time setup¶
- Put the root public key of the Semaphore CT (
pct exec 157 -- cat /root/.ssh/id_ed25519.pub) and of the gh-runner intoroot@web01:~/.ssh/authorized_keys. Different SSH port:ansible_portininventory/host_vars/web01.yml. ansible-playbook playbooks/powerdns.yml(or Actions → deploy → powerdns.yml). Poweradmin admin password:cat ~/poweradmin.credsin the CT → AliasVault.- Re-run
scripts/semaphore/configure.shon node04: adds the templates powerdns and powerdns sync and the 15-minute schedule. - Dry run any time:
ansible-playbook playbooks/powerdns_sync.yml --check --diff(shows thenamed.confdiff and which zones would be added/removed).
Checks¶
pct exec <ct> -- pdnsutil list-all-zones secondary | wc -l
dig @<powerdns-ip> discloud.biz SOA +short # same serial as:
dig @web01.discloud.biz discloud.biz SOA +short