Like many Linux users, I use Guarddog as a frontend to my iptables firewall. At some point, I noticed that Guarddog started acting strangely. Every time I restarted my computer, all internet traffic was blocked (both in and out). The only way to fix this situation was to open Guarddog and press “Apply” (without doing any changes). While it was annoying, it didn’t bother me much because I used to restart my computer about once a month. But few days ago, I decided to solve this problem once and for all.
I noticed that Guarrdog doesn’t tell iptables to save the setting permanently. Instead it creates a script under /etc/rc.firewall
in which it saves the firewall settings. When applying firewall saving to Guarddog, it just runs this script (after possibly modifying it). The solution is to run this script automatically upon startup, after starting the iptables.
In Gentoo (and some other distributions) it can be done using the initscripts. Put the following code inside /etc/init.d/guarddog
(if you are using a different distribution your path might be different):
# This is an initscript that applies Guarddog's rules on startup
depend() {
after iptables
}
start() {
ebegin "Applying firewall rules - Guarddog"
/etc/rc.firewall
eend $? "Firewall rules not set"
}
After you created the file, you will need to actually add it to the list of initscripts that run at startup. This can be done using the following command:
rc-update add guarddog default
Guarddog rules will now be applied at startup, and there will be no need to open Guarddog to apply the rules after every boot.