Quote:
|
Originally Posted by till
The script is:
/etc/Bastille/bastille-firewall.cfg
You will have to change the master file too:
/root/ispconfig/isp/conf/bastille-firewall.cfg.master
Then run:
/etc/init.d/bastille-firewall restart
|
I found that I wasnt able to add ACLs directly to the bastille-firewall.cfg script.
After doing some reading, here is my how-to and hopefully others will find it useful:
In this case I want to restrict ssh access to only one IP address (you can configure it for any number depending on your needs)
I order to restrict access to certain source IPs for certain protocols, using the Bastille-firewall setup you need to firstly create a new directory under /etc/Bastille. This directory needs to be called firewall.d
#cd /etc/Bastille
#mkdir firewall.d
You then need to create a new file within the newly created directory called post-rule-setup.sh
#cd firewall.d
#vi post-rule-setup.sh
This is the file where any IPTABLES rules can be entered. When you restart bastille.cfg the script is read and the rules applied. A knowledge of IPTABLES is required but once you get the hang of it, it is easy enough.
So in my case I want to allow ssh access to only 123.34.56.789 and deny it to ALL other IP addresses, so my post-rule-setup.sh file will look like this:
/sbin/iptables -I INPUT -p tcp -m tcp -s 123.34.56.789 --dport 22 --syn -j ACCEPT
/sbin/iptables -I INPUT -p tcp -m tcp --dport 22 --syn -j REJECT
The first line accepts ssh (tcp port 22) connections only from 123.34.56.789 and the second line denies ALL other source IP addresses. If there is no match in this case 123.34.56.789 then all traffic bound for port 22 will be denied.
Ok now we have our rule we need to restart bastille.cfg
#/etc/init.d/bastille-firewall restart
A successfully read script will yield the following
Setting up IP spoofing protection... done.
Allowing traffic from trusted interfaces... done.
Setting up chains for public/internal interface traffic... done.
Setting up general rules... done.
Setting up outbound rules... done
The last line is the one we are interested in. If your IPTABLES rules are not understood or written incorrectly then you will get the following output when you restart bastille.cfg
Setting up IP spoofing protection... done.
Allowing traffic from trusted interfaces... done.
Setting up chains for public/internal interface traffic... done.
Setting up general rules... done.
Setting up outbound rules..../post-rule-setup.sh: line 5: -I: command not found
done
You will need to go back into your post-rule-setup.sh and modify it.
You can specify a subnet simply by using for example 192.168.0.0/24 notation in your rule set
Cheers
Matt
Recent comments
1 day 9 hours ago
1 day 18 hours ago
1 day 21 hours ago
1 day 22 hours ago
1 day 23 hours ago
2 days 1 hour ago
2 days 3 hours ago
2 days 4 hours ago
2 days 20 hours ago
2 days 21 hours ago