Add WireGuard, DNS and more to the web UI and router-setup

Web UI: a WireGuard page (tunnels, peers, keys made on the router, client
configs with a QR code, import of wg-quick configs, live status), a DNS page
(records, wildcards, forward zones), interface dropdowns with VLAN devices,
IPv6 options and a local domain. router-setup asks about VLANs, IPv6 and
the domain. The router publishes its own name in DNS and hands the local
domain to DHCP clients; wg and jq are on the router. Includes a script
that takes over antigua's tunnels.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV9dZrK6nipHkPfyM4F
This commit is contained in:
2026-10-29 23:53:34 +01:00
co-authored by Claude Sonnet 5.5
parent 54040a1402
commit 84f6002d05
23 changed files with 2484 additions and 64 deletions
+11
View File
@@ -71,6 +71,17 @@ in
name = "domain-name-servers";
data = l.ipv4.address;
}
]
# The local domain: clients use it for short names (nas -> nas.home...).
++ lib.optionals (cfg.dns.domain != null) [
{
name = "domain-name";
data = cfg.dns.domain;
}
{
name = "domain-search";
data = cfg.dns.domain;
}
];
}) dhcpLans;
};
+20 -2
View File
@@ -28,13 +28,29 @@ let
reservations = lib.concatMap (
l: lib.mapAttrsToList (n: r: lib.nameValuePair n [ r.address ]) l.dhcp.reservations
) lans;
# The router's own name resolves to its addresses on the LANs (and their
# ULAs), so clients can reach it by name; with a domain also bare, for
# clients that have no search domain.
selfName = config.networking.hostName;
selfAddrs =
map (l: l.ipv4.address) lans
++ map (l: addrOf l.ipv6.address) (lib.filter (l: l.ipv6.address != null) lans);
# Unless dns.hosts names the router itself.
selfDefined = lib.hasAttr selfName dns.hosts || lib.hasAttr (fqdn selfName) dns.hosts;
selfRecord = lib.optional (!selfDefined) (lib.nameValuePair (fqdn selfName) selfAddrs);
# (No reverse record for the bare name: the address has one already.)
selfBare = lib.optional (!selfDefined && fqdn selfName != selfName) (
lib.nameValuePair selfName selfAddrs
);
records =
lib.mapAttrsToList (n: a: lib.nameValuePair (fqdn n) a) dns.hosts
selfRecord
++ lib.mapAttrsToList (n: a: lib.nameValuePair (fqdn n) a) dns.hosts
++ map (r: lib.nameValuePair (fqdn r.name) r.value) reservations
++ lib.mapAttrsToList (n: a: lib.nameValuePair n a) dns.overrides;
# Unbound reads these as one quoted argument.
localData = lib.concatMap (r: map (a: ''"${r.name}. ${rrOf a} ${a}"'') r.value) records;
localData = lib.concatMap (r: map (a: ''"${r.name}. ${rrOf a} ${a}"'') r.value) (records ++ selfBare);
# Reverse records for hosts and reservations (not for wildcard overrides).
ptrs = lib.concatMap (r: map (a: ''"${a} ${r.name}."'') r.value) (
lib.filter (r: !(lib.hasAttr r.name dns.overrides)) records
@@ -72,6 +88,8 @@ in
++ map (n: "${n} allow") dnsPeerNets;
local-zone =
lib.optional (domain != null) "${domain}. static"
# The router's bare name is a zone of its own (not under the domain).
++ lib.optional (!lib.hasInfix "." selfName) "${selfName}. transparent"
++ map (n: "${n}. redirect") (lib.attrNames dns.overrides);
local-data = localData;
local-data-ptr = ptrs;