4

I've been messing around writing different application profiles for Ufw to get it to work properly, but I can't figure out how to completely and correctly remove an application profile that I previously added with sudo ufw allow [application profile].

I've even tried uninstallning (sudo apt purge ufw) and reinstalling and this removes everything in /etc/ufw except the applications.d dir, so no settings could be lurking in /etc/ufw. I have also removed the actual profile file from the applications.d dir, but still every time I run:

$ sudo ufw status verbose

I get

WARN: Skipping '[profile I removed]': field too long

However the firewall settings in the removed profile is deactivated as they should as of the output from sudo ufw status verbose.

  • sudo apt purge ufw deletes the ufw package from your system. Surely this was not your intent. sudo apt install ufw, then read man ufw, especially about sudo ufw delete .... – waltinator Apr 04 '20 at 04:53
  • Thanks for you comment! Sorry, I was unclear (edited now), I meant to explain that even a reinstall of Ufw, and checking that the /etc/ufw dir was emptied didn't help. – PetaspeedBeaver Apr 05 '20 at 19:33

2 Answers2

4

You can delete application profiles in the same way you delete regular rules.

  1. Get a list of the current rules:

    $ ufw status numbered
    Status: active
    
    To                         Action      From
    --                         ------      ----
    

    [1] OpenSSH ALLOW IN Anywhere [2] mosh ALLOW IN Anywhere

  2. Delete the rule by using the corresponding ID inside []

    $ ufw delete 2
    Deleting:
     allow 'mosh'
    Proceed with operation (y|n)?
    
Error404
  • 7,440
jbourne
  • 41
1

You may use this syntax:

sudo ufw delete <action> <application>

For instance,

sudo ufw delete allow openssh