mirror of
https://github.com/bol-van/zapret.git
synced 2025-05-24 22:32:58 +03:00
TSPU QUIC block bypass custom script
This commit is contained in:
66
init.d/openwrt/custom-nfqws-quic4all-tspu
Normal file
66
init.d/openwrt/custom-nfqws-quic4all-tspu
Normal file
@@ -0,0 +1,66 @@
|
||||
# this custom script in addition to MODE=nfqws runs desync to all QUIC initial packets, without ipset/hostlist filtering
|
||||
# and also sends special fake on outgoing packets with short header and udp.length>=600
|
||||
# need to add to config : NFQWS_OPT_DESYNC_QUIC="--dpi-desync=fake"
|
||||
# need to add to config : NFQWS_OPT_DESYNC_QUIC_SHORT_HEADER="--dpi-desync=fake --dpi-desync-any-protocol --dpi-desync-fake-unknown-udp=/opt/zapret/files/fake/quic_short_header.bin --dpi-desync-cutoff=n2"
|
||||
# NOTE : do not use TTL fooling. chromium QUIC engine breaks sessions if TTL expired in transit received
|
||||
|
||||
# this hack is for russian TSPU QUIC blocking
|
||||
# without additional short header fake connections randomly hang
|
||||
|
||||
QNUM2=$(($QNUM+10))
|
||||
QNUM3=$(($QNUM+11))
|
||||
|
||||
zapret_custom_daemons()
|
||||
{
|
||||
# stop logic is managed by procd
|
||||
|
||||
local MODE_OVERRIDE=nfqws
|
||||
local opt
|
||||
|
||||
start_daemons_procd
|
||||
|
||||
opt="--qnum=$QNUM2 $NFQWS_OPT_BASE $NFQWS_OPT_DESYNC_QUIC"
|
||||
run_daemon 100 $NFQWS "$opt"
|
||||
|
||||
opt="--qnum=$QNUM3 $NFQWS_OPT_BASE $NFQWS_OPT_DESYNC_QUIC_SHORT_HEADER"
|
||||
run_daemon 101 $NFQWS "$opt"
|
||||
}
|
||||
zapret_custom_firewall()
|
||||
{
|
||||
# $1 - 1 - run, 0 - stop
|
||||
|
||||
local MODE_OVERRIDE=nfqws
|
||||
local f
|
||||
local first_packets_only="-m connbytes --connbytes-dir=original --connbytes-mode=packets --connbytes 1:3"
|
||||
local desync="-m mark ! --mark $DESYNC_MARK/$DESYNC_MARK"
|
||||
local udplen="-m length --length 600:1500"
|
||||
local short_header4="-m u32 --u32 0>>22&0x3C@8>>24&0xC0=0x40"
|
||||
|
||||
zapret_do_firewall_rules_ipt $1
|
||||
|
||||
f="-p udp --dport 443"
|
||||
fw_nfqws_post $1 "$f $desync $first_packets_only" "$f $desync $first_packets_only" $QNUM2
|
||||
# this for ipv4 only. do not have access to ipv6 enabled TSPU to test
|
||||
fw_nfqws_post $1 "$f $desync $udplen $short_header4" "" $QNUM3
|
||||
|
||||
}
|
||||
zapret_custom_firewall_nft()
|
||||
{
|
||||
# stop logic is not required
|
||||
|
||||
local MODE_OVERRIDE=nfqws
|
||||
local f
|
||||
local first_packets_only="ct original packets 1-3"
|
||||
local desync="mark and $DESYNC_MARK == 0"
|
||||
local udplen="udp length 600-1500"
|
||||
local short_header4="@th,64,2 1"
|
||||
|
||||
zapret_apply_firewall_rules_nft
|
||||
|
||||
f="udp dport 443"
|
||||
nft_fw_nfqws_post $1 "$f $desync $first_packets_only" "$f $desync $first_packets_only" $QNUM2
|
||||
# this for ipv4 only. do not have access to ipv6 enabled TSPU to test
|
||||
nft_fw_nfqws_post $1 "$f $desync $udplen $short_header4" "" $QNUM3
|
||||
# add flow offload exemption for the whole stream because we dont know when short_header rule triggers
|
||||
nft_add_flow_offload_exemption "$f" "" "QUIC exemption for complex TSPU hack"
|
||||
}
|
Reference in New Issue
Block a user