From 31f2008153dfaf22537b6240d52f49a5b80b1cdd Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 28 Mar 2026 12:16:00 +0000 Subject: [PATCH] Wire WireGuard peer DNS to ControlD profiles via ctrld MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When creating a WireGuard peer on OPNsense: - Client config DNS now points to OPNsense's IP (not tunnel gateway) so DNS flows: client → OPNsense → Unbound → ctrld → ControlD - New dns_profile field: select which ControlD profile applies to VPN clients (default: "house" for VLAN 99) - Generates ctrld.toml instructions for WireGuard tunnel subnet routing — tells user what to add so ctrld routes VPN DNS queries to the correct ControlD profile - QR modal now shows ControlD setup instructions alongside the WireGuard config This solves the Android Private DNS conflict: WireGuard's DNS setting overrides Android's Private DNS, pointing to OPNsense which runs Unbound → ctrld. No Private DNS toggle needed on the phone. Multi-VLAN access for VPN peers works because the peer is on the WireGuard interface (not on any VLAN). OPNsense routes between the tunnel and VLANs per firewall rules. VLAN isolation preserved. https://claude.ai/code/session_01Do9bsN39MTuy2GVv7yzSrE --- ers5952-manager.jsx | 36 ++++++++++++++++++++++++++++++++---- switch_backend.py | 43 ++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 72 insertions(+), 7 deletions(-) diff --git a/ers5952-manager.jsx b/ers5952-manager.jsx index e550435..977f648 100644 --- a/ers5952-manager.jsx +++ b/ers5952-manager.jsx @@ -1913,7 +1913,7 @@ function DeviceAccessTab({ session, onNeedAuth, backendOk }) { // WIREGUARD TAB // ══════════════════════════════════════════════════════════════════════════════ -function QRModal({ config, name, onClose }) { +function QRModal({ config, name, ctrldNote, onClose }) { // Render QR using a simple API since we can't use native qrencode in browser const [qrUrl, setQrUrl] = useState(''); useEffect(() => { @@ -1936,6 +1936,14 @@ function QRModal({ config, name, onClose }) { maxHeight:120,overflowY:"auto",marginBottom:12}}> {config} + {ctrldNote && ( +
+
ControlD DNS Setup
+ {ctrldNote} +
+ )}
); } @@ -2533,6 +2547,7 @@ function WireGuardTab({ session, onNeedAuth, backendOk, vlans = [] }) { function OPNsenseWGSection({ opnWg, opnLoading, opnError, opnSetup, setOpnSetup, opnPeerName, setOpnPeerName, opnVlans, opnAdding, + opnDnsProfile, setOpnDnsProfile, session, onNeedAuth, vlans, onToggleVlan, onSetupServer, onDeleteServer, onAddPeer, onRevokePeer, onShowConf, onRefresh, @@ -2779,6 +2794,19 @@ function OPNsenseWGSection({ +
+
+ + setOpnDnsProfile(e.target.value)} + placeholder="house"/> +
+
+ VPN clients use OPNsense DNS → Unbound → ctrld → ControlD. + This profile applies to the WireGuard tunnel subnet. +
+
+
{!session && (