diff options
author | Dave Simons | 2015-09-11 13:54:38 +0200 |
---|---|---|
committer | Dave Simons | 2015-09-11 13:54:38 +0200 |
commit | a996daea0f6e0acc974f266418d4997d0dbd2f02 (patch) | |
tree | 58454e4728cab8ff41d80b0e592f56f466b191d7 /nf-cleanup | |
download | aur-a996daea0f6e0acc974f266418d4997d0dbd2f02.tar.gz |
initial commit - sshttp-git pkg
Signed-off-by: Dave Simons <pkgs@simonsd.org>
Diffstat (limited to 'nf-cleanup')
-rwxr-xr-x | nf-cleanup | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/nf-cleanup b/nf-cleanup new file mode 100755 index 000000000000..0762308e8d21 --- /dev/null +++ b/nf-cleanup @@ -0,0 +1,33 @@ +#!/bin/sh + +# sshttp netfilter rules +# + +# If you mux SSH/SMTP (rather than HTTP), then HTTP_PORT is your +# alternate SMTP port. e.g. 2525 and sshttp needs to be started with +# '-L 25 -H 2525' + +DEV=eth0 +SSH_PORT=22 +HTTP_PORT=8080 + +#if it clashes with complex NATing rules, try this +#iptables -t mangle -F +#iptables -t nat -F +#iptables -t raw -F + +# block HTTP/SSH direct access +iptables -D INPUT -i $DEV -p tcp --dport $SSH_PORT -j DROP +iptables -D INPUT -i $DEV -p tcp --dport $HTTP_PORT -j DROP + +iptables -t mangle -D DIVERT -j MARK --set-mark 1 +iptables -t mangle -D DIVERT -j ACCEPT + +iptables -t mangle -X DIVERT || true +iptables -t mangle -D OUTPUT -p tcp -o $DEV --sport $SSH_PORT -j DIVERT +iptables -t mangle -D OUTPUT -p tcp -o $DEV --sport $HTTP_PORT -j DIVERT +iptables -t mangle -D PREROUTING -p tcp -m socket -j DIVERT + +ip rule del fwmark 1 lookup 123 || true +ip route del local 0.0.0.0/0 dev lo table 123 + |