Created
May 29, 2017 15:52
-
-
Save cerealskill/6278042ef8c176f4422c633e293c3571 to your computer and use it in GitHub Desktop.
Firewall Iptables CentOS 6.x (Script de inicio)
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/bash | |
| # Open port 53 on firewall (iptables) Only for CentOS 6.X | |
| sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT | |
| sudo iptables -A INPUT -p icmp -j ACCEPT # (Ping) | |
| sudo iptables -A INPUT -i lo -j ACCEPT # (localhost) | |
| sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT # SSH-Acceso | |
| sudo iptables -I INPUT -p tcp -m tcp --dport 53 -j ACCEPT # DNS | |
| sudo iptables -I INPUT -p udp -m udp --dport 53 -j ACCEPT # DNS | |
| iptables -A INPUT -m state --state NEW -p tcp --dport 53 -j ACCEPT # DNS | |
| iptables -A INPUT -m state --state NEW -p udp --dport 53 -j ACCEPT # DNS | |
| sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT # httpd24-httpd (Apache Web) | |
| sudo iptables -A INPUT -p tcp --dport 3306 -j ACCEPT # MySQL | |
| sudo iptables -P INPUT DROP # DROP ALL | |
| sudo service iptables save # guardamos las reglas |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment