As soon as you have your basic Server setup completed (See How to Setup Virtualmin on CentOS 5 and How to: Virtualmin Post-Installation Wizard ) we need to start securing our system.

Our first step will be to get a Firewall in place as soon as possible to close down all the ports, after that we can secure and harder our other programs and then then open the ports to use them.

Now you want your Firewall to start up on boot and also be easy to manage from Virtualmin.

To create the script and get it running and running on boot:

vim /etc/rc.d/init.d/firewall

paste your firewall script in there

– you can find a basic script here – http://burnz.wordpress.com/2010/08/08/centos-firewall-init-script/

– or a more advanced firewall script via google

Execute the command:

chmod 755 /etc/rc.d/init.d/firewall

Execute:

chkconfig --add firewall && chkconfig firewall on

 

Your firewall should now be in place – we can now check it out and manage it in Virtualmin.

Navigate to your sites Virtualmin Control Panel:

https://server1.example.com:10000

or

https://x.x.x.x:10000   ##  where x.x.x.x is you server IP

 

Then click on the WEBMIN link on the TOP LEFT:

  Virtualmin  Webmin

Click on the:

System >>> Bootup and Shutdown

You should see your firewall scrip in the list of boot and shutdown scripts:

Check the –

 Firewall

Scroll all the way to the bottom and click on:

##

You could also use the service command to start the firewall via SSH

service firewall start

##

Now you can be sure that the firewall is running and will start on boot.

To manage the Firewall in the future, edit it, add and remove firewall rules or what ever you want you can:

Open your Virtualmin Control panel- Click on the WEBMIN link on the TOP LEFT:

  Virtualmin  Webmin

Click on the:

System >>> Bootup and Shutdown

Click on the:

 Firewall link

Edit the Firewall script as you would any normal text file.

Save

Check the –

 Firewall

Scroll all the way to the bottom and click on:

##

You could also use the service command to restart the firewall via SSH

service firewall restart

##

How to: CentOS 5 and Virtualmin Firewall Init Script
Tagged on:                             

Leave a Reply

Your email address will not be published. Required fields are marked *

6 thoughts on “How to: CentOS 5 and Virtualmin Firewall Init Script