Wednesday, February 25, 2009

Editing ufw order

One thing I noticed about the Ubuntu Firewall, or the Uncomplicated Firewall is that it adds new rules to the bottom of the existing ones by default, and that there is no way -at least I didn't found one- of flushing or zeroing the rules, and reloading from the CLI, in order to reload the new ones.

What I did to change the order of the rules is edit the file

'/var/lib/ufw/user.rules'

arrange the rules the way I want them -the more general ones on top, for instance- and then, issue a:

sudo ufw reload


In order to clear the rules, and reload (doh!) them in the new order as defined on the newly edited 'user.rules' file.

Labels: , , ,

2 Comments:

Anonymous PaulW said...

(I know this is an old post but I was looking for a way to reorder rules and found it)

Here's what I do now...

ufw status numbered

Shows your rules with numbers in brackets to the left.

You can insert a rule anywhere in the list by using a command like...

ufw insert 5 deny from 114.43.46.137

Which would insert the deny rule for that IP in position 5, pushing all the other rules down one

2:50 PM  
Blogger hictio said...

Hey! Thanks.
Yes, its an old post, but a comment it is always welcomed.

2:33 AM  

Post a Comment

<< Home