Template
1
0
mirror of https://github.com/bol-van/zapret2.git synced 2026-03-14 06:13:09 +00:00

init.d: 50-wg4all catch also response and cookie

This commit is contained in:
bol-van
2025-12-25 16:38:09 +03:00
parent b0686b16f7
commit 9e2222549e

View File

@@ -1,9 +1,9 @@
# this custom script runs desync to all wireguard handshake initiation packets # this custom script runs desync to all wireguard handshake initiation, response and cookie packets
# NOTE: this works for original wireguard and may not work for 3rd party implementations such as xray # NOTE: this works for original wireguard and may not work for 3rd party implementations such as xray
# NOTE: @ih requires nft 1.0.1+ and updated kernel version. it's confirmed to work on 5.15 (openwrt 23) and not work on 5.10 (openwrt 22) # NOTE: @ih requires nft 1.0.1+ and updated kernel version. it's confirmed to work on 5.15 (openwrt 23) and not work on 5.10 (openwrt 22)
# can override in config : # can override in config :
NFQWS_OPT_DESYNC_WG="${NFQWS_OPT_DESYNC_WG:---payload wireguard_initiation --lua-desync=fake:blob=0x00000000000000000000000000000000:repeats=2}" NFQWS_OPT_DESYNC_WG="${NFQWS_OPT_DESYNC_WG:---payload wireguard_initiation,wireguard_response,wireguard_cookie --lua-desync=fake:blob=0x00000000000000000000000000000000:repeats=2}"
alloc_dnum DNUM_WG4ALL alloc_dnum DNUM_WG4ALL
alloc_qnum QNUM_WG4ALL alloc_qnum QNUM_WG4ALL
@@ -21,7 +21,9 @@ zapret_custom_firewall()
# $1 - 1 - run, 0 - stop # $1 - 1 - run, 0 - stop
local f='-p udp -m u32 --u32' local f='-p udp -m u32 --u32'
fw_nfqws_post $1 "$f 0>>22&0x3C@4>>16=0x9c&&0>>22&0x3C@8=0x01000000" "$f 44>>16=0x9c&&48=0x01000000" $QNUM_WG4ALL fw_nfqws_post $1 "$f 0>>22&0x3C@4>>16=156&&0>>22&0x3C@8=0x01000000" "$f 44>>16=156&&48=0x01000000" $QNUM_WG4ALL
fw_nfqws_post $1 "$f 0>>22&0x3C@4>>16=100&&0>>22&0x3C@8=0x02000000" "$f 44>>16=100&&48=0x02000000" $QNUM_WG4ALL
fw_nfqws_post $1 "$f 0>>22&0x3C@4>>16=72&&0>>22&0x3C@8=0x03000000" "$f 44>>16=72&&48=0x03000000" $QNUM_WG4ALL
} }
zapret_custom_firewall_nft() zapret_custom_firewall_nft()
{ {
@@ -29,4 +31,8 @@ zapret_custom_firewall_nft()
local f="udp length 156 @ih,0,32 0x01000000" local f="udp length 156 @ih,0,32 0x01000000"
nft_fw_nfqws_post "$f" "$f" $QNUM_WG4ALL nft_fw_nfqws_post "$f" "$f" $QNUM_WG4ALL
local f="udp length 100 @ih,0,32 0x02000000"
nft_fw_nfqws_post "$f" "$f" $QNUM_WG4ALL
local f="udp length 72 @ih,0,32 0x03000000"
nft_fw_nfqws_post "$f" "$f" $QNUM_WG4ALL
} }