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:
Click on the:
System >>> Bootup and Shutdown
You should see your firewall scrip in the list of boot and shutdown scripts:
Check the –
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:
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 –
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
##
First of all thanks for such good tutorial.
I just found a problem with this firewall part. All seems working fine, except when creating subservers.
config1{
domain1.com
domain2.com
firewall enabled
}All works fine
config2{
domain1.com
dev.domain1.com
domain2.com
firewall enabled
}unable to access dev.domain1.com
when firewall disabled all works fine.
Any suggestion on why it is happening?
Kind regards,
Broding
Hi Broding,
I am glad you found my Tutorial on setting up a firewall init script helpful.
I would need to look at your firewall to be able to have any chance at knowing what is causing that.
Ill send you a mail and then you can send me the firewall script there.
Regards