Bug 461726

Summary: The application list in the Plasma Firewall "Add rule" dialog is broken, nothing is shown
Product: [Applications] systemsettings Reporter: thebluequasar
Component: kcm_firewallAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: davmor2, lucas.biaggi, nate, p.r.worrall, tcanabrava, thebluequasar
Priority: NOR    
Version: 5.26.2   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In: 5.27
Sentry Crash Report:
Attachments: application list in the Plasma Firewall "Add rule" dialog is broken
Screen recording

Description thebluequasar 2022-11-12 11:33:39 UTC
Created attachment 153687 [details]
application list in the Plasma Firewall "Add rule" dialog is broken

SUMMARY
In the Add rule dialog of Plasma Firewall in System Settings, clicking the "Application" option doesn't show anything and seems to be broken – See the Attached screenshot

STEPS TO REPRODUCE
1. Open system settings, go to Plasma Firewall section,
2. Click add rule and in the dialog that opens, click the Application option
3. No list of Applications will be shown

OBSERVED RESULT
The application list in the Plasma Firewall "Add rule" dialog is broken, nothing is shown

EXPECTED RESULT
Plasma Firewall should allow for choosing predefined applications in the add rule dialoge

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: KDE Neon User (Jammy based, Ubuntu 22.04)
(available in About System)
KDE Plasma Version: 5.26.2
KDE Frameworks Version: 5.99
Qt Version: 5.15.7
Kernel: 5.15.0-52 generic 64bit
UFW version: 0.36.1-4build1

