Repository navigation
TUN inbound's autoSystemWfpBlockLeak: Support "tcp/port" and "udp/port"; "dns" covers "tcp/853" and "udp/853" as well - #7288
Conversation
…Leak` on Windows; "dns" covers DoT and DoQ as well "dns" in autoSystemWfpBlockLeak only blocked port 53 outside the TUN, plus the DNS Client service on Windows 11 and Server 2022 and later, so other programs' DNS over TLS (TCP 853) and DNS over QUIC (UDP 853) could still leave outside the TUN. autoSystemWfpBlockLeak now takes: - "tcp/<port>", "udp/<port>": connections to that port may only go through the TUN (or come from Xray itself). - "windnsclient": Windows' DNS Client service may only connect through the TUN, except for mDNS and LLMNR. As before, this only applies from Windows 11 and Server 2022 on, where the service may use DoH or DoT to any port; earlier versions only query port 53. - "dns": stands for "udp/53", "tcp/53", "windnsclient", "tcp/853" and "udp/853". - "misconfigtun": unchanged. Values are case-insensitive, deduplicated, and anything else, such as "tcp/0" or "icmp/1", is rejected. Keeping the system's DNS inside the TUN, with "udp/53", "tcp/53" or "windnsclient", needs dns to be set, as "dns" did; ports like 853 alone do not. Each port gets its own permit-through-TUN and block filters with a protocol condition, where port 53 used to have one for both protocols, and the log lists what is blocked, e.g. "[tun] blocked outside the TUN: udp/53, tcp/53, tcp/853, udp/853, windnsclient". Tested on Windows 11 with a Wintun adapter as the outside interface: with "tcp/853", "udp/853", "tcp/7215" and "udp/7216", those are blocked outside the TUN over IPv4 and IPv6, while tcp/7216, udp/7215 and 443 are not, port 853 works through the TUN, Xray's own connections to port 853 still leave outside it, and nothing is blocked after Xray stops. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
TUN 的 README.md 也带上那些 PR #6853 (comment) 的内容,以及近期其它与 TUN 相关的改动 |
…nt changes in README Covers #7173 (a connection that cannot be bound fails instead of leaving unbound), #7214 (IPv4-only and IPv6-only outbound interfaces on Windows), #7230 (IPV6_BOUND_IF on macOS), and also #7130 (built-in TCP/IP stack), #6874 (IPv6 disabled system-wide on Windows), #6811 (an existing Wintun adapter is reused) and #6883 (the iOS fd is duplicated). #7092 and autoSystemWfpBlockLeak were already covered. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@patterniha 新加的这些是不是不好做双向 block(因为得排除掉 Xray 接收 DNS 响应的情况)? |
No, they're already blocked in both directions, the same as port 53 before, and Xray is excluded. The filters sit in WFP's ALE (Application Layer Enforcement) layers, which are stateful. ALE connect judges a program's outgoing connection, and for UDP its first packet to each remote IP:port. ALE recv-accept judges incoming connections, and for UDP the first packet from a remote IP:port the socket never sent to. Once a flow is allowed, the rest of it, replies included, is not checked again. Each port gets its filters on both layers, for IPv4 and IPv6, and "permit Xray" (by its app ID) is on all of them with the highest weight. So:
Only "windnsclient" is outbound-only, since the DNS Client service only opens connections. In the test, Xray's own queries to port 53 and 853 outside the TUN got their replies while other programs were blocked. |
autoSystemWfpBlockLeak on Windows; "dns" covers DoT and DoQ as wellautoSystemWfpBlockLeak: Support "tcp/port" and "udp/port"; "dns" covers "tcp/853" and "udp/853" as well
|
@Fangliding XTLS/Xray-docs-next#903 XTLS/Xray-docs-next#906 这俩文档 PR 尽快合并, |
|
@patterniha 是否有必要加一个 "all",即除了 Xray 外的几乎所有流量 |
Windows' own LAN route is more specific than the TUN's, so LAN traffic leaves outside the TUN and never reaches Xray's bypass rules; "all" would block it, along with incoming connections to other programs (RDP, SMB), mDNS/LLMNR, other VPNs and some VM NATs. Anyway, we can add it as an opt-in for users who want a strict mode, where nothing but Xray can leave outside the TUN. |
- VLESS/Trojan без TLS, REALITY и VLESS Encryption Xray теперь пускает только на 10/8, 172.16/12, 192.168/16, loopback, link-local и fc00::/7 (XTLS/Xray-core#7249). Клиентская копия проверки сужена так же, иначе ссылка на 100.64.0.0/10 (CGNAT, Tailscale) или 198.18.0.0/15 проходила проверку клиента, а Xray не запускался. - «Блокировать утечки DNS» (`autoSystemWfpBlockLeak: ["dns"]`) теперь закрывает и DNS over TLS/QUIC на порту 853 (XTLS/Xray-core#7288): подсказка и комментарий обновлены. Конфиги клиента (19 ссылок × proxy, TUN auto-route с WFP, TUN split, режимы «сайты» и «приложения») проверены `xray run -test` v26.10.31. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@patterniha 我觉得 "all" 除了 DHCP 这种系统必要的,其它的都可以拦截掉,你测测,以及是否依赖 TUN 其它选项要理清楚 另外补上 "tcp"、“udp”、"icmp", |
|
演进方向是即使不需要 TUN 或只需要代理少部分流量,Xray-core 也可以弄一个 GUI 可配置的 Windows 防火墙,现在算是雏形 |
…rt alone, port range, "tcp"/"udp" alone or with port range, "icmp", and a CIDR in front of any value; Always allow loopback, DHCP and IPv6 neighbor discovery (#7315) #7288 (comment) #7315 (comment) #7315 (comment) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
#6853 (comment)
"dns" in autoSystemWfpBlockLeak only blocked port 53 outside the TUN, plus the DNS Client service on Windows 11 and Server 2022 and later, so other programs' DNS over TLS (TCP 853) and DNS over QUIC (UDP 853) could still leave outside the TUN.
autoSystemWfpBlockLeak now takes:
Values are case-insensitive, deduplicated, and anything else, such as "tcp/0" or "icmp/1", is rejected. Keeping the system's DNS inside the TUN, with "udp/53", "tcp/53" or "windnsclient", needs dns to be set, as "dns" did; ports like 853 alone do not. Each port gets its own permit-through-TUN and block filters with a protocol condition, where port 53 used to have one for both protocols, and the log lists what is blocked, e.g. "[tun] blocked outside the TUN: udp/53, tcp/53, tcp/853, udp/853, windnsclient".
Tested on Windows 11 with a Wintun adapter as the outside interface: with "tcp/853", "udp/853", "tcp/7215" and "udp/7216", those are blocked outside the TUN over IPv4 and IPv6, while tcp/7216, udp/7215 and 443 are not, port 853 works through the TUN, Xray's own connections to port 853 still leave outside it, and nothing is blocked after Xray stops.