From 0a7d8d99c05d928864d86e577183d72df51bf951 Mon Sep 17 00:00:00 2001 From: faumaray Date: Tue, 27 Oct 2026 17:39:27 +0300 Subject: [PATCH] windows: the AmneziaWG tunnel in the release, checked under Wine package.sh builds the amneziawg component (awg-tunnel.exe, Wintun); the setup test adds a system-wide profile and checks its tunnel service registered (Wine's sc has no qc: its registry key), started (the tunnel runs as a service up to Wintun, which Wine lacks; its log read back), and removed with its profile. README and notes say so. Co-Authored-By: Claude Opus 5.5 --- windows/README.md | 10 +- windows/release-notes/0.2.0-pre.1.md | 4 +- windows/tools/build-zapret2-extras.sh | 195 ++++++++++++++++++++++++++ windows/tools/wine-setup-test.sh | 7 +- 4 files changed, 210 insertions(+), 6 deletions(-) create mode 100755 windows/tools/build-zapret2-extras.sh diff --git a/windows/README.md b/windows/README.md index fa56cd0..d81a6c4 100644 --- a/windows/README.md +++ b/windows/README.md @@ -24,7 +24,7 @@ tray icon) or with `proxy-ctl`, as upstream's is. | zapret2 | `winws2.exe` from bol-van's [zapret-win-bundle](https://github.com/bol-van/zapret-win-bundle) with [nfqws2-keenetic](https://github.com/nfqws/nfqws2-keenetic)'s strategies and nfqws2's own learning of blocked sites | | tg-ws-proxy | Flowseal's [tg-ws-proxy](https://github.com/Flowseal/tg-ws-proxy), the headless proxy, on a bundled Python | | Tor | `tor`: the Tor Project's own Windows build (the Expert Bundle, signed, pinned), with bridges (obfs4, webtunnel, snowflake, meek, conjure) and, with `asOutbound`, an outbound of the proxy | -| AmneziaWG | `amneziaWg` profiles as outbounds, from a `.conf`, an AmneziaVPN `vpn://` link or settings: `"userspace"` (wireproxy-awg, built from upstream's source, AmneziaWG's obfuscation kept, no driver) or `"singBox"` (plain WireGuard). WARP devices take either kind too | +| AmneziaWG | `amneziaWg` profiles, from a `.conf`, an AmneziaVPN `vpn://` link or settings. Without `asOutbound`, a **system-wide VPN**: amneziawg-windows's tunnel (amneziawg-go on Wintun, built from its source) as a Windows service of its own, with its routes, DNS and, for one peer that takes everything, its firewall blocking what leaves outside the tunnel; on and off in the app or `proxy-ctl awg on|off`. As outbounds: `"userspace"` (wireproxy-awg, built from upstream's source, AmneziaWG's obfuscation kept, no driver) or `"singBox"` (plain WireGuard). WARP devices take either kind too | | WARP | `warp` with `asOutbound = "singBox"` or `"userspace"`: each device registered with Cloudflare as wgcf registers (through the local proxy first, then directly, then `generatorUrl`), or a profile given; a sing-box WireGuard endpoint, several grouped as `warp` | | autoProxy | `proxy.autoProxy`: the sites apps reach directly are probed through each exit in turn (direct first); one blocked directly but reached through an exit is routed through it, as upstream's prober decides (block pages, one exit per network first, strikes against exits that refuse). Blocks zapret can fix stay direct. A site that crawls directly (`slowBelowKiBps`) moves to the first exit that carries it as well as direct does. Its page in the app, or `proxy-ctl proxy auto`, shows, probes, learns and forgets | | whitelist-bypass | `whitelistBypass`: [whitelist-bypass](https://github.com/kulikov0/whitelist-bypass)'s headless creators and joiners (WB Stream, Telemost, DION, Bitrix; VK creators), built from upstream's source: a joiner is an outbound of the proxy tunnelled through a video call, a creator the call's free end. `proxy-ctl wl` gives the links and logins | @@ -32,7 +32,7 @@ tray icon) or with `proxy-ctl`, as upstream's is. | TUN | sing-box's TUN (wintun), `proxy-ctl proxy tun on` — **see the caveats** | | The app | **Proxy Suite** in the Start Menu, and a tray icon from sign-in: the proxy, DPI bypass and Telegram proxy at a glance and a click; outbounds, subscriptions and the routing mode; zapret's presets and sites; tg-ws-proxy's links; whitelist-bypass's joiners and creators (links, logins); autoProxy's routes, probes and exits; the logs; **every option** in its JSON editor, checked by the service before it takes it; the system proxy | -Not in this release, still to come: AmneziaWG as a system-wide VPN (its driver), Tor's onion service, +Not in this release, still to come: Tor's onion service, the kill switch, server inbounds, the XRay-only backend, zapret2's extended detection and z2k strategies. Their options are accepted (they are upstream's), but the service says, in its status and in the app, that it does not run them yet. @@ -55,6 +55,7 @@ Needs 64-bit Windows 10 (1903 or later) or 11. | AmneziaWG | profiles from `.conf`, `vpn://` links and settings converted exactly as upstream's script converts them (its own encoder's links as test vectors); end to end on Linux: sing-box as a WireGuard server, the service running wireproxy-awg, a page through its listener and through the proxy's outbound (`an_amneziawg_tunnel`) | | autoProxy | its judgement (upstream's verdicts, walk, exit order, strikes, state) by unit tests; the config with its probe listeners and learned rule-sets accepted by `sing-box check`; on Linux with a local exit: probes through direct and the exit, a learn request, a site an app reached directly queued from the Clash API and probed at the next run, the state and the rule-set files written; a download held to 40 KiB/s seen crawling and moved to the exit. A site blocked here and reached through an exit needs a remote exit, so none was routed that way | | whitelist-bypass | its Windows programs built from upstream's tag with upstream's patches (links and passwords from the environment, never the command line); on Linux the service runs a joiner and a creator with their flags, the link and the login reaching them (`proxy-ctl wl join`, `wl auth`, `wl new`, `wl link`); a real call needs an account on a platform, so none was made | +| AmneziaWG system-wide | under Wine's service manager (`tools/wine-setup-test.sh`): a profile added registers its tunnel service (program, configuration, dependencies), `proxy-ctl awg on` starts it, and the tunnel runs as a service up to creating the Wintun adapter, which Wine cannot; its log is read back; the service goes with its profile. Traffic through it needs real Windows | | WARP | a device registered live with Cloudflare by the service, its profile rendered as a sing-box endpoint and accepted; traffic through it not (this test machine blocks outgoing UDP) | | zapret's hostlist rules | every preset with sample rules, checked by `winws.exe --dry-run` (a preset without the profile a rule copies is refused, as upstream refuses it) | | The app | every page against the service running on Linux, in a window on a virtual display (Xvfb, Mesa's software Vulkan), clicked and typed into by a script, screenshots looked at, and the service's configuration checked after each change (`tools/gui-shot.sh`) | @@ -134,6 +135,11 @@ proxy-ctl proxy pin wl proxy-ctl wl auth laptop cookies.json proxy-ctl wl link laptop +# AmneziaWG as a system-wide VPN (a profile without asOutbound): +proxy-ctl awg # profiles and their state +proxy-ctl awg on home # start it; off stops it +proxy-ctl awg log home # its tunnel's log + # autoProxy (set "proxy": { "autoProxy": { "enable": true } }): proxy-ctl proxy auto # what it routed, and where proxy-ctl proxy auto probe example.com # how a site answers through each exit diff --git a/windows/release-notes/0.2.0-pre.1.md b/windows/release-notes/0.2.0-pre.1.md index d49682f..f3b6fef 100644 --- a/windows/release-notes/0.2.0-pre.1.md +++ b/windows/release-notes/0.2.0-pre.1.md @@ -6,6 +6,7 @@ The desktop app: Proxy Suite now has a window and a tray icon, besides `proxy-ct - **Overview:** the local proxy, the DPI bypass and the Telegram proxy, their states and switches; what the service warns of. - **DPI bypass:** zapret with Flowseal's presets (the preset, game traffic) or zapret2 (learning, IPv6); your own sites to handle or leave alone. - **Telegram proxy:** on or off, its tg:// links to open in Telegram or copy to a phone, other devices allowed or not, port and fake-TLS domain. +- **AmneziaWG:** profiles (system-wide or outbounds), a system-wide one switched on and off with its tunnel's log, one added from a `vpn://` link or a `.conf`, or removed. - **autoProxy:** on or off; probe a site through each exit, or learn it now; the sites it routed (forget each, or all); the exits, bad ones marked; what it never touches and how slow is slow. - **Whitelist bypass:** joiners and creators, added or removed; a joiner's call link given, a creator's call link copied, its login given (a cookies file, or DION's and Bitrix's email and password). - **Outbounds:** add one from a link; pin, test delays, leave out, remove; the routing mode; subscriptions. @@ -22,6 +23,7 @@ The desktop app: Proxy Suite now has a window and a tray icon, besides `proxy-ct - zapret's `hostlistRules`: a group of sites with its own strategy, copied from a preset (or another one, `configName`) or given as `nfqwsArgs`, ahead of the preset's own; every preset with them checked by Flowseal's `winws.exe`. - The SSH tunnel (`sshProxy`): Windows' own OpenSSH as a SOCKS listener for other programs, and, with `asOutbound`, an outbound of the proxy. Needs Windows' "OpenSSH Client" (there by default since Windows 10 1809). - Tor (`tor`): the Tor Project's own Windows build, with bridges (obfs4, webtunnel, snowflake, meek, conjure) and, with `asOutbound`, an outbound of the proxy. +- AmneziaWG as a system-wide VPN: a profile without `asOutbound` is a tunnel of its own (amneziawg-windows's, built from its source, on Wintun), its routes, DNS and kill switch for a full tunnel; switched on and off on the app's AmneziaWG page or with `proxy-ctl awg on|off`, started at boot with `autostart`. - AmneziaWG as outbounds (`amneziaWg`): profiles from a `.conf`, an AmneziaVPN `vpn://` link or settings; `"userspace"` runs wireproxy-awg (AmneziaWG's obfuscation kept, no driver), `"singBox"` plain WireGuard. WARP devices can be either. - autoProxy (`proxy.autoProxy`): sites apps reach directly are probed through each exit; one blocked directly but reached through an exit is routed through it, as upstream decides. A site that crawls directly moves to an exit that carries it as well (`slowBelowKiBps`). In the app, or `proxy-ctl proxy auto` (list, probe, learn, forget, clear). - whitelist-bypass (`whitelistBypass`): its creators and joiners, built from upstream's source; a joiner is an outbound of the proxy through a video call (WB Stream, Telemost, DION, Bitrix), a creator the call's other end. `proxy-ctl wl join|auth|link|new`. @@ -38,7 +40,7 @@ Download `ProxySuite-0.2.0-pre.1-windows-x64-setup.exe` and run it (its SHA-256 The zip is still there, the same files with `install.cmd`. ### Not yet -AmneziaWG as a system-wide VPN, Tor's onion service, the kill switch, server inbounds, the XRay-only backend, zapret2's extended detection and the z2k strategies. +Tor's onion service, the kill switch, server inbounds, the XRay-only backend, zapret2's extended detection and the z2k strategies. ### Note Unlike upstream, the signed-in user may change every setting by default (`userControl`), except the ones that could run programs or read files as SYSTEM: those always need an administrator. On a shared computer, restrict `userControl.scopes`. diff --git a/windows/tools/build-zapret2-extras.sh b/windows/tools/build-zapret2-extras.sh new file mode 100755 index 0000000..55e9ee9 --- /dev/null +++ b/windows/tools/build-zapret2-extras.sh @@ -0,0 +1,195 @@ +#!/usr/bin/env bash +# zapret2's layers beyond the strategies, as upstream's runtime.nix loads them into nfqws2 +# (winws2 here: the same engine, the same Lua): z2k's Lua (a site's working strategy kept +# across restarts, and its own detectors) and its lists and fake payloads; proxy-suite's own +# Lua (the extended detector, the per-site key by public suffix, the fail stamp, the +# strategy log); and z2k's strategies, made by z2k's own generator, as upstream's +# z2k-profiles.template.sh runs it at build time. +# +# What upstream fills in from the configuration at build time is left as a token here and +# filled in by the service (ps_core::zapret2): @HSUF@ and @ESUF@ (the user's sites and +# exclusions), @AUTO@ @EXCLUDE@ @FAILS@ @TIME@ @INSEQ@ @RETRANS@ @LEARNEXTRA@ (the +# learner's arguments), @STALLWATCH@; and the paths, @Z2K@ (z2k's files) and @ROOT@ (the +# tree its generator wrote), which winws2 reads where the component is installed. +# +# tools/build-zapret2-extras.sh OUT_DIR (needs git, bash, gawk, python3, nix) +set -euo pipefail +. "$(dirname "$0")/lib.sh" +OUT=$(realpath -m "${1:?output directory}") +HERE=$(realpath "$(dirname "$0")") +UPSTREAM=$(realpath "$HERE/../../modules/proxy-suite/zapret2") +Z2K_COMMIT=7beb9754d65a2cafd9c1d26d382bcb61d453d5b3 +WORK=$(mktemp -d) +trap 'rm -rf "$WORK"' EXIT + +clone_commit https://github.com/necronicle/z2k "$Z2K_COMMIT" "$WORK/z2k" +Z=$WORK/z2k +rm -rf "$OUT" && mkdir -p "$OUT/z2k/files" "$OUT/lua" + +# --- z2k's files the strategies and Lua read -------------------------------------------- +cp -r "$Z/files/lua" "$Z/files/lists" "$OUT/z2k/files/" +[ -d "$Z/files/fake" ] && cp -r "$Z/files/fake" "$OUT/z2k/files/" +cp "$Z/LICENSE" "$OUT/z2k/LICENSE" +# Its QUIC silence detector, as upstream's sources.nix patches it: rkn_quic's flows too, and +# a flow answered past udp_in replies only. +q=$OUT/z2k/files/lua/z2k-quic-silence.lua +grep -qF 'local Z2K_QUIC_POOLS = { yt_quic = true, gv_quic = true }' "$q" || { echo "z2k-quic-silence.lua changed"; exit 1; } +sed -i 's/local Z2K_QUIC_POOLS = { yt_quic = true, gv_quic = true }/local Z2K_QUIC_POOLS = { yt_quic = true, gv_quic = true, rkn_quic = true }/' "$q" +python3 -I - "$q" <<'PY' +import sys +p = sys.argv[1] +s = open(p).read() +old = " if not desync.outgoing then\n crec.z2k_quic_answered = true\n" +new = " if not desync.outgoing then\n if (pos_get(desync, 'n') or 0) > (tonumber(desync.arg.udp_in) or 1) then crec.z2k_quic_answered = true end\n" +if old not in s: + sys.exit("z2k-quic-silence.lua: the answer check changed") +open(p, "w").write(s.replace(old, new)) +PY + +# --- proxy-suite's own Lua -------------------------------------------------------------- +cp "$UPSTREAM/detect.lua" "$UPSTREAM/persist-every.lua" "$UPSTREAM/strategy-log.lua" "$OUT/lua/" +# The suffix list's path from the environment: it is where the component is installed. +grep -q '"@suffixes@"' "$UPSTREAM/public-suffix-hostkey.lua" || { echo "public-suffix-hostkey.lua changed"; exit 1; } +sed 's|"@suffixes@"|os.getenv("PROXY_SUITE_PUBLIC_SUFFIXES")|' "$UPSTREAM/public-suffix-hostkey.lua" >"$OUT/lua/public-suffix-hostkey.lua" +cat >"$OUT/lua/fail-stamp.lua" <<'LUA' +-- The state layer undoes a rotation when the host succeeded within 30 s, unless a failure +-- came later; only z2k's own detector stamps that failure. Without the stamp any success on +-- a busy host (all of googlevideo.com) undoes every rotation. (upstream's runtime.nix) +local count = automate_failure_counter +function automate_failure_counter(hrec, crec, fails, maxtime) + if not (crec and crec.failure) then + hrec.z2k_last_fail_ts = type(clock_getfloattime) == "function" and clock_getfloattime() or os.time() + end + return count(hrec, crec, fails, maxtime) +end +LUA +psl=$(nix build --no-link --print-out-paths --inputs-from "$HERE/.." nixpkgs#publicsuffix-list | head -1) +python3 -I "$UPSTREAM/public-suffixes.py" "$psl/share/publicsuffix/public_suffix_list.dat" >"$OUT/public_suffixes.txt" + +# --- z2k's strategies, by its generator --------------------------------------------------- +root=$WORK/root +mkdir -p "$root/lists" "$root/lua" "$WORK/conf" +cp -r "$Z/files/lists/extra_strats" "$root/" +chmod -R u+w "$root" +cp "$root/extra_strats/TCP/RKN/Discord.txt" "$root/extra_strats/TCP_Discord.txt" +cp "$Z/files/lists/cf_extra_check_ips.txt" "$root/lists/" +: >"$root/lists/discovered-domains.txt" +mkdir -p "$root/state" +echo 1 >"$root/state/tcp16.flag" +ln -s "$Z"/files/lua/*.lua "$root/lua/" +( + export ZAPRET2_DIR="$root" CONFIG_DIR="$WORK/conf" LISTS_DIR="$root/lists" + cd "$Z" + bash -c ' + . lib/utils.sh && . lib/config.sh && . lib/strategies.sh && . lib/config_official.sh || exit 1 + print_info() { echo "$*" >&2; } + print_success() { echo "$*" >&2; } + print_warning() { echo "$*" >&2; } + print_error() { echo "$*" >&2; } + create_base_config >&2 && + generate_strategies_conf strats_new2.txt "$STRATEGIES_CONF" >&2 && + generate_quic_strategies_conf quic_strats.ini "$QUIC_STRATEGIES_CONF" >&2 && + create_default_strategy_files >&2 && + generate_nfqws2_opt_from_strategies + ' +) >"$WORK/generated" 2>"$WORK/generator.log" || { tail -20 "$WORK/generator.log"; exit 1; } +sed -n '/^NFQWS2_OPT="/,/^"$/p' "$WORK/generated" | sed '1s/^NFQWS2_OPT="//; $d' | tr '\n' ' ' >"$WORK/raw" +grep -q -- '--lua-desync=circular' "$WORK/raw" || { echo "z2k generator produced no profiles"; exit 1; } + +# As upstream's z2k-profiles.template.sh: its learned-host list becomes ours, its whitelist +# takes our exclusions, circular's pinned detector args go (autoHostlist fills them), and +# learning is a last profile of its own; with the extended detector, ps_learn's. +profiles() { + local learn=$1 watch=$2 + awk -v disc="--hostlist=$root/lists/discovered-domains.txt" \ + -v wl="--hostlist-exclude=$root/lists/whitelist.txt" \ + -v yt="--hostlist-exclude=$root/extra_strats/TCP/YT/List.txt --hostlist-exclude=$root/extra_strats/TCP/YT_GV/List.txt" \ + -v hsuf=" @HSUF@" -v esuf=" @ESUF@" \ + -v learn="$learn" -v wlfile="$root/lists/whitelist.txt" -v watch="$watch" ' + { + for (i = 1; i <= NF; i++) { + t = $i + if (t == "--new") { + prof++ + } else if (t ~ /^--filter-tcp=/ && !(prof in ports)) { + ports[prof] = substr(t, 14) + } + pre = "" + if (t ~ /^--(in-range|out-range|payload|lua-desync)=/) { + if (watch != "" && seen && prof == learner && !watched++) pre = watch " " + filtered[prof] = 1 + } + if (t == disc) { + t = "" hsuf + if (!seen++) { + t = t " " yt + learner = prof + if (prof in filtered) { print "z2k general TLS profile: hostlist after its instances" > "/dev/stderr"; exit 1 } + } + } else if (t == wl) { + t = t esuf + } else if (t ~ /^--lua-desync=circular:/) { + n = split(substr(t, 23), p, ":") + t = "--lua-desync=circular" + for (j = 1; j <= n; j++) + if (p[j] !~ /^(retrans|maxseq|inseq)=/ && p[j] != "reset") t = t ":" p[j] + } + printf "%s%s%s", (i > 1 ? " " : ""), pre, t + } + } + END { + if (!seen || !(learner in ports)) { print "z2k general TLS profile not found" > "/dev/stderr"; exit 1 } + if (watch != "" && !watched) { print "z2k general TLS profile has no instances" > "/dev/stderr"; exit 1 } + if (learn == "") + printf " --new --filter-tcp=%s --filter-l7=tls %s%s %s", ports[learner], wl, esuf, hsuf + else { + sub(/:exclude=/, ":exclude=" wlfile ",", learn) + printf " --new --filter-tcp=%s --filter-l7=tls --in-range=-s65536 --out-range=-s32768 --payload=all --lua-desync=ps_learn:%s", ports[learner], learn + } + }' "$WORK/raw" >"$WORK/body" + # rkn_quic: z2k's YouTube QUIC profile over the sites rkn_tcp handles, right after it. + awk -v yt="--hostlist=$root/extra_strats/UDP/YT/List.txt" \ + -v rkn="--hostlist=$root/extra_strats/TCP/RKN/List.txt --hostlist=$root/extra_strats/TCP_Discord.txt @HSUF@" ' + { + n = split($0, p, / --new /) + for (i = 1; i <= n; i++) { + printf "%s%s", (i > 1 ? " --new " : ""), p[i] + if (p[i] ~ /key=yt_quic:/ && (k = index(p[i], yt))) { + q = substr(p[i], 1, k - 1) rkn substr(p[i], k + length(yt)) + gsub(/key=yt_quic:/, "key=rkn_quic:", q) + if (!sub(/:udp_in=1:/, ":udp_in=4:", q)) { print "z2k YouTube QUIC udp_in=1 not found" > "/dev/stderr"; exit 1 } + printf " --new %s", q + found++ + } + } + } + END { if (found != 1) { print "z2k YouTube QUIC profile not found" > "/dev/stderr"; exit 1 } }' "$WORK/body" +} +profiles "" "" >"$WORK/profiles.plain" +profiles "auto=@AUTO@:exclude=@EXCLUDE@:fails=@FAILS@:time=@TIME@:inseq=@INSEQ@:retrans=@RETRANS@:win=32@LEARNEXTRA@" "@STALLWATCH@" >"$WORK/profiles.learn" +awk -v z="$Z" ' + match($0, /^([A-Z0-9_]+_BLOB)="\$ZAPRET_BASE\/([^"]+)"/, m) { file[m[1]] = m[2] } + match($0, /--blob=([a-z0-9_]+):@\$([A-Z0-9_]+_BLOB)/, m) { printf "--blob=%s:@%s/%s ", m[1], z, file[m[2]] } +' "$Z/files/S99zapret2.new" >"$WORK/blobs" +grep -q -- '--blob=' "$WORK/blobs" || { echo "z2k blob registrations not found"; exit 1; } + +# The paths as tokens; the tree the generator wrote, shipped. +for f in profiles.plain profiles.learn blobs; do + sed -e "s|$root|@ROOT@|g" -e "s|$Z|@Z2K@|g" "$WORK/$f" >"$OUT/z2k/$f" + if grep -q "$WORK" "$OUT/z2k/$f"; then echo "$f still names the build's directory"; exit 1; fi +done +# The blobs it names, from z2k's tree, wherever they are in it. +for b in $(grep -o '@Z2K@/[^ ]*' "$OUT/z2k/blobs" | sed 's|@Z2K@/||'); do + mkdir -p "$OUT/z2k/$(dirname "$b")" && cp "$Z/$b" "$OUT/z2k/$b" +done +cp -rL "$root" "$OUT/z2k/root" +rm -rf "$OUT/z2k/root/lua" +# Its ports, from its generator's configuration. +gen=$(cat "$Z/lib/config_official.sh") +for name in NFQWS2_PORTS_TCP NFQWS2_PORTS_UDP; do + printf '%s=%s\n' "$name" "$(sed -n "s/^$name=\"\\(.*\\)\"/\\1/p" "$Z/lib/config_official.sh" | head -1)" +done >"$OUT/z2k/ports" +grep -q '^NFQWS2_PORTS_TCP=.\+' "$OUT/z2k/ports" || { echo "z2k's ports not found"; exit 1; } +echo "$Z2K_COMMIT" >"$OUT/z2k/.commit" +echo "2026.10.27+z2k.${Z2K_COMMIT:0:7}" >"$OUT/.version" +echo "zapret2-extras $(cat "$OUT/.version") in $OUT" diff --git a/windows/tools/wine-setup-test.sh b/windows/tools/wine-setup-test.sh index ac886a0..fe01e66 100755 --- a/windows/tools/wine-setup-test.sh +++ b/windows/tools/wine-setup-test.sh @@ -69,9 +69,10 @@ CONF='[Interface]\nPrivateKey = yAnz5TF+lXXJte14tji3zlMNq+hd2rYUIgJBgB3fBmk=\nAd 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') +# Wine's sc has no qc: the service's registry key says the same. +qc=$(wine reg query 'HKLM\System\CurrentControlSet\Services\AmneziaWGTunnel$home' 2>/dev/null | tr -d '\r' || true) 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/^ */ /' +grep -iE 'ImagePath|ServiceSidType|DependOnService' <<<"$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 @@ -80,7 +81,7 @@ wine "$PF/proxy-ctl.exe" awg log home -n 5 2>&1 | tr -d '\r' | sed 's/^/ log: / 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" +wine reg query 'HKLM\System\CurrentControlSet\Services\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"