Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so dont bother with any of their useless mail servers here and just use oauth login instead. Thank the nice Russians for causing that. :)
Paste
Pasted as Bash by registered user Sam ( 5 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