windows: AmneziaWG as a system-wide VPN
Each profile without asOutbound is a tunnel service of its own, AmneziaWGTunnel$<interface>, as amneziawg-windows's client installs one: amneziawg-go on Wintun, its routes and DNS, and for one peer that takes everything its firewall blocking what would leave outside the tunnel. It runs awg-tunnel.exe, amneziawg-windows built from its pinned commit with a main of ours (its Run(), its log in a file) instead of its tunnel.dll, beside Wintun's signed DLL (tools/build-amneziawg.sh). The service writes each profile's .conf below its state root, registers the tunnel (unrestricted service SID, which its firewall exempts it by), starts the autostart ones with itself, and removes the tunnels of profiles gone, and all of them on uninstall. proxy-ctl awg list|on|off|log, and the app's AmneziaWG page: profiles (a system-wide one switched on and off, its log), one added from a vpn:// link or a .conf, or removed. tools/lib.sh: clone_commit, and fetch_pinned, which fetches in pieces a download that stalls (some networks cut TLS after about 16 KB, as wintun.net's here). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
95ec15e14a
commit
5cf3a237e6
30 files changed
+916
-12
No files matched your search
@@ -64,6 +64,25 @@ running || fail "the service is $(state)"
|
||||
for _ in $(seq 30); do wine "$PF/proxy-ctl.exe" status >/dev/null 2>&1 && break; sleep 1; done
|
||||
wine "$PF/proxy-ctl.exe" components | tr -d '\r' | sed 's/^/ /' || fail "no answer over the pipe"
|
||||
|
||||
echo "== an AmneziaWG system-wide profile: its tunnel service registered, then removed"
|
||||
CONF='[Interface]\nPrivateKey = yAnz5TF+lXXJte14tji3zlMNq+hd2rYUIgJBgB3fBmk=\nAddress = 10.8.0.2/32\nDNS = 1.1.1.1\n\n[Peer]\nPublicKey = bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=\nAllowedIPs = 0.0.0.0/0, ::/0\nEndpoint = 203.0.113.7:51820\n'
|
||||
printf '{ "amneziaWg": { "enable": true, "profiles": { "home": { "config": "%s" } } } }' "$CONF" >"$WORK/awg.json"
|
||||
wine "$PF/proxy-ctl.exe" config set "Z:$WORK/awg.json" | tr -d '\r' | sed 's/^/ /'
|
||||
sleep 3
|
||||
qc=$(wine sc qc 'AmneziaWGTunnel$home' 2>/dev/null | tr -d '\r')
|
||||
grep -q 'awg-tunnel.exe' <<<"$qc" || fail "no tunnel service registered: $(wine "$PF/proxy-ctl.exe" logs proxy-suite-awg-vpn -n 20 | tr -d '\r')"
|
||||
grep -i 'BINARY_PATH_NAME' <<<"$qc" | sed 's/^ */ /'
|
||||
wine "$PF/proxy-ctl.exe" awg | tr -d '\r' | sed 's/^/ /'
|
||||
# Wine has no Wintun driver: the tunnel itself cannot come up here, only be asked to.
|
||||
wine "$PF/proxy-ctl.exe" awg on home 2>&1 | tr -d '\r' | sed 's/^/ on: /' || true
|
||||
sleep 3
|
||||
wine "$PF/proxy-ctl.exe" awg log home -n 5 2>&1 | tr -d '\r' | sed 's/^/ log: /' || true
|
||||
printf '{}' >"$WORK/none.json"
|
||||
wine "$PF/proxy-ctl.exe" config set "Z:$WORK/none.json" >/dev/null
|
||||
sleep 3
|
||||
wine sc query 'AmneziaWGTunnel$home' >/dev/null 2>&1 && fail "the tunnel service outlived its profile"
|
||||
echo " registered, and removed with its profile"
|
||||
|
||||
echo "== setup /S again, over the running install"
|
||||
wine "$SETUP" /S && rc=0 || rc=$?
|
||||
[ "$rc" = 0 ] || fail "the upgrade exited with $rc"
|
||||
|
||||
Reference in new issue
Block a user