mirror of https://github.com/bol-van/zapret/
5 changed files with 86 additions and 0 deletions
@ -0,0 +1,20 @@ |
|||||
|
Minimal tpws startup script for low storage openwrt with nftables. |
||||
|
No opkg dependencies required ! |
||||
|
|
||||
|
* install : |
||||
|
|
||||
|
Make sure you are running openwrt with nftables, not iptables. |
||||
|
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/init.d/tpws |
||||
|
fw4 restart |
@ -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 |
||||
|
} |
@ -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 |
||||
|
} |
Loading…
Reference in new issue