Apply regenerates WARP wgcf profile without Table=off/DNS protections → wg-quick fails (no resolvconf) or hijacks all routing → public lockout #5569
Description
Activity
Hit this on 13.0.3 (upgraded from 12.3.x, Ubuntu 22.04, no
resolvconf): after an apply,wg-quick@warpfailed withresolvconf: command not foundand the regenerated profile hadDNS = ...uncommented and noTable = off.I think I found why the protections get lost. It's the
sed -icalls running on a symlink thatensure_warp_data_linksthen throws away.services/warp/utils.sh,generate_warp_wireguard_config():(cd "$svc_dir" && ./wgcf generate >/dev/null 2>&1) sed -i 's/\[Peer\]/Table = off\n\[Peer\]/g' "$svc_dir/wgcf-profile.conf" ... sed -i '/DNS = 1.1.1.1/s/^/# /' "$svc_dir/wgcf-profile.conf" mkdir -p /etc/wireguard/ ensure_warp_data_links wireguard "$svc_dir" ln -sf "$svc_dir/wgcf-profile.conf" /etc/wireguard/warp.conf
On an already-migrated install,
$svc_dir/wgcf-profile.confis a symlink todata/services/warp/wireguard/wgcf-profile.conf(created by an earlierensure_warp_data_links). Step by step:wgcf generatewrites through the symlink, so the data/ copy gets the fresh, unprotected profile.- GNU
sed -idoesn't follow symlinks by default. It writes its output to a new regular file at the link path. The symlink is replaced by a patched regular file, and the data/ copy stays unpatched. Quick check on the same box (GNU sed 4.8):$ echo orig > target; ln -s target link; sed -i s/orig/patched/ link $ cat target -> orig $ cat link -> patched (link is now a regular file) ensure_warp_data_linkssees that$svc_dir/wgcf-profile.confis a regular file while the data/ copy already exists, so it takes therm -f "$src"branch and re-links to data/. The patched file is deleted./etc/wireguard/warp.conf->$svc_dir/wgcf-profile.conf-> data/ copy = the profile withoutTable = offand withDNS =. That gives both failure modes described above:resolvconfmissing, or wg-quick installing its policy routing for0.0.0.0/0.
Every apply goes through
check_warp_wireguard_connection->generate_warp_wireguard_config, so this comes back on every apply, not only once after the upgrade.Suggested fix (any of these):
sed -i --follow-symlinks ..., or- resolve the target first:
local profile; profile="$(readlink -f "$svc_dir/wgcf-profile.conf")"and run all the seds on$profile, or - call
ensure_warp_data_linksright afterwgcf generateand edit the data/ path directly.
Manual workaround until then: on
readlink -f /etc/wireguard/warp.conf, addTable = offbefore[Peer], comment outDNS =, thensystemctl restart wg-quick@warp. Check withcurl --interface warp https://www.cloudflare.com/cdn-cgi/trace(should showwarp=on).
Environment
resolvconfinstalled), WARP via kernelwg-quick@warpWhat happened
During config re-apply, the WARP pass regenerated
services/warp/wireguard/wgcf-profile.confwithout the protections thatgenerate_warp_wireguard_config()normally applies (sed Table = off+ commentDNS =). Two failure modes followed:wg-quick@warpfails to start:resolvconf: command not found→ warp interface deleted → hiddify-core/xray WARP egress dead (route ip+net: no such network interface).AllowedIPs = 0.0.0.0/0, noTable), wg-quick installs its default policy rules (not fwmark 0xca6c lookup 51820), which route all server egress — including replies to new inbound connections — into the tunnel. Result: public SSH/panel/probe all blackholed from the internet while already-established flows keep working; only VCN-private-IP access survives. We were locked out and had to rescue via a sibling instance inside the VCN.Workaround applied
This keeps the interface (hiddify-core uses
bind_interface) without hijacking global routing.Also observed during the same upgrade
hiddify-core.servicecrash-looped 625 times at upgrade time (listen tcp 127.0.0.1:2000: bind: address already in use— stale instance holding the port during the restart race), self-healing only after ~1 hour.Suggested fix
Table = off+ DNS protections (or makeresolvconfan explicit dependency and default the template to a safe Table).hiddify-corerestarts against the port-2000 race.Thanks!