change: read connection state from OpenVPN's management interface #68
Loading…
Reference in a new issue
No description provided.
Delete branch "change/management-interface"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
ovpn()tracked connection state by string-matching OpenVPN's stdout. Three of those strings (TUN/TAP device,PUSH: Received control message, and the classic device line) print zero times under DCO, the default data path since OpenVPN 2.6 — the root cause behind the device-detection and DNS failures. Issue #22.Fix
aqomui/mgmt.py: a minimal client for OpenVPN's management interface over a unix socket (one per tunnel role:mgmt.sock,mgmt_hop.sock,mgmt_bypass.sockin ROOTDIR,--management-client-user root). It translates>STATE:/>PASSWORD:Verification Failed/>FATAL:notifications into four event kinds; everything else is noise.ovpn()starts each OpenVPN with the management socket and a reader thread; CONNECTED / RECONNECTING(reason) / auth-failed / fatal replace theInitialization Sequence Completed/Restart pause/SIGTERM[soft,auth-failure]/Exiting due to fatal errorgreps. The reader is fully guarded — a management failure becomesconn_attempt_failed, never an escaped exception in the root service.dns-updownhook applies server-pushed DNS — includingdefault-route true+~.routing, verified in the shipped script — on resolved systems. aqomui passes--dns-updown disablewhenever it owns DNS itself: alt servers configured, DNS off, hop/bypass tunnels, or no resolved. At CONNECTED the applied servers are read back (dns_manager.link_dns) for the GUI display; a server that pushed nothing falls back to the alt servers as before.Scope kept out, per the issue: credentials stay in
auth-user-passfiles (>PASSWORD:Verification Failedreaches the socket without--management-query-passwords); double-hop orchestration and the stunnel/SSH side channels untouched.Behavior deltas worth knowing:
dns_offnow actually means off under 2.7 — previously OpenVPN's default-enabled dns-updown set tun DNS regardless.dns_hopattributes that never existed under DCO and would have crashed the thread).ping-restart,tls-error, ...) instead of the bare 'Connection attempt failed'.Verification
test_mgmt.py(protocol parsing; a scripted unix-socket server standing in for OpenVPN, including late-socket timeout and EOF-on-exit) andTestManagementEvents/TestDnsUpdownDisabledintest_tunnel.py(every event kind → dispatchable GUI status, hop skips DNS, pushed-DNS read-back vs alt fallback, broken channel → failed attempt).resolvectl status tun_aqomuishows the provider-pushed DNS with~.(not Quad9, unless alt DNS is enabled in settings); disconnect/reconnect; wrong-password auth failure notifies; bypass still comes up.🤖 Generated with Claude Code
f1eec9ec34703c4c2149703c4c2149564956185556495618555ab32b8a8b