Articles :: View

Initial Linux Server IPTables Lockdown Script

Tested on:

  • CentOS 6.3
#!/bin/bash
clear
clear
echo '# Locking down iptables...'
iptables -L -v -n
iptables -P INPUT ACCEPT
iptables -F
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
iptables -L -v -n
/sbin/service iptables save
/sbin/service iptables restart


Comments

Be the first to add a comment!