Last active
August 29, 2015 14:01
-
-
Save OmgImAlexis/3154d5c8e1e6fb303cbd to your computer and use it in GitHub Desktop.
Centos IP Tables | Normal + port 3000 > 80
This file contains 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/bash | |
iptables -F | |
iptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP | |
iptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROP | |
iptables -A INPUT -p tcp --tcp-flags ALL ALL -j DROP | |
iptables -A INPUT -i lo -j ACCEPT | |
iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT | |
iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT | |
iptables -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT | |
iptables -A INPUT -i eth0 -p tcp --dport 3000 -j ACCEPT | |
iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3000 | |
iptables-save | sudo tee /etc/sysconfig/iptables | |
service iptables restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment