gustavo-iniguez-goya / opensnitch

OpenSnitch is a GNU/Linux application firewall
GNU General Public License v3.0
394 stars 20 forks source link

Opensnitch.d fails with code=exited, status=2 #88

Closed xtc0r closed 3 years ago

xtc0r commented 3 years ago

Describe the bug Opensnitch.d fails starting it with systemctl.

To Reproduce

Using AUR package from : https://aur.archlinux.org/packages/opensnitch-git Version: opensnitch-git 1.2.0.r0.6a8670c-1

Steps to reproduce the behavior:

  1. Install opensnitch-git 1.2.0.r0.6a8670c-1 from https://aur.archlinux.org/packages/opensnitch-git
  2. sudo systemctl start opensnitchd
  3. Check status: sudo systemctl status opensnitchd
  4. See error:

opensnitchd.service - OpenSnitch is a GNU/Linux port of the Little Snitch application firewall. Loaded: loaded (/usr/lib/systemd/system/opensnitchd.service; enabled; vendor preset: disabled) Active: activating (auto-restart) (Result: exit-code) since Sat 2020-11-14 14:02:19 CET; 14s ago Docs: https://github.com/gustavo-iniguez-goya/opensnitch/wiki Process: 8159 ExecStartPre=/bin/mkdir -p /etc/opensnitchd/rules (code=exited, status=0/SUCCESS) Process: 8160 ExecStart=/usr/bin/opensnitchd -rules-path /etc/opensnitchd/rules (code=exited, status=2) Main PID: 8160 (code=exited, status=2)

Expected behavior opensnitch.d starts and does not exit

OS (please complete the following information): OS: 5.4.74-1-MANJARO #1 SMP PREEMPT Sun Nov 1 13:43:13 UTC 2020 x86_64 GNU/Linux

xtc0r commented 3 years ago

Only happens for me after updating to the latest version. Before it worked fine.

gustavo-iniguez-goya commented 3 years ago

ouch, can you post the following files?

Additionaly, launch it from a terminal as root:

/usr/bin/opensnitchd -rules-path /etc/opensnitchd/rules -debug And see it fails. If it does, post the messages here.

Thank you!

xtc0r commented 3 years ago

Hi,

thanks for the reply. See the logs below. Let me know if you want me to check something else.

/var/log/opensnitchd.log

[2020-11-14 16:21:58] IMP Start writing logs to %!(EXTRA string=/var/log/opensnitchd.log) [2020-11-14 16:21:58] ERR Error parsing firewall configuration /etc/opensnitchd/system-fw.json: unexpected end of JSON input [2020-11-14 16:22:28] IMP Start writing logs to %!(EXTRA string=/var/log/opensnitchd.log) [2020-11-14 16:22:28] ERR Error parsing firewall configuration /etc/opensnitchd/system-fw.json: unexpected end of JSON input [2020-11-14 16:22:58] IMP Start writing logs to %!(EXTRA string=/var/log/opensnitchd.log) [2020-11-14 16:22:58] ERR Error parsing firewall configuration /etc/opensnitchd/system-fw.json: unexpected end of JSON input

/etc/opensnitchd/default-config.json

{ "Server": { "Address":"unix:///tmp/osui.sock", "LogFile":"/var/log/opensnitchd.log" } "DefaultAction": "allow", "DefaultDuration": "once", "InterceptUnknown": false, "ProcMonitorMethod": "proc", "LogLevel": 2 }

/usr/bin/opensnitchd -rules-path /etc/opensnitchd/rules -debug

2020-11-14 16:27:04] DBG Worker #6 started. panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x55655ddbf358]

goroutine 118 [running]: github.com/gustavo-iniguez-goya/opensnitch/daemon/firewall.StartCheckingRules(0x0) github.com/gustavo-iniguez-goya/opensnitch/daemon/firewall/rules.go:219 +0x38 created by github.com/gustavo-iniguez-goya/opensnitch/daemon/firewall.Init github.com/gustavo-iniguez-goya/opensnitch/daemon/firewall/rules.go:292 +0x89

gustavo-iniguez-goya commented 3 years ago

Does the file /etc/opensnitchd/system-fw.json exist? If not, copy this one https://github.com/gustavo-iniguez-goya/opensnitch/blob/main/daemon/system-fw.json to /etc/opensnitchd/system-fw.json and try to launch it again.

If it already exists, please, paste the content.

xtc0r commented 3 years ago

The file did not exist. I creaed it and it starts now. I only get an error now that the daemon uses 1.3.0rc1 and the UI is only 1.2.0. But it seems to work now. Thanks!

image

gustavo-iniguez-goya commented 3 years ago

great, the message is ok, because I've not updated the GUI yet. The maintainer of the AUR package has packaged latest sources, which I don't expect them to be stable for now.

He or she should distribute with the AUR package the file system-fw.json, so I guess someone should tell her/him about it.

Anyway, we shouldn't fail if the system-fw.json does not exist, or if it's invalid. I'll fix it soon.

xtc0r commented 3 years ago

Thanks for the support. I left a comment for the package maintainer