Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connections are always allowed after 5 seconds (GUI DefaultAction: Reject) #1017

Closed
markozajc opened this issue Aug 15, 2023 · 14 comments
Closed

Comments

@markozajc
Copy link
Contributor

Describe the bug
Opensnitch UI shows a pop-up asking for the action to take whenever the intercepted request doesn't match a rule. Regardless of my "Default timeout" and "Default options" settings, connections are let through if I don't reject or accept them in the popup.

gifine.mp4

If I reject it before 5 seconds elapse, the connection fails as expected

gifine2.mp4

Include the following information:

  • OpenSnitch version: 1.6.2
  • OS: Debian GNU/Linux
  • Version: Trixie/testing
  • Window Manager: KDE
  • Kernel version: Linux dell 6.4.0-2-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.4.4-3 (2023-08-08) x86_64 GNU/Linux

To Reproduce
Describe in detail as much as you can what happened.

Steps to reproduce the behavior:

  1. Make sure no rules exist for a program (for example curl)
  2. Set "Default timeout" to more than 5 seconds
  3. Make a request with the program (eg. curl zajc.eu.org)
  4. Wait 5 seconds and don't click anything in the popup
  5. The program will successfully make the request

Expected behavior (optional)
The connection should not be accepted without accepting it in the popup first.

Additional context
The connection is not shown in the logs until I click something in the popup. If I click "Reject", it's shown as rejected in the logs, even if it wasn't actually rejected.

@gustavo-iniguez-goya
Copy link
Collaborator

Hi @markozajc !

What's the Default Action of the daemon?

GUI -> Preferences -> Node -> Default Action
or
DefaultAction in /etc/opensnitchd/default-action.json

If it's Allow, change it to Deny please and try to reproduce it again.

@markozajc
Copy link
Contributor Author

markozajc commented Aug 15, 2023

Hi! My default action is already set to deny.

@gustavo-iniguez-goya
Copy link
Collaborator

ok, I guess you'll have a rule to allow the DNS resolver (systemd-resolved, dnsmasq, ..).

Please, modify it to allow connections only to port 53 + the DNS nameservers.

@markozajc
Copy link
Contributor Author

I have done that, and curl still makes the request successfully. I don't see any successful requests in the events tab of the UI when that happens.

@markozajc
Copy link
Contributor Author

I have tried disabling all of my rules, and the same thing happens.

@gustavo-iniguez-goya
Copy link
Collaborator

ok, then set LogLevel to DEBUG under Preferences->Nodes

empty the log file: ~ $ sudo truncate -s0 /var/log/opensnitchd.log
and reproduce the issue.

Let's see if we can see with the logs what's going on.

@markozajc
Copy link
Contributor Author

markozajc commented Aug 15, 2023

Here are the logs:
I run curl at 16:25:05, and it makes the request at 16:25:10, five seconds later.

