mirror of
https://github.com/bol-van/zapret.git
synced 2024-11-26 20:20:53 +03:00
Compare commits
6 Commits
a54d6c1437
...
238ee06da6
Author | SHA1 | Date | |
---|---|---|---|
|
238ee06da6 | ||
|
7b36760ab5 | ||
|
ad0d65e492 | ||
|
2692735c61 | ||
|
3cfadd1717 | ||
|
386164f1f7 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,4 +1,4 @@
|
||||
config
|
||||
/config
|
||||
ip2net/ip2net
|
||||
mdig/mdig
|
||||
nfq/nfqws
|
||||
|
@ -1716,6 +1716,62 @@ install_easy.sh автоматизирует ручные варианты пр
|
||||
Система простой инсталяции заточена на любое умышленное или неумышленное изменение прав доступа на файлы.
|
||||
Устойчива к репаку под windows. После копирования в /opt права будут принудительно восстановлены.
|
||||
|
||||
|
||||
Установка на openwrt в режиме острой нехватки места на диске
|
||||
------------------------------------------------------------
|
||||
|
||||
Требуется около 120-200 кб на диске. Придется отказаться от всего, кроме tpws.
|
||||
|
||||
* Инструкция для openwrt 22 и выше с nftables.
|
||||
|
||||
Никаких зависимостей устанавливать не нужно.
|
||||
|
||||
Установка :
|
||||
|
||||
Скопируйте все из init.d/openwrt-minimal/tpws/* в корень openwrt.
|
||||
Скопируйте бинарник tpws подходящей архитектуры в /usr/bin/tpws.
|
||||
Установите права на файлы : chmod 755 /etc/init.d/tpws /usr/bin/tpws
|
||||
Отредактируйте /etc/config/tpws
|
||||
/etc/init.d/tpws enable
|
||||
/etc/init.d/tpws start
|
||||
fw4 reload
|
||||
|
||||
Полное удаление :
|
||||
|
||||
/etc/init.d/tpws disable
|
||||
/etc/init.d/tpws stop
|
||||
rm -f /etc/nftables.d/90-tpws.nft /etc/firewall.user /etc/init.d/tpws /usr/bin/tpws
|
||||
fw4 restart
|
||||
|
||||
* Инструкция для openwrt 21 и ниже с iptables.
|
||||
|
||||
Установите зависимости :
|
||||
opkg update
|
||||
opkg install iptables-mod-extra
|
||||
только для IPV6 : opkg install ip6tables-mod-nat
|
||||
|
||||
Убедитесь, что в /etc/firewall.user нет ничего значимого.
|
||||
Если есть - не следуйте слепо инструкции. Обьедините код или создайте свой firewall include в /etc/config/firewall.
|
||||
|
||||
Установка :
|
||||
|
||||
Скопируйте все из init.d/openwrt-minimal/tpws/* в корень openwrt.
|
||||
Скопируйте бинарник tpws подходящей архитектуры в /usr/bin/tpws.
|
||||
Установите права на файлы : chmod 755 /etc/init.d/tpws /usr/bin/tpws
|
||||
Отредактируйте /etc/config/tpws
|
||||
/etc/init.d/tpws enable
|
||||
/etc/init.d/tpws start
|
||||
fw3 restart
|
||||
|
||||
Полное удаление :
|
||||
|
||||
/etc/init.d/tpws disable
|
||||
/etc/init.d/tpws stop
|
||||
rm -f /etc/nftables.d/90-tpws.nft /etc/firewall.user /etc/init.d/tpws
|
||||
touch /etc/firewall.user
|
||||
fw3 restart
|
||||
|
||||
|
||||
Android
|
||||
-------
|
||||
|
||||
|
52
init.d/openwrt-minimal/readme.txt
Normal file
52
init.d/openwrt-minimal/readme.txt
Normal file
@ -0,0 +1,52 @@
|
||||
Minimal tpws startup script for low storage openwrt.
|
||||
|
||||
--- openwrt with NFTABLES (22+)
|
||||
|
||||
Make sure you are running openwrt with nftables, not iptables.
|
||||
No opkg dependencies required !
|
||||
|
||||
* install :
|
||||
|
||||
Copy everything from tpws directory to the root of the router.
|
||||
Copy tpws binary for your architecture to /usr/bin/tpws
|
||||
Set proper access rights : chmod 755 /etc/init.d/tpws /usr/bin/tpws
|
||||
EDIT /etc/config/tpws
|
||||
/etc/init.d/tpws enable
|
||||
/etc/init.d/tpws start
|
||||
fw4 reload
|
||||
|
||||
* full uninstall :
|
||||
|
||||
/etc/init.d/tpws disable
|
||||
/etc/init.d/tpws stop
|
||||
rm -f /etc/nftables.d/90-tpws.nft /etc/firewall.user /etc/init.d/tpws
|
||||
fw4 restart
|
||||
|
||||
--- openwrt with IPTABLES (21-)
|
||||
|
||||
Make sure you are running openwrt with iptables, not nftables.
|
||||
Make sure you do not have anything valuable in /etc/firewall.user.
|
||||
If you have - do not blindly follow instruction in firewall.user part.
|
||||
Merge the code instead or setup your own firewall include in /etc/config/firewall.
|
||||
|
||||
opkg update
|
||||
opkg install iptables-mod-extra
|
||||
IPV6 ONLY : opkg install ip6tables-mod-nat
|
||||
|
||||
* install :
|
||||
|
||||
Copy everything from tpws directory to the root of the router.
|
||||
Copy tpws binary for your architecture to /usr/bin/tpws
|
||||
Set proper access rights : chmod 755 /etc/init.d/tpws /usr/bin/tpws
|
||||
EDIT /etc/config/tpws
|
||||
/etc/init.d/tpws enable
|
||||
/etc/init.d/tpws start
|
||||
fw3 restart
|
||||
|
||||
* full uninstall :
|
||||
|
||||
/etc/init.d/tpws disable
|
||||
/etc/init.d/tpws stop
|
||||
rm -f /etc/nftables.d/90-tpws.nft /etc/firewall.user /etc/init.d/tpws
|
||||
touch /etc/firewall.user
|
||||
fw3 restart
|
12
init.d/openwrt-minimal/tpws/etc/config/tpws
Normal file
12
init.d/openwrt-minimal/tpws/etc/config/tpws
Normal file
@ -0,0 +1,12 @@
|
||||
config global defaults
|
||||
option user daemon
|
||||
option tpws /usr/bin/tpws
|
||||
|
||||
config tpws
|
||||
option port 900
|
||||
option opt '--split-pos=2 --oob'
|
||||
option enabled 1
|
||||
config tpws
|
||||
option port 901
|
||||
option opt '--split-tls=sni --disorder'
|
||||
option enabled 0
|
28
init.d/openwrt-minimal/tpws/etc/firewall.user
Normal file
28
init.d/openwrt-minimal/tpws/etc/firewall.user
Normal file
@ -0,0 +1,28 @@
|
||||
TP_PORT=900
|
||||
TP_USER=daemon
|
||||
|
||||
exists()
|
||||
{
|
||||
which "$1" >/dev/null 2>/dev/null
|
||||
}
|
||||
|
||||
ipt()
|
||||
{
|
||||
$IPTABLES $FW_EXTRA_PRE -C "$@" $FW_EXTRA_POST >/dev/null 2>/dev/null || $IPTABLES $FW_EXTRA_PRE -I "$@" $FW_EXTRA_POST
|
||||
}
|
||||
|
||||
redirect_port()
|
||||
{
|
||||
ipt PREROUTING -t nat -p tcp --dport $1 -j REDIRECT --to-port $2
|
||||
ipt OUTPUT -t nat -p tcp --dport $1 -m owner ! --uid-owner $TP_USER -j REDIRECT --to-port $2
|
||||
}
|
||||
|
||||
redirect()
|
||||
{
|
||||
redirect_port 80 $TP_PORT
|
||||
redirect_port 443 $TP_PORT
|
||||
}
|
||||
|
||||
for IPTABLES in iptables ip6tables; do
|
||||
exists $IPTABLES && redirect
|
||||
done
|
34
init.d/openwrt-minimal/tpws/etc/init.d/tpws
Executable file
34
init.d/openwrt-minimal/tpws/etc/init.d/tpws
Executable file
@ -0,0 +1,34 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
TPWS_DEFAULT=/usr/bin/tpws
|
||||
TPWS_USER_DEFAULT=daemon
|
||||
|
||||
START=99
|
||||
STOP=01
|
||||
USE_PROCD=1
|
||||
|
||||
tpws_instance()
|
||||
{
|
||||
config_get "$@"
|
||||
|
||||
local enabled port opt
|
||||
|
||||
config_get_bool enabled "$1" enabled 0
|
||||
[ "$enabled" -eq 1 ] || return 1
|
||||
|
||||
config_get port "$1" port
|
||||
config_get opt "$1" opt
|
||||
|
||||
local COMMAND="$TPWS --user=$TPWS_USER --port=$port $opt"
|
||||
procd_open_instance
|
||||
procd_set_param command $COMMAND
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
start_service()
|
||||
{
|
||||
config_load tpws
|
||||
config_get TPWS_USER defaults user $TPWS_USER_DEFAULT
|
||||
config_get TPWS defaults tpws $TPWS_DEFAULT
|
||||
config_foreach tpws_instance tpws
|
||||
}
|
8
init.d/openwrt-minimal/tpws/etc/nftables.d/90-tpws.nft
Normal file
8
init.d/openwrt-minimal/tpws/etc/nftables.d/90-tpws.nft
Normal file
@ -0,0 +1,8 @@
|
||||
chain tpws_re {
|
||||
type nat hook prerouting priority dstnat; policy accept;
|
||||
tcp dport {80,443} redirect to :900
|
||||
}
|
||||
chain tpws_out {
|
||||
type nat hook output priority -100; policy accept;
|
||||
tcp dport {80,443} skuid != daemon redirect to :900
|
||||
}
|
@ -486,6 +486,7 @@ init.d/runit/zapret/finish \
|
||||
init.d/openrc/zapret \
|
||||
init.d/sysv/zapret \
|
||||
init.d/openwrt/zapret \
|
||||
init.d/openwrt-minimal/tpws/etc/init.d/tpws \
|
||||
uninstall_easy.sh \
|
||||
; do chmod 755 "$1/$f" 2>/dev/null ; done
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user