costales / gufw

Linux Firewall
GNU General Public License v3.0
139 stars 32 forks source link

Profiles are reset after deactivated #61

Closed nerun closed 1 year ago

nerun commented 1 year ago

Related to issues #25 (closed) and #54 (open), also PR #55 (closed without merge).

I have the same problem. All my rules were added by GUFW, they all have custom names. But as soon as I disable GUFW and reactivate it, all the rules become immutable, as if they were created by UFW and not by GUFW.

I think this is a bug, not an issue in my system or corrupted files.

I have tested here:

  1. I made a backup of my gufw profile: sudo cp /etc/gufw/Início.profile /etc/gufw/Início.profile.bak
  2. Disabled and reactivated gufw: all rules become immutable as if they were created by UFW.
  3. Disabled gufw again.
  4. Restored profile backup: sudo cp /etc/gufw/Início.profile.bak /etc/gufw/Início.profile
  5. Enabled gufw again: now all the rules are gufw and i can edit them again.

Look at this screenshot. Before disable GUFW and after reactivate it. The sizes changes. Profile is reseted!

Captura de tela de 2023-07-10 10-57-41

I have tested to create a custom profile: Daniel.profile. But the problem allways happens.

Any profile is reseted once disabled.

Also, PR #55 fixed this issue, but was closed without merge and any discussion.

nerun commented 1 year ago

My permissions are: folders = 755, files = 644.

$ exa -l --tree --octal-permissions --group-directories-first --no-time /usr/share/gufw
0755 drwxr-xr-x    - root /usr/share/gufw
0755 drwxr-xr-x    - root ├── gufw
0755 drwxr-xr-x    - root │  ├── __pycache__
0644 .rw-r--r--  125 root │  │  ├── __init__.cpython-310.pyc
0644 .rw-r--r--  391 root │  │  └── gufw.cpython-310.pyc
0755 drwxr-xr-x    - root │  ├── gufw
0755 drwxr-xr-x    - root │  │  ├── __pycache__
0644 .rw-r--r--  130 root │  │  │  ├── __init__.cpython-310.pyc
0644 .rw-r--r--  616 root │  │  │  ├── controller.cpython-310.pyc
0644 .rw-r--r-- 3,0k root │  │  │  └── instance.cpython-310.pyc
0755 drwxr-xr-x    - root │  │  ├── model
0755 drwxr-xr-x    - root │  │  │  ├── __pycache__
0644 .rw-r--r--  136 root │  │  │  │  ├── __init__.cpython-310.pyc
0644 .rw-r--r--  11k root │  │  │  │  ├── firewall.cpython-310.pyc
0644 .rw-r--r-- 4,7k root │  │  │  │  ├── frontend.cpython-310.pyc
0644 .rw-r--r--  11k root │  │  │  │  └── ufw_backend.cpython-310.pyc
0644 .rw-r--r--   24 root │  │  │  ├── __init__.py
0644 .rw-r--r--  19k root │  │  │  ├── firewall.py
0644 .rw-r--r-- 3,8k root │  │  │  ├── frontend.py
0644 .rw-r--r--  19k root │  │  │  └── ufw_backend.py
0755 drwxr-xr-x    - root │  │  ├── view
0755 drwxr-xr-x    - root │  │  │  ├── __pycache__
0644 .rw-r--r--  135 root │  │  │  │  ├── __init__.cpython-310.pyc
0644 .rw-r--r--  911 root │  │  │  │  ├── about.cpython-310.pyc
0644 .rw-r--r--  18k root │  │  │  │  ├── add.cpython-310.pyc
0644 .rw-r--r--  25k root │  │  │  │  ├── gufw.cpython-310.pyc
0644 .rw-r--r-- 2,7k root │  │  │  │  ├── listening.cpython-310.pyc
0644 .rw-r--r-- 6,3k root │  │  │  │  ├── preferences.cpython-310.pyc
0644 .rw-r--r-- 8,8k root │  │  │  │  └── update.cpython-310.pyc
0644 .rw-r--r--   24 root │  │  │  ├── __init__.py
0644 .rw-r--r-- 1,3k root │  │  │  ├── about.py
0644 .rw-r--r--  28k root │  │  │  ├── add.py
0644 .rw-r--r--  39k root │  │  │  ├── gufw.py
0644 .rw-r--r-- 4,8k root │  │  │  ├── listening.py
0644 .rw-r--r-- 8,5k root │  │  │  ├── preferences.py
0644 .rw-r--r--  13k root │  │  │  └── update.py
0644 .rw-r--r--   24 root │  │  ├── __init__.py
0644 .rw-r--r--  942 root │  │  ├── controller.py
0644 .rw-r--r-- 3,7k root │  │  └── instance.py
0644 .rw-r--r--   24 root │  ├── __init__.py
0644 .rw-r--r-- 1,1k root │  └── gufw.py
0755 drwxr-xr-x    - root ├── media
0755 drwxr-xr-x    - root │  ├── shields
0644 .rw-r--r-- 8,0k root │  │  ├── allow_allow_allow.png
0644 .rw-r--r-- 8,0k root │  │  ├── allow_allow_deny.png
0644 .rw-r--r-- 7,3k root │  │  ├── allow_allow_disabled.png
0644 .rw-r--r-- 8,0k root │  │  ├── allow_allow_reject.png
0644 .rw-r--r-- 8,0k root │  │  ├── allow_deny_allow.png
0644 .rw-r--r-- 8,0k root │  │  ├── allow_deny_deny.png
0644 .rw-r--r-- 7,3k root │  │  ├── allow_deny_disabled.png
0644 .rw-r--r-- 8,0k root │  │  ├── allow_deny_reject.png
0644 .rw-r--r-- 8,0k root │  │  ├── allow_reject_allow.png
0644 .rw-r--r-- 7,9k root │  │  ├── allow_reject_deny.png
0644 .rw-r--r-- 7,3k root │  │  ├── allow_reject_disabled.png
0644 .rw-r--r-- 7,9k root │  │  ├── allow_reject_reject.png
0644 .rw-r--r-- 8,0k root │  │  ├── deny_allow_allow.png
0644 .rw-r--r-- 8,0k root │  │  ├── deny_allow_deny.png
0644 .rw-r--r-- 7,4k root │  │  ├── deny_allow_disabled.png
0644 .rw-r--r-- 8,0k root │  │  ├── deny_allow_reject.png
0644 .rw-r--r-- 8,0k root │  │  ├── deny_deny_allow.png
0644 .rw-r--r-- 7,9k root │  │  ├── deny_deny_deny.png
0644 .rw-r--r-- 7,3k root │  │  ├── deny_deny_disabled.png
0644 .rw-r--r-- 8,0k root │  │  ├── deny_deny_reject.png
0644 .rw-r--r-- 8,0k root │  │  ├── deny_reject_allow.png
0644 .rw-r--r-- 7,9k root │  │  ├── deny_reject_deny.png
0644 .rw-r--r-- 7,3k root │  │  ├── deny_reject_disabled.png
0644 .rw-r--r-- 8,0k root │  │  ├── deny_reject_reject.png
0644 .rw-r--r-- 3,8k root │  │  ├── disabled_disabled_disabled.png
0644 .rw-r--r-- 6,6k root │  │  ├── disabled_disabled_enabled.png
0644 .rw-r--r-- 8,0k root │  │  ├── reject_allow_allow.png
0644 .rw-r--r-- 8,0k root │  │  ├── reject_allow_deny.png
0644 .rw-r--r-- 7,3k root │  │  ├── reject_allow_disabled.png
0644 .rw-r--r-- 8,0k root │  │  ├── reject_allow_reject.png
0644 .rw-r--r-- 8,0k root │  │  ├── reject_deny_allow.png
0644 .rw-r--r-- 8,0k root │  │  ├── reject_deny_deny.png
0644 .rw-r--r-- 7,3k root │  │  ├── reject_deny_disabled.png
0644 .rw-r--r-- 8,0k root │  │  ├── reject_deny_reject.png
0644 .rw-r--r-- 7,9k root │  │  ├── reject_reject_allow.png
0644 .rw-r--r-- 7,9k root │  │  ├── reject_reject_deny.png
0644 .rw-r--r-- 7,2k root │  │  ├── reject_reject_disabled.png
0644 .rw-r--r-- 7,9k root │  │  └── reject_reject_reject.png
0755 drwxr-xr-x    - root │  └── tutorial
0755 drwxr-xr-x    - root │     ├── css
0644 .rw-r--r--  800 root │     │  └── index.css
0755 drwxr-xr-x    - root │     ├── images
0644 .rw-r--r--  31k root │     │  ├── 1.png
0644 .rw-r--r--  43k root │     │  ├── 2.png
0644 .rw-r--r--  52k root │     │  ├── 3.png
0644 .rw-r--r--  540 root │     │  └── background.jpg
0644 .rw-r--r-- 1,4k root │     └── index.html
0755 drwxr-xr-x    - root ├── ui
0644 .rw-r--r--  36k root │  ├── about.ui
0644 .rw-r--r--  60k root │  ├── add.ui
0644 .rw-r--r--  46k root │  ├── gufw.ui
0644 .rw-r--r--  24k root │  ├── preferences.ui
0644 .rw-r--r--  30k root │  └── update.ui
0644 .rw-r--r--  580 root └── gufw-22.04.0.egg-info
nerun commented 1 year ago