[2023-08-15 16:25:00]  IMP  Start writing logs to /var/log/opensnitchd.log
[2023-08-15 16:25:00]  DBG  [eBPF] trying to load /usr/local/lib/opensnitchd/ebpf/opensnitch.o
[2023-08-15 16:25:00]  DBG  [eBPF] trying to load /usr/lib/opensnitchd/ebpf/opensnitch.o
[2023-08-15 16:25:00]  INF  [eBPF] module loaded: /usr/lib/opensnitchd/ebpf/opensnitch.o
[2023-08-15 16:25:00]  DBG  [eBPF] trying to load /usr/local/lib/opensnitchd/ebpf/opensnitch-procs.o
[2023-08-15 16:25:00]  DBG  [eBPF] trying to load /usr/lib/opensnitchd/ebpf/opensnitch-procs.o
[2023-08-15 16:25:00]  INF  [eBPF] module loaded: /usr/lib/opensnitchd/ebpf/opensnitch-procs.o
[2023-08-15 16:25:00]  DBG  new pid lookup took (-1): 15.68501ms
[2023-08-15 16:25:00]  DBG  new pid lookup took (11052): 13.958551ms
[2023-08-15 16:25:00]  DBG  new pid lookup took (15200): 12.424292ms
[2023-08-15 16:25:00]  DBG  new pid lookup took (15181): 14.353188ms
[2023-08-15 16:25:00]  DBG  new pid lookup took (16066): 7.563827ms
[2023-08-15 16:25:00]  DBG  Socket found in known pids 399.065µs, pid: 11052, inode: 19303, pos: 3, pids in cache: 4
[2023-08-15 16:25:00]  DBG  Socket found in known pids 157.751µs, pid: 16066, inode: 325121, pos: 1, pids in cache: 4
[2023-08-15 16:25:00]  DBG  Socket found in known pids 441.748µs, pid: 15200, inode: 45090, pos: 3, pids in cache: 4
[2023-08-15 16:25:00]  INF  Process monitor method ebpf
[2023-08-15 16:25:00]  DBG  local addr: 127.0.0.1/8 lo
[2023-08-15 16:25:00]  DBG  local addr: 192.168.1.17/24 eno1
[2023-08-15 16:25:00]  DBG  local addr: ::1/128
[2023-08-15 16:25:00]  INF  Stats, max events: 25, max stats: 150, max workers: 6
[2023-08-15 16:25:00]  DBG  Starting 16 workers ...
[2023-08-15 16:25:00]  DBG  Worker #4 started.
[2023-08-15 16:25:00]  DBG  Worker #6 started.
[2023-08-15 16:25:00]  DBG  Worker #7 started.
[2023-08-15 16:25:00]  DBG  Stats worker #1 started.
[2023-08-15 16:25:00]  DBG  Stats worker #4 started.
[2023-08-15 16:25:00]  DBG  Worker #5 started.
[2023-08-15 16:25:00]  DBG  Worker #9 started.
[2023-08-15 16:25:00]  DBG  Stats worker #2 started.
[2023-08-15 16:25:00]  DBG  Worker #12 started.
[2023-08-15 16:25:00]  DBG  Stats worker #5 started.
[2023-08-15 16:25:00]  DBG  Worker #0 started.
[2023-08-15 16:25:00]  DBG  Worker #10 started.
[2023-08-15 16:25:00]  DBG  Stats worker #3 started.
[2023-08-15 16:25:00]  DBG  Worker #1 started.
[2023-08-15 16:25:00]  DBG  Worker #11 started.
[2023-08-15 16:25:00]  DBG  Worker #13 started.
[2023-08-15 16:25:00]  DBG  Worker #3 started.
[2023-08-15 16:25:00]  DBG  Worker #8 started.
[2023-08-15 16:25:00]  DBG  Worker #15 started.
[2023-08-15 16:25:00]  DBG  Worker #2 started.
[2023-08-15 16:25:00]  DBG  Stats worker #0 started.
[2023-08-15 16:25:00]  DBG  Worker #14 started.
[2023-08-15 16:25:00]  INF  nftables config changed, reloading
[2023-08-15 16:25:00]  INF  fw configuration loaded
[2023-08-15 16:25:00]  DBG  nftables: backing up existing chain with policy ACCEPT: PREROUTING, mangle
[2023-08-15 16:25:00]  DBG  nftables: backing up existing chain with policy ACCEPT: INPUT, mangle
[2023-08-15 16:25:00]  DBG  nftables: backing up existing chain with policy ACCEPT: FORWARD, mangle
[2023-08-15 16:25:00]  DBG  nftables: backing up existing chain with policy ACCEPT: OUTPUT, mangle
[2023-08-15 16:25:00]  DBG  nftables: backing up existing chain with policy ACCEPT: POSTROUTING, mangle
[2023-08-15 16:25:00]  DBG  nftables: backing up existing chain with policy ACCEPT: FORWARD, filter
[2023-08-15 16:25:00]  DBG  nftables: backing up existing chain with policy ACCEPT: OUTPUT, filter
[2023-08-15 16:25:00]  DBG  nftables: backing up existing chain with policy ACCEPT: PREROUTING, nat
[2023-08-15 16:25:00]  DBG  nftables: backing up existing chain with policy ACCEPT: INPUT, nat
[2023-08-15 16:25:00]  DBG  nftables: backing up existing chain with policy ACCEPT: OUTPUT, nat
[2023-08-15 16:25:00]  DBG  nftables: backing up existing chain with policy ACCEPT: POSTROUTING, nat
[2023-08-15 16:25:00]  DBG  nftables: backing up existing chain with policy ACCEPT: PREROUTING, mangle
[2023-08-15 16:25:00]  DBG  nftables: backing up existing chain with policy ACCEPT: INPUT, mangle
[2023-08-15 16:25:00]  DBG  nftables: backing up existing chain with policy ACCEPT: FORWARD, mangle
[2023-08-15 16:25:00]  DBG  nftables: backing up existing chain with policy ACCEPT: OUTPUT, mangle
[2023-08-15 16:25:00]  DBG  nftables: backing up existing chain with policy ACCEPT: POSTROUTING, mangle
[2023-08-15 16:25:00]  DBG  nftables: backing up existing chain with policy ACCEPT: FORWARD, filter
[2023-08-15 16:25:00]  DBG  nftables: backing up existing chain with policy ACCEPT: OUTPUT, filter
[2023-08-15 16:25:01]  INF  Using nftables firewall
[2023-08-15 16:25:01]  DBG  [DNS] Unable to use systemd-resolved monitor: /run/systemd/resolve/io.systemd.Resolve.Monitor doesn't exist
[2023-08-15 16:25:01]  INF  Running on netfilter queue #0 ...
[2023-08-15 16:25:01]  DBG  [eBPF] trying to load /usr/local/lib/opensnitchd/ebpf/opensnitch-dns.o
[2023-08-15 16:25:01]  DBG  UI service poller started for socket ///tmp/osui.sock
[2023-08-15 16:25:01]  DBG  UI auth: simple
[2023-08-15 16:25:01]  DBG  [eBPF] trying to load /usr/lib/opensnitchd/ebpf/opensnitch-dns.o
[2023-08-15 16:25:01]  INF  [eBPF] module loaded: /usr/lib/opensnitchd/ebpf/opensnitch-dns.o
[2023-08-15 16:25:01]  DBG  dns worker initialized #2
[2023-08-15 16:25:01]  DBG  dns worker initialized #3
[2023-08-15 16:25:01]  DBG  dns worker initialized #4
[2023-08-15 16:25:01]  DBG  dns worker initialized #0
[2023-08-15 16:25:01]  DBG  dns worker initialized #1
[2023-08-15 16:25:02]  INF  Connected to the UI service on ///tmp/osui.sock
[2023-08-15 16:25:02]  IMP  UI connected, dispathing queued alerts: 0
[2023-08-15 16:25:02]  INF  Start receiving notifications
[2023-08-15 16:25:05]  DBG  [eBPF exec event] ppid: 0, pid: 86841, /usr/bin/cat -> [cat]
[2023-08-15 16:25:05]  DBG  [eBPF exec event] ppid: 0, pid: 86840, /usr/bin/curl -> [curl zajc.eu.org]
[2023-08-15 16:25:05]  DBG  new connection udp => 52068:192.168.1.17 -> 192.168.1.1 (zajc.eu.org):53 uid: 1000, mark: 0
[2023-08-15 16:25:05]  DBG  [ebpf conn] not in cache, but in execEvents: udp52068192.168.1.17192.168.1.153, 86840 -> /usr/bin/curl
[2023-08-15 16:25:05]  DBG  [ebpf conn] adding item to cache: udp52068192.168.1.17192.168.1.153
[2023-08-15 16:25:05]  DBG  new connection udp => 52068:192.168.1.17 -> 192.168.1.1 (zajc.eu.org):53 uid: 1000, mark: 0
[2023-08-15 16:25:05]  DBG  error deleting ebpf entry: unable to delete element: no such file or directory
[2023-08-15 16:25:05]  DBG  [ebpf conn] in cache: udp52068192.168.1.17192.168.1.153, 86840 -> /usr/bin/curl
[2023-08-15 16:25:05]  DBG  UI is not running or busy, connected: true, running: true
[2023-08-15 16:25:05]  DBG  new connection udp => 52068:192.168.1.17 -> 192.168.1.1 (zajc.eu.org):53 uid: 1000, mark: 0
[2023-08-15 16:25:05]  DBG  error deleting ebpf entry: unable to delete element: no such file or directory
[2023-08-15 16:25:05]  DBG  [ebpf conn] in cache: udp52068192.168.1.17192.168.1.153, 86840 -> /usr/bin/curl
[2023-08-15 16:25:05]  DBG  UI is not running or busy, connected: true, running: true
[2023-08-15 16:25:05]  DBG  [ebpf] tcp map: 0 active items
[2023-08-15 16:25:05]  DBG  [ebpf] tcp6 map: 0 active items
[2023-08-15 16:25:05]  DBG  [ebpf] udp map: 0 active items
[2023-08-15 16:25:05]  DBG  [ebpf] udp6 map: 0 active items
[2023-08-15 16:25:10]  DBG  New DNS record: 86.58.78.76 -> zajc.eu.org
[2023-08-15 16:25:10]  DBG  (2) EBPF-DNS: LookupEvent 272 02000000 563a4e4c000000000000000000000000 7a616a632e65752e6f726700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
[2023-08-15 16:25:10]  DBG  (2) EBPF-DNS: Tracking Resolved Message: zajc.eu.org -> 86.58.78.76
[2023-08-15 16:25:10]  DBG  New DNS record: 86.58.78.76 -> zajc.eu.org
[2023-08-15 16:25:10]  DBG  new connection tcp => 41354:192.168.1.17 -> 86.58.78.76 (zajc.eu.org):80 uid: 1000, mark: 0
[2023-08-15 16:25:10]  DBG  [ebpf conn] not in cache, but in execEvents: tcp41354192.168.1.1786.58.78.7680, 86840 -> /usr/bin/curl
[2023-08-15 16:25:10]  DBG  [ebpf conn] adding item to cache: tcp41354192.168.1.1786.58.78.7680
[2023-08-15 16:25:10]  DBG  [eBPF exit event] -> 86840
[2023-08-15 16:25:10]  DBG  [eBPF exit event inCache] -> 86840
[2023-08-15 16:25:10]  DBG  UI is not running or busy, connected: true, running: true
[2023-08-15 16:25:10]  DBG  new connection tcp => 41354:192.168.1.17 -> 86.58.78.76 (zajc.eu.org):80 uid: 1000, mark: 0
[2023-08-15 16:25:10]  DBG  error deleting ebpf entry: unable to delete element: no such file or directory
[2023-08-15 16:25:10]  DBG  [ebpf conn] in cache: tcp41354192.168.1.1786.58.78.7680, 86840 -> /usr/bin/curl
[2023-08-15 16:25:10]  DBG  UI is not running or busy, connected: true, running: true
[2023-08-15 16:25:10]  DBG  [eBPF exit event] -> 86840
[2023-08-15 16:25:10]  DBG  [eBPF exit event] -> 86841
[2023-08-15 16:25:10]  DBG  [eBPF exit event inCache] -> 86841
[2023-08-15 16:25:10]  DBG  [ebpf] tcp map: 0 active items
[2023-08-15 16:25:10]  DBG  [ebpf] tcp6 map: 0 active items
[2023-08-15 16:25:10]  DBG  [ebpf] udp map: 0 active items
[2023-08-15 16:25:10]  DBG  [ebpf] udp6 map: 0 active items
[2023-08-15 16:25:13]  DBG  (3) EBPF-DNS: LookupEvent 272 02000000 7f000101000000000000000000000000 64656c6c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
[2023-08-15 16:25:13]  DBG  (3) EBPF-DNS: Tracking Resolved Message: dell -> 127.0.1.1
[2023-08-15 16:25:13]  DBG  (0) EBPF-DNS: LookupEvent 272 02000000 7f000101000000000000000000000000 64656c6c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
[2023-08-15 16:25:13]  DBG  (0) EBPF-DNS: Tracking Resolved Message: dell -> 127.0.1.1
[2023-08-15 16:25:13]  DBG  (4) EBPF-DNS: LookupEvent 272 02000000 7f000101000000000000000000000000 64656c6c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
[2023-08-15 16:25:13]  DBG  (4) EBPF-DNS: Tracking Resolved Message: dell -> 127.0.1.1
[2023-08-15 16:25:13]  DBG  (1) EBPF-DNS: LookupEvent 272 02000000 7f000101000000000000000000000000 64656c6c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
[2023-08-15 16:25:13]  DBG  (2) EBPF-DNS: LookupEvent 272 02000000 7f000101000000000000000000000000 64656c6c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
[2023-08-15 16:25:13]  DBG  (2) EBPF-DNS: Tracking Resolved Message: dell -> 127.0.1.1
[2023-08-15 16:25:13]  DBG  (1) EBPF-DNS: Tracking Resolved Message: dell -> 127.0.1.1
[2023-08-15 16:25:13]  DBG  (3) EBPF-DNS: LookupEvent 272 02000000 7f000101000000000000000000000000 64656c6c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
[2023-08-15 16:25:13]  DBG  (3) EBPF-DNS: Tracking Resolved Message: dell -> 127.0.1.1
[2023-08-15 16:25:14]  IMP  Got signal: terminated
[2023-08-15 16:25:14]  INF  Cleaning up ...
[2023-08-15 16:25:14]  DBG  stop monitoring firewall config file
[2023-08-15 16:25:14]  DBG  worker channel closed 10
[2023-08-15 16:25:14]  DBG  worker channel closed 8
[2023-08-15 16:25:14]  DBG  worker #8 exit
[2023-08-15 16:25:14]  DBG  worker #10 exit
[2023-08-15 16:25:14]  DBG  worker channel closed 0
[2023-08-15 16:25:14]  DBG  worker #0 exit
[2023-08-15 16:25:14]  DBG  worker channel closed 12
[2023-08-15 16:25:14]  DBG  worker #12 exit
[2023-08-15 16:25:14]  DBG  worker channel closed 9
[2023-08-15 16:25:14]  DBG  worker #9 exit
[2023-08-15 16:25:14]  DBG  worker channel closed 5
[2023-08-15 16:25:14]  DBG  worker #5 exit
[2023-08-15 16:25:14]  DBG  worker channel closed 7
[2023-08-15 16:25:14]  DBG  worker #7 exit
[2023-08-15 16:25:14]  DBG  worker channel closed 3
[2023-08-15 16:25:14]  DBG  worker #3 exit
[2023-08-15 16:25:14]  DBG  worker channel closed 2
[2023-08-15 16:25:14]  DBG  worker #2 exit
[2023-08-15 16:25:14]  DBG  worker channel closed 15
[2023-08-15 16:25:14]  DBG  worker #15 exit
[2023-08-15 16:25:14]  DBG  worker channel closed 14
[2023-08-15 16:25:14]  DBG  worker #14 exit
[2023-08-15 16:25:14]  DBG  worker channel closed 13
[2023-08-15 16:25:14]  DBG  worker #13 exit
[2023-08-15 16:25:14]  DBG  worker channel closed 11
[2023-08-15 16:25:14]  DBG  worker #11 exit
[2023-08-15 16:25:14]  DBG  worker channel closed 6
[2023-08-15 16:25:14]  DBG  worker #6 exit
[2023-08-15 16:25:14]  DBG  worker channel closed 1
[2023-08-15 16:25:14]  DBG  worker #1 exit
[2023-08-15 16:25:14]  INF  exit checking firewall rules
[2023-08-15 16:25:14]  DBG  nftables: Restoring chain policy to accept: OUTPUT, mangle
[2023-08-15 16:25:14]  DBG  nftables: Restoring chain policy to accept: OUTPUT, nat
[2023-08-15 16:25:14]  DBG  nftables: Restoring chain policy to accept: OUTPUT, mangle
[2023-08-15 16:25:14]  DBG  nftables: Restoring chain policy to accept: OUTPUT, filter
[2023-08-15 16:25:14]  DBG  nftables: Restoring chain policy to accept: FORWARD, filter
[2023-08-15 16:25:14]  DBG  nftables: Restoring chain policy to accept: INPUT, nat
[2023-08-15 16:25:14]  DBG  nftables: Restoring chain policy to accept: POSTROUTING, nat
[2023-08-15 16:25:14]  DBG  nftables: Restoring chain policy to accept: PREROUTING, mangle
[2023-08-15 16:25:14]  DBG  nftables: Restoring chain policy to accept: FORWARD, mangle
[2023-08-15 16:25:14]  DBG  nftables: Restoring chain policy to accept: PREROUTING, mangle
[2023-08-15 16:25:14]  DBG  nftables: Restoring chain policy to accept: PREROUTING, nat
[2023-08-15 16:25:14]  DBG  nftables: Restoring chain policy to accept: POSTROUTING, mangle
[2023-08-15 16:25:14]  DBG  nftables: Restoring chain policy to accept: INPUT, mangle
[2023-08-15 16:25:14]  DBG  nftables: Restoring chain policy to accept: FORWARD, mangle
[2023-08-15 16:25:14]  DBG  nftables: Restoring chain policy to accept: POSTROUTING, mangle
[2023-08-15 16:25:14]  DBG  nftables: Restoring chain policy to accept: OUTPUT, filter
[2023-08-15 16:25:14]  DBG  nftables: Restoring chain policy to accept: INPUT, mangle
[2023-08-15 16:25:14]  DBG  nftables: Restoring chain policy to accept: FORWARD, filter
[2023-08-15 16:25:14]  DBG  perfMap goroutine exited #2
[2023-08-15 16:25:14]  DBG  perfMap goroutine exited #1
[2023-08-15 16:25:14]  DBG  perfMap goroutine exited #3
[2023-08-15 16:25:14]  DBG  perfMap goroutine exited #0
[2023-08-15 16:25:14]  DBG  monitorLocalAddresses exited

