evilsocket / opensnitch

OpenSnitch is a GNU/Linux interactive application firewall inspired by Little Snitch.
GNU General Public License v3.0
10.91k stars 509 forks source link

Display Managers don't start and logout issues. #318

Closed sylkat closed 3 years ago

sylkat commented 3 years ago

Hi, First of all, congrats for the great app i believe is so useful for some scenarios.

The display managers don't start if the opensnitch daemon is up, which is happening at least on my Debian system. I've tried different dm as sddm, ligthdm, all of them refused to start.

To reproduce this bug i just had to install the last release package of debian:

opensnitch_1.3.0-1_amd64.deb

And enabling it with: systemctl enable opensnitch

The system will hang without showing the display manager.

Once fixed that, i have some other issues with the display managers logout.

I see that starting the opensnitch service after the Display Service i can bypass this issue and start these Desktop Managers:

These are the ones that i have and all are working well until the logout happens.

In any of those environments the coming back to the Display Manager either ligthdm or sddm will give us a hang login screen again due to the impossibility to kill the ui process:

/usr/bin/python3 /usr/bin/opensnitch-ui

I saw a process trying to kill the ui, not sure if is due to the window manager logout or the ui code try to catch the signal or the daemon, i didn't see the code deeply and i prefer to ask before going to it, was something like:

pkill -15 PID;opensnitch-ui

Looks like a window manager way to kill their own started apps, but not sure at all due to the last 'opensnitch-ui' command after the ";"

All of them kde plasma, xfce4 and cinammon didn't leave the session cleanly due to this process still there, very strange, but this happens to me.

So kill the process will let the Display Manager go the login screen again.

Sddm has not a feature to launch scripts as root when the login session starts or logout, but ligthdm does and is easy to add some fixing for this bug in my environment...but could be nice to see whats going and why the daemon interferes with them.

So creating a start script of session, starting the service will fix the log in issue after a logout.

And creating a second script when the logout session, stopping the service and killing the ui will fix the return back to the Display Manager login screen.

All this worked for xfce4 and cinammon, Plasma refuse to log in after one logout, with daemon started or not, it keeps that environment not accessible until a restart of the box, ive tried to:

Even doing all of that, was for me impossible to start again a Plasma session once i did a logout from it, only a reboot made me log in again to plasma.

gustavo-iniguez-goya commented 3 years ago

hey @sylkat

The display managers don't start if the opensnitch daemon is up, which is happening at least on my Debian system.

I haven't ran into this problem (yet).

The system will hang without showing the display manager.

Can you reproduce this problem again and post the output of journalctl -ar --since=today? . Also set the log level to DEBUG (preferences -> nodes -> defult log level), and post the log /var/log/opensnitchd.log

I guess that the daemon DefaultAction is allow in /etc/opensnitchd/default-action.json.

In any of those environments the coming back to the Display Manager either ligthdm or sddm will give us a hang login screen again due to the impossibility to kill the ui process:

I'm aware of this problem on KDE, but in my case it only prevents to reboot the system the first time you click on logout/shutdown/reboot. If I click again then it exits as expected.

gustavo-iniguez-goya commented 3 years ago

related: https://github.com/gustavo-iniguez-goya/opensnitch/issues/15#issuecomment-626818706

gustavo-iniguez-goya commented 3 years ago

@sylkat can you modify /usr/lib/python3/dist-packages/dialogs/stats.py and let me know if this change solves the problem?

change e.ignore() (line 1167) by e.accept()

that solves the problem in my case.

gustavo-iniguez-goya commented 3 years ago

@sylkat , I think the above change fixes the problem logging out. Regarding the problems when booting up the system, could you add this rule to /etc/opensnitchd/rules/ and see if it solves the problem? 000-allow-system-commands.txt

rename it to .json (github does not allow to upload .json files): sudo mv 000-allow-system-commands.txt /etc/opensnitchd/rules/000-allow-system-commands.json

[edit] or simpler, create a rule to allow everything to localhost -> "To this IP: 127.0.0.1"

gustavo-iniguez-goya commented 3 years ago

I consider this issue fixed. If you test it and it still doesn't work reopen it please.