mirror of https://github.com/bol-van/zapret/
12 changed files with 84 additions and 149 deletions
@ -1,44 +0,0 @@ |
|||
# this custom script demonstrates how to use 2 copies of nfqws |
|||
# it preserves config settings : MODE_HTTP, MODE_HTTP_KEEPALIVE, MODE_HTTPS, MODE_FILTER, NFQWS_OPT_DESYNC |
|||
# NFQWS_OPT_DESYNC - parameters for http |
|||
# NFQWS_OPT_DESYNC2 - parameters for https. you should add this variable to config file, its absent there |
|||
|
|||
QNUM2=$(($QNUM+1)) |
|||
|
|||
zapret_custom_daemons() |
|||
{ |
|||
local opt |
|||
|
|||
[ "$MODE_HTTP" = "1" ] && { |
|||
opt="$NFQWS_OPT_BASE $NFQWS_OPT_DESYNC" |
|||
filter_apply_hostlist_target opt |
|||
run_daemon 1 $NFQWS "$opt" |
|||
} |
|||
|
|||
[ "$MODE_HTTPS" = "1" ] && { |
|||
opt="$NFQWS_OPT_BASE $NFQWS_OPT_DESYNC2 --qnum=$QNUM2" |
|||
filter_apply_hostlist_target opt |
|||
run_daemon 2 $NFQWS "$opt" |
|||
} |
|||
} |
|||
zapret_custom_firewall() |
|||
{ |
|||
local f4 f6 |
|||
local first_packet_only="-m connbytes --connbytes-dir=original --connbytes-mode=packets --connbytes 1:4" |
|||
local desync="-m mark ! --mark $DESYNC_MARK/$DESYNC_MARK" |
|||
|
|||
[ "$MODE_HTTP" = "1" ] && { |
|||
f4="--dport 80" |
|||
[ "$MODE_HTTP_KEEPALIVE" = "1" ] || f4="$f4 $first_packet_only" |
|||
f6=$f4 |
|||
filter_apply_ipset_target f4 f6 |
|||
fw_nfqws_post "$f4 $desync" "$f6 $desync" $QNUM |
|||
} |
|||
|
|||
[ "$MODE_HTTPS" = "1" ] && { |
|||
f4="--dport 443 $first_packet_only" |
|||
f6=$f4 |
|||
filter_apply_ipset_target f4 f6 |
|||
fw_nfqws_post "$f4 $desync" "$f6 $desync" $QNUM2 |
|||
} |
|||
} |
@ -1,20 +0,0 @@ |
|||
# this script contain your special code to launch daemons and configure firewall |
|||
# use helpers from "functions" file and "zapret" init script |
|||
# in case of upgrade keep this file only, do not modify others |
|||
|
|||
zapret_custom_daemons() |
|||
{ |
|||
# PLACEHOLDER |
|||
echo !!! NEED ATTENTION !!! |
|||
echo Start daemon\(s\) |
|||
echo Study how other sections work |
|||
|
|||
run_daemon 1 /bin/sleep 20 |
|||
} |
|||
zapret_custom_firewall() |
|||
{ |
|||
# PLACEHOLDER |
|||
echo !!! NEED ATTENTION !!! |
|||
echo Configure iptables for required actions |
|||
echo Study how other sections work |
|||
} |
@ -1,44 +0,0 @@ |
|||
# this custom script demonstrates how to use 2 copies of nfqws |
|||
# it preserves config settings : MODE_HTTP, MODE_HTTP_KEEPALIVE, MODE_HTTPS, MODE_FILTER, NFQWS_OPT_DESYNC |
|||
# NFQWS_OPT_DESYNC - parameters for http |
|||
# NFQWS_OPT_DESYNC2 - parameters for https. you should add this variable to config file, its absent there |
|||
|
|||
QNUM2=$(($QNUM+1)) |
|||
|
|||
zapret_custom_daemons() |
|||
{ |
|||
local opt |
|||
|
|||
[ "$MODE_HTTP" = "1" ] && { |
|||
opt="$NFQWS_OPT_DESYNC" |
|||
filter_apply_hostlist_target opt |
|||
do_nfqws $1 1 "$opt" |
|||
} |
|||
|
|||
[ "$MODE_HTTPS" = "1" ] && { |
|||
opt="$NFQWS_OPT_DESYNC2 --qnum=$QNUM2" |
|||
filter_apply_hostlist_target opt |
|||
do_nfqws $1 2 "$opt" |
|||
} |
|||
} |
|||
zapret_custom_firewall() |
|||
{ |
|||
local f4 f6 |
|||
local first_packet_only="-m connbytes --connbytes-dir=original --connbytes-mode=packets --connbytes 1:4" |
|||
local desync="-m mark ! --mark $DESYNC_MARK/$DESYNC_MARK" |
|||
|
|||
[ "$MODE_HTTP" = "1" ] && { |
|||
f4="--dport 80" |
|||
[ "$MODE_HTTP_KEEPALIVE" = "1" ] || f4="$f4 $first_packet_only" |
|||
f6=$f4 |
|||
filter_apply_ipset_target f4 f6 |
|||
fw_nfqws_post $1 "$f4 $desync" "$f6 $desync" $QNUM |
|||
} |
|||
|
|||
[ "$MODE_HTTPS" = "1" ] && { |
|||
f4="--dport 443 $first_packet_only" |
|||
f6=$f4 |
|||
filter_apply_ipset_target f4 f6 |
|||
fw_nfqws_post $1 "$f4 $desync" "$f6 $desync" $QNUM2 |
|||
} |
|||
} |
Loading…
Reference in new issue