@gustavo-iniguez-goya
Copy link
Collaborator

I see that there're 3 attempts to connect to zajc.eu.org:

(1)
[2023-08-15 16:25:05]  DBG  new connection udp => 52068:192.168.1.17 -> 192.168.1.1 (zajc.eu.org):53 uid: 1000, mark: 0
[2023-08-15 16:25:05]  DBG  [ebpf conn] not in cache, but in execEvents: udp52068192.168.1.17192.168.1.153, 86840 -> /usr/bin/curl
[2023-08-15 16:25:05]  DBG  [ebpf conn] adding item to cache: udp52068192.168.1.17192.168.1.153

(2)
[2023-08-15 16:25:05]  DBG  new connection udp => 52068:192.168.1.17 -> 192.168.1.1 (zajc.eu.org):53 uid: 1000, mark: 0
[2023-08-15 16:25:05]  DBG  error deleting ebpf entry: unable to delete element: no such file or directory
[2023-08-15 16:25:05]  DBG  [ebpf conn] in cache: udp52068192.168.1.17192.168.1.153, 86840 -> /usr/bin/curl
[2023-08-15 16:25:05]  DBG  UI is not running or busy, connected: true, running: true

(3)
[2023-08-15 16:25:05]  DBG  new connection udp => 52068:192.168.1.17 -> 192.168.1.1 (zajc.eu.org):53 uid: 1000, mark: 0
[2023-08-15 16:25:05]  DBG  error deleting ebpf entry: unable to delete element: no such file or directory
[2023-08-15 16:25:05]  DBG  [ebpf conn] in cache: udp52068192.168.1.17192.168.1.153, 86840 -> /usr/bin/curl
[2023-08-15 16:25:05]  DBG  UI is not running or busy, connected: true, running: true

