Open voidray opened 2 months ago
Hi @voidray ,
The main component of OpenSnitch is the daemon, the GUI is just a frontend to control the daemon. All the functionality is implemented in the daemon.
I would like to have aynthing blocked and then decide what to allow (whitelist).
You can change the DefaultAction to 'deny', well from the GUI (Preferences->Nodes) or well from the configuration: /etc/opensnichd/default-config.json
If the GUI is running, you'll be prompted to allow/deny outbound connections. If it's not running, all outbound connections should be denied.
If the daemon is not running outbound connections are not blocked, that is what my problem is.
ok, but why is it not running? please, post the log /var/log/opensnitchd.log and the output of sudo systemctl status opensnitch
By the way, what distro and opensnitch version are you running?
Also it'll be useful launching it manually to see what's going on:
first be sure that it's not running: $ pgrep opensnitch
(nothing should be printed)
then launch it as root:
~ $ sudo su
~ # /usr/bin/opensnitchd -rules-path /etc/opensnitchd/rules/
To quote from the linked ticket "If the app crashes or even from a delay in launching at boot, all apps are allowed internet access until opensnitch is opened again, which could open up security issues." I'm evaluating OpenSnitch and having to relay on a running service for security is problematic. Besides the mentioned reasons in the references ticket, there also could be for example a installation of a new version during which all traffic would be allowed.
hmm, there could be an option to block all traffic if the daemon is not running under this item https://github.com/evilsocket/opensnitch/blob/14747a04ad4480c4d62e7f4a7c60e5fe02469921/daemon/default-config.json#L18
either by adding a fw rule to block outbound connections, or a module.
For now the service must be running to block outbound connections.
I think @BobSquarePants is trying to accomplish the same behaviour in #1201 @voidray .
Right now there're two options:
table inet myfilter {
chain output {
type route hook output priority mangle; policy drop;
}
}
In both cases you'll need a rule to allow established connections (because we only act on NEW connections):
By doing this, if the daemon dies, new connections will be dropped.
It's possible to configure it from the GUI, but it's disabled right now. If you think @voidray it'd be useful I can enable it.
Anyway, this would be a temporary solution. There're better ways of doing this, like loading a XDP module to allow/deny already approved/denied connections. Although probably it'd interfere with many services of the system (network namespaces, ...)
I changed the /etc/nftables.conf and /etc/opensnitch/system-fw.conf files, but when I stop opensnitchd internet access is still possible. After only changing /etc/nftables.conf all traffic is blocked, but the change in /etc/opensnitch/system-fw.conf allows it somehow again (I rebooted the whole system after the changes). I added the json without any changes in system-fw.conf under "Rules" before the first element (Allow ICMP"). Regarding UI: If it is possible to cover this in the UI that would be helpful.
When stopping the daemon we delete the rules we added. If the're tables configured in /etc/nftables.conf with no rules, named like the ones we create (inet mangle output), we're deleting them. That's probably why it is not working. I'll fix that because we didn't create those tables from /etc/nftables.conf and we should not delete them.
You can try killing the daemon instead of stopping it: killall -9 opensnitchd
I'll enable the option in the GUI, with a warning detailing the implications.
Not sure if this is a bug, but I want to block all connections if the service is not running. I set "DefaultAction": "deny" in /etc/opensnitchd/default-config.json, but this is only applied if the service is running. I would like to have aynthing blocked and then decide what to allow (whitelist). Ideally in the UI I can see what is necessary. The same question was asked here https://github.com/evilsocket/opensnitch/issues/884, but the issue was closed.
Ideally the service wouldn't be needed and the ui would just define the rules. This is how for example SimpleWall works on Windows, where the Windows internal firewall is used. I don't know the internals of OpenSnitch and the firewall concept in Linux to be able to say if that is possible in Linux.