ADDITIONAL INFORMATION
See the Attached screenshot
Comment 1 Lucas Biaggi 2022-11-17 14:53:35 UTC
Hi thebluequasar@mailo.com, this happens when part of ufw is missing, maybe you need to install an additional package?
Comment 2 Nate Graham 2022-11-18 16:56:53 UTC
.
Comment 3 thebluequasar 2022-11-19 07:44:59 UTC
(In reply to Lucas Biaggi from comment #1)
> Hi thebluequasar@mailo.com, this happens when part of ufw is missing, maybe
> you need to install an additional package?

Hello, do you know what package it might be, more specifically? I've searched and couldn't find any extra or additional packages for UFW on Ubuntu repos. Since this is a fairly new installation of KDE Neon, it sounds a bit unlikely to me that a missing package could be causing this.
Comment 4 Lucas Biaggi 2022-11-19 08:04:38 UTC
(In reply to thebluequasar from comment #3)
> (In reply to Lucas Biaggi from comment #1)
> > Hi thebluequasar@mailo.com, this happens when part of ufw is missing, maybe
> > you need to install an additional package?
> 
> Hello, do you know what package it might be, more specifically? I've
> searched and couldn't find any extra or additional packages for UFW on
> Ubuntu repos. Since this is a fairly new installation of KDE Neon, it sounds
> a bit unlikely to me that a missing package could be causing this.

I really don't know because I don't use Neon, but you could start the firewall module from CLI with "kcmshell5 kcm_firewall" to see what is happening. I still believe something is not right, as we just read info from ufw to fill that dropdown.
Comment 5 thebluequasar 2022-11-19 10:46:06 UTC
(In reply to Lucas Biaggi from comment #4)
> I really don't know because I don't use Neon, but you could start the
> firewall module from CLI with "kcmshell5 kcm_firewall" to see what is
> happening. I still believe something is not right, as we just read info from
> ufw to fill that dropdown.
Thank you. I ran the Plasma Firewall from the terminal with the command you gave, and I pasted the output below. There is also a debug message in there. here is the terminal output:

kcmshell5 kcm_firewall
ufw.client: Ufw is loaded? true
qml: services available:  []
QQmlExpression: Expression file:///usr/share/kpackage/kcms/kcm_firewall/contents/ui/About.qml:22:13 depends on non-NOTIFYable properties:
    FirewallClient::name
QQmlExpression: Expression file:///usr/share/kpackage/kcms/kcm_firewall/contents/ui/SimpleRuleEdit.qml:39:9 depends on non-NOTIFYable properties:
    FirewallClient::name
QQmlExpression: Expression file:///usr/share/kpackage/kcms/kcm_firewall/contents/ui/SimpleRuleEdit.qml:34:9 depends on non-NOTIFYable properties:
    FirewallClient::name
QQmlExpression: Expression file:///usr/share/kpackage/kcms/kcm_firewall/contents/ui/SimpleRuleEdit.qml:22:9 depends on non-NOTIFYable properties:
    FirewallClient::name
ufw.client: Status query starting
ufw.client: Starting the Status Query
file:///usr/share/kpackage/kcms/kcm_firewall/contents/ui/main.qml:139:13: QML ColumnLayout: Cannot anchor to an item that isn't a parent or sibling.
Debug message from helper: Command /usr/lib/x86_64-linux-gnu/libexec/kde_ufw_plugin_helper.py ("--status", "--defaults", "--list", "--modules") "<?xml version=\"1.0\" encoding=\"UTF-8\"?><ufw><status enabled=\"true\" /><defaults incoming=\"deny\" outgoing=\"allow\" loglevel=\"low\" ipv6=\"yes\" /><rules><rule position=\"0\" action=\"allow\" direction=\"in\" dapp=\"\" sapp=\"\" dport=\"1714:1764\" sport=\"any\" protocol=\"udp\" dst=\"0.0.0.0/0\" src=\"192.168.1.0/24\" interface_in=\"\" interface_out=\"\" v6=\"False\" logtype=\"\" /><rule position=\"0\" action=\"allow\" direction=\"in\" dapp=\"\" sapp=\"\" dport=\"1714:1764\" sport=\"any\" protocol=\"tcp\" dst=\"0.0.0.0/0\" src=\"192.168.1.0/24\" interface_in=\"\" interface_out=\"\" v6=\"False\" logtype=\"\" /><rule position=\"0\" action=\"allow\" direction=\"in\" dapp=\"Samba\" sapp=\"\" dport=\"137,138\" sport=\"any\" protocol=\"udp\" dst=\"0.0.0.0/0\" src=\"192.168.0.0/16\" interface_in=\"\" interface_out=\"\" v6=\"False\" logtype=\"\" /></rules><modules enabled=\"\" /></ufw>\n"
ufw.client: Status Query finished, setting the profile
ufw.client: Profile Received, Setting the profile on the model
Profile on the model received. enabled?  true
ufw.client: Setting the known applications to ()
qml: services available:  []


Hope this is useful. Please let me know if there are any other commands I could run or other things to try, to generate more information and post the results.
Comment 6 Paul Worrall 2022-11-21 10:00:13 UTC
ufw lists available applications but the firewall kcm does not:

paul@desktop:~$ sudo ufw app list
Available applications:
  CUPS
  OpenSSH

paul@desktop:~$ sudo /usr/lib/x86_64-linux-gnu/libexec/kde_ufw_plugin_helper.py --list
<?xml version="1.0" encoding="UTF-8"?><ufw><rules></rules></ufw>
Comment 7 Lucas Biaggi 2022-11-24 20:28:36 UTC
In reply to Paul Worrall from comment #6)
> ufw lists available applications but the firewall kcm does not:
> 
> paul@desktop:~$ sudo ufw app list
> Available applications:
>   CUPS
>   OpenSSH
> 
> paul@desktop:~$ sudo
> /usr/lib/x86_64-linux-gnu/libexec/kde_ufw_plugin_helper.py --list
> <?xml version="1.0" encoding="UTF-8"?><ufw><rules></rules></ufw>

we don't use the helper to retrieve the list, as you can see here: https://invent.kde.org/plasma/plasma-firewall/-/blob/master/kcm/backends/ufw/helper/helper.cpp#L107-130

I tried to replicate this behaviour and I couldn't obtain the same result.

Can you try a live ISO with KDE? 

My ufw version
ufw 0.36.1
Copyright 2008-2018 Canonical Ltd.

What is yours?
Comment 8 Lucas Biaggi 2022-11-24 20:29:34 UTC
(In reply to Lucas Biaggi from comment #7)
> In reply to Paul Worrall from comment #6)
> > ufw lists available applications but the firewall kcm does not:
> > 
> > paul@desktop:~$ sudo ufw app list
> > Available applications:
> >   CUPS
> >   OpenSSH
> > 
> > paul@desktop:~$ sudo
> > /usr/lib/x86_64-linux-gnu/libexec/kde_ufw_plugin_helper.py --list
> > <?xml version="1.0" encoding="UTF-8"?><ufw><rules></rules></ufw>
> 
> we don't use the helper to retrieve the list, as you can see here:
> https://invent.kde.org/plasma/plasma-firewall/-/blob/master/kcm/backends/ufw/
> helper/helper.cpp#L107-130
> 
> I tried to replicate this behaviour and I couldn't obtain the same result.
> 
> Can you try a live ISO with KDE? 
> 
> My ufw version
> ufw 0.36.1
> Copyright 2008-2018 Canonical Ltd.
> 
> What is yours?
Ops,
helper == the python script.
Comment 9 Paul Worrall 2022-11-25 12:07:15 UTC
Created attachment 154018 [details]
Screen recording

Sorry, I realised it wasn't the python script soon after posting my last comment.

I have reproduced the problem using the latest iso of KDE Neon User Edition (neon-user-20221117-0714.iso), please let me know it there's another distro you'd like me to try.

Also, I'm able to try changes to the code if you want me to try something. 

ufw --version gives:
ufw 0.36.1
Copyright 2008-2021 Canonical Ltd.

I attach a video showing what I'm doing in case it's any help
Comment 10 Lucas Biaggi 2022-12-06 11:14:58 UTC
(In reply to Paul Worrall from comment #9)
> Created attachment 154018 [details]
> Screen recording
> 
> Sorry, I realised it wasn't the python script soon after posting my last
> comment.
> 
> I have reproduced the problem using the latest iso of KDE Neon User Edition
> (neon-user-20221117-0714.iso), please let me know it there's another distro
> you'd like me to try.
> 
> Also, I'm able to try changes to the code if you want me to try something. 
> 
> ufw --version gives:
> ufw 0.36.1
> Copyright 2008-2021 Canonical Ltd.
> 
> I attach a video showing what I'm doing in case it's any help

Okay, I downloaded the same image and was able to reproduce it, I'll start working to find a fix to that, but at the first glance, it shouldn't change it behaviour. Since it just collects the output from “ufw app list”.

Can you test it in another distro (don't need to be arch-based, but one that doesn't use Ubuntu as it)? The major diff identified is the app list, which is drastically different.
Comment 11 Bug Janitor Service 2022-12-09 16:59:53 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-firewall/-/merge_requests/59