Copy UFW rules between servers

Solution 1:

I found the rules in /etc/ufw/user.rules and for ipv6 you can find the rules in /etc/ufw/user6.rules.

If you copy those files between the servers, disable and then re-enable ufw.

Solution 2:

User configurations for UFW should be in /etc/ufw. You are not supposed to modify files in /lib nor /usr/lib nor any other similar locations, because your modifications might get overwritten by the vendor's default version after the packages upgraded.

From Ubuntu 16.04:

ls /etc/ufw

after6.rules applications.d before.rules user6.rules
after.init before6.rules sysctl.conf user.rules
after.rules before.init ufw.conf

Tags:

Firewall

Ufw