which suggests me that the connection attempts are being blocked while there's a pop-up displayed. That's correct.

But while trying to reproduce this behaviour on a clean install, I've noticed that when the pop-up is automatically closed emiting a verdict, there's a log like this one in the log:

[2023-08-05 11:45:42]  DBG  Operator compiled: process.path is '/usr/bin/curl'
[2023-08-05 11:45:42]  IMP  Added new rule: deny if process.path is '/usr/bin/curl'
[2023-08-05 11:45:42]  DBG  ✘ /usr/bin/curl -> 50910:127.0.0.1 => zajc.eu.org (127.0.0.53):53, mark: 0 (deny-until-restart-simple-usr-bin-curl)

but these logs are not present in your log. Could you launch the GUI from a terminal, to see if there's any error when emiting a verdict?

Also, there should be a rule under tab Rules -> Applications to block curl, do you have it? Any temporary rule (any rule which Duration is not "foreever") should appear under Rules -> Applications -> Temporary

@markozajc
Copy link
Contributor Author

I tried running the GUI in the terminal, and there were no logs when this happens. Additionally, the pop-up doesn't close at all when this happens, but I have "Default timeout" set to 100. No rule appears until either 100 seconds elapse (for the pop-up timeout) or I click accept/reject.

@gustavo-iniguez-goya
Copy link
Collaborator

