LibrePortal/scripts/app/containers/adguard/adguard_apply_dns_updater.sh
librelad e5f6f4c371 feat(dns): split-horizon local DNS for app subdomains
setupLocalDnsRewrites points every configured domain at the server's LAN IP
inside the self-hosted resolver, so app subdomains resolve locally and hit
Traefik directly (valid certs, no router hairpin). AdGuard gets a wildcard
rewrite per domain via its REST API; Pi-hole gets per-host A records in the
supported, mounted custom.list (no wildcard support there). Safe by
construction: idempotent, guarded by installed-checks, cannot corrupt the
resolver. Hooked into the Apply-DNS actions and resolver install. Also drops
the dead HOST_NAME read from the setupDNSIP stub.

NOTE: needs a live smoke-test — the AdGuard API call and Pi-hole reload
can't be exercised without the running containers.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
2026-05-22 01:10:56 +01:00

15 lines
498 B
Bash

#!/bin/bash
appAdguardApplyDnsUpdater()
{
isHeader "Apply DNS Updater (AdGuard)"
if ! declare -F updateDNS >/dev/null 2>&1; then
isError "updateDNS function not loaded — cannot apply."
return 1
fi
updateDNS "adguard" "manual"
isSuccessful "/etc/resolv.conf updated to use AdGuard as the host DNS resolver."
# Split-horizon: make app subdomains resolve to the box on the LAN.
declare -F setupLocalDnsRewrites >/dev/null 2>&1 && setupLocalDnsRewrites
}