UFW export and import rules between different servers

Asked by Pablo Pazos

I can't find how to export and import rules for different servers. It's a basic functionality I would expect UFW to have since many of us manage different servers and most of the rules for blocking traffic are the same.

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu ufw Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Bernard Stafford (bernard010) said :
#1
Revision history for this message
Pablo Pazos (ppazos) said :
#2

That link shows how to export and overwrite the whole IP tables, not just the rules added by a user via UFW.

1. I want to migrate only the rules added via UFW
2. I don't want to overwrite any existing rules in iptables when importing

There is now UFW command AFAIK that actually does that.

Revision history for this message
Bernard Stafford (bernard010) said :
#3

Rules are located:
/etc/ufw/user.rules
ipv6 - /etc/ufw/user6.rules

Copy the rules between servers. Disable UFW add rules then Enable UFW.
sudo ufw disable - Add rules - sudo ufw enable
Check status : sudo ufw status verbose

Can you help with this problem?

Provide an answer of your own, or ask Pablo Pazos for more information if necessary.

To post a message you must log in.