Backup of the firewall rules

Hello, I would like to save my firewall rules. But only the firewall rules.
What do I need to back up?
Thanks for your help

Manually save the files in

/var/ipfire/firewall/

The IPFire backup process saves all files in that directory.

The only additional thing you might need to do is to save

/etc/sysconfig/firewall.local

if you have manually created any Firewall Rules that needed to be in the CUSTOM chains.

2 Likes

Hello Adolf,
I don’t want the complete main fuse, just the firewall.
I would like to try something, a new installation and then only restore the firewall rule.

I think you may be better of just taking a few screenshots of that FW rule, since backup will take all the settings.

Getting the “text code” for one firewall rule is even more complex, having to get in to the file system, finding the rule in a config file and copying its text. And then copying it back after the new setup.

I don’t understand what you mean by the “main fuse”

You could just save the config file in that directory if the firewall rules you want to save are in the first section on the firewall rules WUI page labelled Firewall Rules.

If the rules you want to save are in the Incoming Firewall Access section then save the file called input.

If the rules you want to save are in the Outgoing Firewall Access section then save the file called output.

If you replace any or all of those files in the directory that does not automatically apply them into the iptables chains. For that you would need to press the Apply Changes button but just copying those files into the directory does not cause that button to be shown.

You would need to have a look at the backup.pl code to see what commands it runs after restoring the config/input/output files into that directory. It must run a command that takes the definitions from those files and applies them to the iptables package.

I am afraid I don’t have time to have a look at the code myself right now to find out what the command(s) are.

1 Like

OK, thank you. I preferred the variant with the screenshots, it’s easier and doesn’t mess up the system.

1 Like

That is certainly the simplest in terms of ensuring no issues can occur when you don’t want to do a full backup and restore.

Dealing only with taking a copy of some files as a limited backup will always involve some messing around on the system to get it to work and there will be a risk with that process.