Psst.. new poll here.
[email protected] web/email now available. Want one? Go here.
Cannot use outlook/hotmail/live here to register as they blocking our mail servers. #microsoftdeez
Obey the Epel!
Paste
Pasted as Bash by registered user Sam ( 3 years ago )
#!/bin/bash
HOSTNAME=.freeddns.com
LOGFILE=/var/log/sam_firewall.log
touch /var/log/sam_firewall.log
chmod 740 /var/log/sam_firewall.log
chown root:adm /var/log/sam_firewall.log
Current_IP=$(host $HOSTNAME | cut -f4 -d' ')
if [[ $(iptables --list | grep $Current_IP) = "" ]]; then
if [[ $LOGFILE = "" ]] ; then
iptables -I INPUT -i eth0 -s $Current_IP -j ACCEPT
else
Old_IP=$(cat $LOGFILE)
if [[ $Old_IP != $Current_IP ]] ; then
if [[ $(iptables --list | grep $Old_IP) = "" ]] ; then
echo ''
else
iptables -D INPUT -i eth0 -s $Old_IP -j ACCEPT
fi
fi
iptables -I INPUT -i eth0 -s $Current_IP -j ACCEPT
fi
fi
echo $Current_IP > $LOGFILE
Revise this Paste