Created
December 27, 2011 17:41
-
-
Save glidenote/1524517 to your computer and use it in GitHub Desktop.
allow_ip.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
ALLOW_IP=`host hogehoge.com | awk '{print $4}'` | |
PORT_LIST=" | |
22 | |
80 | |
443 | |
3000 | |
4000 | |
4949 | |
9821 | |
" | |
# condrestartで設定をリセット | |
/etc/rc.d/init.d/iptables condrestart | |
for port in ${PORT_LIST} | |
do | |
echo "/sbin/iptables -I RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp -s ${ALLOW_IP} --dport ${port} -j ACCEPT" | |
/sbin/iptables -I RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp -s ${ALLOW_IP} --dport ${port} -j ACCEPT | |
done | |
/sbin/iptables -L -n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sshd: /etc/hosts.allow.d/my_home_ip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment