#!/bin/sh
#
#

me=${0##*/}     # strip path

if [ "$1" != "on" ] && [ "$1" != "off" ] && [ "$1" != "invert" ]
then
    echo Usage: $me on\|off
    exit 0
fi

[ "$1" = "on" ] && action="-I"
[ "$1" = "off" ] && action="-D"

if [ "$1" = "invert" ]
then
    stat=`iptables -L INPUT | grep -c REJECT`
    if [ "$stat" != "0" ]
    then
        action="-D"
    else
        action="-I"
    fi
fi

iptables $action INPUT -s 10.0.0.0/8 -p tcp --dport 80 --syn -j REJECT --reject-with tcp-reset
iptables $action INPUT -s 10.0.0.0/8 -p tcp --dport 443 --syn -j REJECT --reject-with tcp-reset
iptables $action INPUT -s 10.0.0.0/8 -p tcp --dport 8081 --syn -j REJECT --reject-with tcp-reset