Uh, permissions to /etc/gufw are different. Files are 600 not 644.

$ exa -l --tree -L1 --octal-permissions --group-directories-first --no-time /etc/gufw
0755 drwxr-xr-x    - root /etc/gufw
0755 drwxr-xr-x    - root ├── app_profiles
0600 .rw------- 1,4k root ├── Daniel.profile
0600 .rw------- 1,4k root ├── Daniel.profile.bak
0600 .rw-------   76 root ├── Escritório.profile
0600 .rw-------   94 root ├── gufw.cfg
0600 .rw-------   80 root ├── Início.profile
0600 .rw-------   78 root └── Público.profile

While /etc/ufw are 640 for files (and rules):

╘⋟ exa -l --tree -L1 --octal-permissions --group-directories-first --no-time /etc/ufw 
0755 drwxr-xr-x    - root /etc/ufw
0755 drwxr-xr-x    - root ├── applications.d
0640 .rw-r----- 1,1k root ├── after.init
0640 .rw-r----- 1,0k root ├── after.rules
0640 .rw-r-----  915 root ├── after6.rules
0640 .rw-r----- 1,1k root ├── before.init
0640 .rw-r----- 2,5k root ├── before.rules
0640 .rw-r----- 6,7k root ├── before6.rules
0644 .rw-r--r-- 1,4k root ├── sysctl.conf
0644 .rw-r--r--  313 root ├── ufw.conf
0640 .rw-r----- 1,6k root ├── user.rules
0640 .rw-r----- 1,5k root └── user6.rules
nerun commented 1 year ago

Change profile permissions in /etc/gufw from 600 to 640 or 644 don't fix the issue.

costales commented 1 year ago

Hi, thank for your feedback! Is this PR fixing it? https://github.com/costales/gufw/pull/55

nerun commented 1 year ago

Hi, thank for your feedback! Is this PR fixing it? #55

Yes, it is. I am using this in my system.

costales commented 1 year ago

This will be fixed in next release (24.04). Thank you for your feedback!!