#!/bin/sh
IPTABLE=/sbin/iptables
IP_GRANTED=192.168.146.1
$IPTABLE -t filter -F
$IPTABLE -t filter -X
$IPTABLE -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT $IPTABLE -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
$IPTABLE -N SSH_WHITELIST $IPTABLE -A SSH_WHITELIST -s $IP_GRANTED -m recent --remove --name SSH -j ACCEPT
$IPTABLE -A INPUT -p tcp --dport 22 -m state --state NEW -m recent --set --name SSH $IPTABLE -A INPUT -p tcp --dport 22 -m state --state NEW -j SSH_WHITELIST
$IPTABLE -A INPUT -m state --state NEW -p tcp --dport 22 -j DROP
|
Comments