Skip to content

Instantly share code, notes, and snippets.

@OmgImAlexis
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OmgImAlexis/3154d5c8e1e6fb303cbd to your computer and use it in GitHub Desktop.
Save OmgImAlexis/3154d5c8e1e6fb303cbd to your computer and use it in GitHub Desktop.
Centos IP Tables | Normal + port 3000 > 80
#!/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