Stub raus, vollständig implementiert:
* Migration 0014: dns_settings (single-row) + dns_zones.forward_to.
Default-Settings sind sinnvoll für die typische LAN-Resolver-Rolle
(1.1.1.1 + 9.9.9.9 upstream, localnet allow, DNSSEC + qname-min on).
* internal/services/dns: CRUD-Repo für zones, records, settings.
* internal/handlers/dns.go: REST /api/v1/dns/zones, /records, /settings
mit Auto-Reload nach jeder Mutation.
* internal/unbound/unbound.cfg.tpl + unbound.go: Renderer schreibt
/etc/unbound/unbound.conf.d/edgeguard.conf direkt (kein Symlink-
Dance, weil AppArmor unbound nur /etc/unbound erlaubt). Local-zones
authoritativ aus dns_records; forward-zones per stub-zone; default-
forwarders catchen alles sonst.
* main.go: dnsRepo + unbound-Reloader injiziert.
* render.go: unbound.New() bekommt Pool.
* postinst:
- Conf-Datei /etc/unbound/unbound.conf.d/edgeguard.conf wird als
edgeguard:edgeguard 0644 angelegt damit Renderer schreiben kann.
- /etc/edgeguard + Service-Subdirs auf 0755 (Squid + Unbound laufen
NICHT als edgeguard, brauchen Read-Traversal).
- Sudoers: systemctl reload unbound.service whitelisted.
* Template: chroot:"" (Conf liegt außerhalb /var/lib/unbound default-
chroot), DNSSEC-Trust-Anchor NICHT setzen (Distro hat schon
root-auto-trust-anchor-file.conf — sonst doppelter Anchor → start
failure).
* Frontend /dns: PageHeader + zwei Tabs (Zones + Resolver-Settings).
Zones-Tab mit Drawer für Records (CRUD pro Zone, A/AAAA/CNAME/TXT/
MX/SRV/NS/PTR/CAA). Sidebar-Eintrag unter Network.
* i18n DE/EN für dns.* Block.
Verified end-to-end: render → unbound restart → dig @127.0.0.1
example.com → 104.20.23.154 / 172.66.147.243.
Version 1.0.34 (mehrere Iterationen wegen AppArmor + chroot + perms).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
36 lines
1.5 KiB
SQL
36 lines
1.5 KiB
SQL
-- +goose Up
|
|
-- +goose StatementBegin
|
|
|
|
-- Forward-zone-Targets: pro dns_zones-Row vom type='forward' steht
|
|
-- hier die Komma-separierte Upstream-Liste (z.B. "10.0.0.53, 8.8.8.8").
|
|
-- Für type='local' bleibt das Feld NULL — local-data kommt aus
|
|
-- dns_records.
|
|
ALTER TABLE dns_zones
|
|
ADD COLUMN IF NOT EXISTS forward_to TEXT;
|
|
|
|
-- Plus: globale Settings-Tabelle (single-row) für die DNS-Resolver-
|
|
-- Konfiguration. listen_addresses ist Komma-separiert; access_acl
|
|
-- gibt die CIDR-Liste die den Resolver benutzen darf.
|
|
CREATE TABLE IF NOT EXISTS dns_settings (
|
|
id BIGINT PRIMARY KEY DEFAULT 1,
|
|
listen_addresses TEXT NOT NULL DEFAULT '127.0.0.1, ::1',
|
|
listen_port INTEGER NOT NULL DEFAULT 53,
|
|
upstream_forwards TEXT NOT NULL DEFAULT '1.1.1.1, 9.9.9.9, 1.0.0.1',
|
|
access_acl TEXT NOT NULL DEFAULT '127.0.0.0/8, ::1/128, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16',
|
|
dnssec BOOLEAN NOT NULL DEFAULT TRUE,
|
|
qname_minimisation BOOLEAN NOT NULL DEFAULT TRUE,
|
|
cache_min_ttl INTEGER NOT NULL DEFAULT 60,
|
|
cache_max_ttl INTEGER NOT NULL DEFAULT 86400,
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
CONSTRAINT dns_settings_singleton CHECK (id = 1)
|
|
);
|
|
INSERT INTO dns_settings (id) VALUES (1) ON CONFLICT DO NOTHING;
|
|
|
|
-- +goose StatementEnd
|
|
|
|
-- +goose Down
|
|
-- +goose StatementBegin
|
|
DROP TABLE IF EXISTS dns_settings;
|
|
ALTER TABLE dns_zones DROP COLUMN IF EXISTS forward_to;
|
|
-- +goose StatementEnd
|