LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   Where to save Firewall? (https://www.linuxquestions.org/questions/linux-security-4/where-to-save-firewall-84303/)

jrgalan 08-21-2003 03:40 PM

Where to save Firewall?
 
after having decided what rules need to be set for iptables, should you save the iptables modifications by typing:

service iptables save.

or, is it better to create a script and what's the difference?

also, where should you save this scipt in Red Hat 9?

thanks!

Looking_Lost 08-21-2003 04:34 PM

you can do

iptables-save > /etc/sysconfig/iptables

to save the currently loaded rules which will be loaded everytime you restart

jrgalan 08-21-2003 05:40 PM

thanks for the reply looking_lost.

iptables-save > /etc/sysconfig/iptables accomplishes the same thing as service iptables save - saving the changes in the iptables file.

i guess my question is what are the advantages of creating a firewall script, and where should you save it?

Capt_Caveman 08-21-2003 05:41 PM

Only real difference is that by loading the rules by hand from the commandline, you'll see any specific error messgaes. Depending on how you design your script, alot of times the script won't tell you when a rule fails to load (esp if you call the script during the init process). However, I think scripts are easier to work with, so I test out all the rules from the commandline first before I put them in a script. Then at the end of my script I have the same iptables-save > thing that Looking_Lost suggests.

I just put my script in the same directory as the iptables file (/etc/sysconfig/) and make it executable. You can then put the path to the script in one of the /etc/rc.d/ files so that the script is run at boot (it's actually best to use a specfic rc. file, but I don't remember off the top of my head).
HTH

Mathieu 08-21-2003 06:25 PM

With RedHat and Mandrake, you do not need to create a script in order to apply iptables rules, you can turn ON the iptables service.
The advantage is that the rules will be applied first and then followed by the activation of the network services.

If you want the iptables service to start on system boot,
make sure runlevel 3 and 5 are ON.
Code:

chkconfig --list iptables
To start iptables manually, type:
Code:

service iptables start


All times are GMT -5. The time now is 06:19 AM.