That's the expected behaviour then. The pop-up is closed when it reaches the timeout.

ok, I've managed to reproduce this behaviour:

  • /etc/opensnitchd/default-config.json, DefaultAction set to deny
  • GUI: pop-up DefaultAction set to Deny or Reject

If I set default-config.json DefaultAction to allow it works as expected, it applies the DefaultAction configured on the GUI while the GUI is running.

If the GUI is not running, and default-config.json DefaultAction is "deny", it also works as expected.

Could you confirm this?

@markozajc
Copy link
Contributor Author

Correct, if the GUI is not running curl fails, meaning DefaultAction is applied correctly.

@gustavo-iniguez-goya
Copy link
Collaborator

great, could you change these lines in /usr/lib/python3/dist-packages/opensnitch/service.py:

if _default_action == Config.ACTION_DENY_IDX:
temp_cfg['DefaultAction'] = Config.ACTION_DENY
else:
temp_cfg['DefaultAction'] = Config.ACTION_ALLOW

by:

        if _default_action == Config.ACTION_ALLOW_IDX
            temp_cfg['DefaultAction'] = Config.ACTION_ALLOW
        else:
            temp_cfg['DefaultAction'] = Config.ACTION_DENY

And confirm that it works as expected? When selecting on the GUI Reject as the default action it was not applying the correct verdict.

@gustavo-iniguez-goya gustavo-iniguez-goya changed the title Connections are always allowed after 5 seconds Connections are always allowed after 5 seconds (GUI DefaultAction: Reject) Aug 16, 2023
@markozajc
Copy link
Contributor Author

I have applied the change and the bug is fixed. Curl now correctly fails to get a response if I don't interact with the pop-up, and if I accept it (even past the 5 second mark), the request succeeds normally. Thanks!

@gustavo-iniguez-goya
Copy link
Collaborator

thank you very much for reporting this error @markozajc !

I'll publish new GUI packages in the follwing days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants