Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

This is my original server with very loose security given that it does not block all ports via iptables.

 /etc/sysconfig/iptables 

contents:

# Generated by iptables-save v1.4.7 on Mon Jun 16 20:04:05 2014
*filter
:INPUT ACCEPT [8:607]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [6:1089]
COMMIT
# Completed on Mon Jun 16 20:04:05 2014

this (below) is a server with a different company but it looks like it came with good security settings in.. ( allows only port 22 )

 /etc/sysconfig/iptables 

contents:

# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

this one looks alot better.

Can I simply copy these to my original server's /etc/sysconfig/iptables and then reboot the whole system and expect everything to work ?

share|improve this question
    
yes you can though I'm not sure it will work as iptables does not necessarilly use that file to restore the rules –  Kiwy Jul 15 at 11:30

1 Answer 1

Basically yes, it's is the default iptable file for a clean installation, but i recommend to use a more up-2-date rules, and add some logging to your rules.

See this template for example: https://gist.github.com/jirutka/3742890

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.