Commit graph

1798 commits

Author SHA1 Message Date
Gustavo Iñiguez Goia
5eebaf40fc improved the process tree retrieval 2025-02-11 01:21:06 +01:00
Gustavo Iñiguez Goia
740465a447
ui: improved search in detail views
Allow to filter by more fields.
2025-02-10 00:58:40 +01:00
Gustavo Iñiguez Goia
4afa22c5b5
ui: fixed displaying icons
In some distros like Ubuntu 25, we were not displaying the fw button
icon, which made the button practically hidden to the user.

We assumed that if 'document-new' or 'emblem' icons were available,
the rest of the icons would be available as well, so we wouldn't need
to fallback to Qt's builtin icons.

However on Ubuntu 25 for example, despite of 'document-new' being
available, the icon 'security-high' was not being displayed when it was
loaded from the stats.ui file.

Loading it from code with QIcon.fromTheme() works fine, and even if
it's not found (which sometimes happens), we'd fallback to Qt's builtin
icons.

Other icons may be optional, but icons without text need to have an
icon always.

 - minor formatting change.
 - removed unused code.
2025-02-10 00:20:16 +01:00
Gustavo Iñiguez Goia
2a68561557
exclude disabled rules from the active rules
Disabled rules were part of the active rules. The fields were not
evaluated, but we still went through the entire list.

Not adding them to the list of active rules improves matching time,
especially when there're a lot of disabled rules.

It mainly affected when matching rules that were non-priority or
ordered alphabetically, with action Allow.
2025-02-08 15:12:11 +01:00
Gustavo Iñiguez Goia
07a4077a6a
schedule temp rules only if enabled
Avoid scheduling temporary rules if they're not enabled.
2025-02-08 00:37:04 +01:00
Gustavo Iñiguez Goia
4a37c88db6
ui: fixed typo 2025-02-07 00:02:23 +01:00
Gustavo Iñiguez Goia
b87bc2e826
ui: stop scheduled task on exit
On closing the GUI, stop the schedulded tasks to disable temporal rules.
Otherwise the GUI won't exit until all tasks finish.
2025-02-06 23:51:14 +01:00
Gustavo Iñiguez Goia
1a39122c1d
netstat: dump AF_PACKET sockets from the kernel
We'll try to dump the AF_PACKET sockets from the kernel. If it's not
possible, we'll fallback to read /proc/net/packet.
2025-02-06 01:49:40 +01:00
Gustavo Iñiguez Goia
335f2a783d netstat: allow to list XDP sockets
- daemon: Allow to dump XDP sockets from kernel.
 - ui: Added options to filter by RAW protocol and AF_XDP family.
 - Bumped vishvananda/netlink version to v1.3.0.
 - Updated go.mod and go.sum
2025-02-05 00:05:02 +01:00
Gustavo Iñiguez Goia
c5e24c04f1
ui,netstat: allow to filter listed connections 2025-02-03 23:18:33 +01:00
Gustavo Iñiguez Goia
83eb82a343 netstat: added option to monitor AF_PACKET sockets
For now, we parse /proc/net/packet, because vishvananda/netlink does not
have support to dump AF_PACKET sockets from kernel.
2025-02-03 21:09:51 +01:00
Gustavo Iñiguez Goia
70e868ad8c
ui: format node addr correctly
When scheduling a temporary rule to disable it, use the correct node
address.
2025-01-31 09:36:13 +01:00
Gustavo Iñiguez Goia
85173c3553
ui,popups: mark temporary rules as inactive
Once the temporary rules expire, mark them as inactive in the DB.
2025-01-31 00:28:11 +01:00
Gustavo Iñiguez Goia
e403b080bc
cache,events: added debug logs
- Added logs to debug the cache of events.
 - Reduce the expected number of checksums types we may compute
   simultaneously. Probably we only need one.
2025-01-28 23:44:54 +01:00
Gustavo Iñiguez Goia
c1fdfb1d73 cache: delay the deletion time of an process
Sometimes we may receive a connection event after the exit of a
process:

[exec] /bin/xxx, pid 1234
[exit] /bin/xxx, pid 1234
[new conn] pid 1234 -> process unknown (on exec event and no /proc entry)

In these scenarios, we delay the deletion from cache a little
bit, to keep the PID available for a longer time.
2025-01-27 01:08:19 +01:00
Gustavo Iñiguez Goia
6696d1c141
ui,fw: fixed adding dst/src port rules 2025-01-25 01:46:49 +01:00
Gustavo Iñiguez Goia
0dfec48120
ui, fw: fixed adding rules when using service name
We were failing adding system fw rules when the user selected a
destination port by service name.

We allow to specify port ranges with '-' (8080-8088), and as some
service names contain '-' in the name (ftp-data, netbios-ns), it was
failing.
2025-01-25 01:09:33 +01:00
Gustavo Iñiguez Goia
ced8410d43
allow to use lists of md5s to block connections
Besides domains, net ranges and IPs, now it's possible to
filter connections by the MD5 of a binary, if it's enabled.
2025-01-24 00:47:02 +01:00
Gustavo Iñiguez Goia
5184c45086
changed dns log messages
Moved some messages to Trace.
2025-01-22 19:19:57 +01:00
Gustavo Iñiguez Goia
f7803ebdcb
added trace logs for packets and ebpf
- Log packets.
 - Log special case.
 - Updated information on some rare cases when intercepting connections
   via eBPF.
2025-01-22 01:06:10 +01:00
Gustavo Iñiguez Goia
7a32f32f7a
netlink/ more improvements
- Fixed serializing netlink data:
   d237ee16c3 (diff-f7f6108a60b107adfb0930f5f73a6ae229f9943bb01949d1f8f3e247f869b2abL59-L60)
 - misc.
2025-01-22 00:33:10 +01:00
Gustavo Iñiguez Goia
d54f8d4777
netlink/ improvements
- Structs fields alignment fixed.
 - Dump more sockets via netlink, in order to display them with the
   SocketsMonitor task (netstat).
 - Fixed serializing netlink data:
d237ee16c3 (diff-f7f6108a60b107adfb0930f5f73a6ae229f9943bb01949d1f8f3e247f869b2abL59-L60)
2025-01-22 00:16:17 +01:00
Gustavo Iñiguez Goia
63a3b4e446
ebpf improvements
- changed formatting.
 - extract source IPs from UDP packets from ancillary messages.
 - hook inet_dgram_connect to solve intercepting some apps (parsec).
 - remove debugging / unused code.

More info on these changes:
fbdef1673d
20a03e11fe
f44d3e896b
93d1cefbc2

Closes: #1246.
2025-01-21 23:57:01 +01:00
Gustavo Iñiguez Goia
dd6b3c57f7
Merge pull request #1255 from staticssleever668/fix_unbound_service
ui: make sure 'service' variable is set
2025-01-13 21:09:54 +01:00
Yaroslav Chvanov
9e2ef5f491
ui: make sure 'service' variable is set
Fixes error when running `opensnitch-ui` again:
>     if service:
>        ^^^^^^^
> NameError: name 'service' is not defined. Did you mean: 'UIService'?

Fixes: cdf93c72c1 ("ui: fixed delay closing the GUI")
2025-01-13 22:04:58 +03:00
Gustavo Iñiguez Goia
45f5b62978
add new log level TRACE 2025-01-12 00:47:49 +01:00
Gustavo Iñiguez Goia
ff3ac6663a
allow to filter connections by username
Added new rule operand 'user.name' to filter connections by username.

More info #1236
2025-01-09 17:15:28 +01:00
Gustavo Iñiguez Goia
c0be3d15dc
ui: fixed closing the GUI with a popup active 2025-01-06 20:22:49 +01:00
Gustavo Iñiguez Goia
2357186093
Merge pull request #1252 from e3dio/master
fix #1245 UI rule deletion
2025-01-04 19:31:32 +01:00
e3dio
824b5c789a
fix #1245 2025-01-03 22:19:01 -07:00
Gustavo Iñiguez Goia
337b81a89b
ui: fixed acting on selected rows
When selecting rows with CTRL we were not copying/deleting rules
correctly.

Closes #1245
2025-01-04 00:44:34 +01:00
Gustavo Iñiguez Goia
422a2dd82d
pkg,ui: rpm/deb improvements
- deb: added python3-packaging dependency.
 - rpm:
   * make python3-notify2 package optional.
   * Added python3-packaging as dependency to load dynamically the
     protobuffers (python3-packaging for Fedora, python-rpm-packaging
     metapackage for OpenSuse).
2025-01-03 16:19:28 +01:00
Gustavo Iñiguez Goia
6f41dc6c3e
ui: added proto/ directory 2025-01-03 15:02:48 +01:00
Gustavo Iñiguez Goia
5dd4ef06bb
ui: allow to use multiple protobuffer versions
Protobuffers compiled with protobuf < 3.20.0 are incompatible with
protobuf >= 4.0.0:
https://github.com/evilsocket/opensnitch/wiki/GUI-known-problems#gui-does-not-show-up

This has been a source of problems for some users (#1214, #647), and
in some distributions, previous protobuffer does no longer work due to
incompatibility with the protobuf package version installed
(OpenSuse Tumbleweed).

So in order to solve this issue, we provide several protobuffers,
for old and new protobuf versions:
proto/ui_pb2* for protobuf >= 4.0.0
proto/pre3200/ui_pb2* for protobuf >= 3.6.0 and < 3.20.0

To avoid import errors, each protobuffer must be placed in its own
directory, and the name of the protobuffer files must be named with
the syntax <prefix>_pb2.py/<prefix>_pb2_grpc.py:
  ui_pb2.py and ui_pb2_grpc.py

The default compiled protobuffer will be opensnitch/proto/ui_*.py
instead of opensnitch/ui_*.py
2025-01-03 14:48:35 +01:00
Gustavo Iñiguez Goia
24a5105d77
ui,stats: fixed Events search with different languages
When a language other than English was used, the search in the Events
did not work.
2024-12-30 22:21:59 +01:00
Gustavo Iñiguez Goia
d8c3684f2b
ui,stats: improved nodes search 2024-12-26 13:27:44 +01:00
Gustavo Iñiguez Goia
6edb60c549
pkg,deb: updated notes for grpcio issue #647 2024-12-25 12:52:45 +01:00
Gustavo Iñiguez Goia
37bb9742a4
ui,stats: fixed displaying proc details dialog 2024-12-24 17:10:34 +01:00
Gustavo Iñiguez Goia
6e7aaf935b
ui: netstat/events view improvements
- Clicking on a column will display the details of that item (IP,
   process, etc).
   DstIP, DstPort and UserID columns will open the details of the
   selected item.
   Clicking on the PID column will open the process monitor dialog.
   The rest of the columns will open the details of the process.

 - On the Events tab, clicking on the PID column will open the process
   monitor dialog.
2024-12-21 23:31:25 +01:00
Gustavo Iñiguez Goia
5595a69927
ui: removed hardcoded labels color
It was set to blue, and when using dark themes it didn't look good.
2024-12-21 01:25:23 +01:00
Gustavo Iñiguez Goia
8f2ba67077
ui: fixed searching in tab Users 2024-12-20 15:44:52 +01:00
Gustavo Iñiguez Goia
fcaf3b8181
ui: display all fields in the detail views 2024-12-20 15:40:06 +01:00
Gustavo Iñiguez Goia
5629e2a405
ui,stats: simplified columns configuration
There're only two points where we need to reconfigure the columns:
on showEvent() and when saving the settings.
2024-12-18 21:40:28 +01:00
Gustavo Iñiguez Goia
843f537000
ui,stats: improved restoring columns 2024-12-18 16:18:54 +01:00
Gustavo Iñiguez Goia
eab75b8a48
ui,popups: strip non-printable characters from labels
Commands with non-printable characters were misaligning the labels.

Now these characters are exclude from the labels, and texts are
displayed as a single line.
2024-12-18 00:52:10 +01:00
Gustavo Iñiguez Goia
01e1341770
ui: allow to configure QT_QPA_PLATFORM from the GUI
Under Wayland the GUI doesn't work entirely well (#733).

Setting QT_QPA_PLATFORM to 'xcb' solves some issues, like correctly
positioning popups, but users had to configure it manually.

Now it's possible to configure it from the Preferences dialog.

Setting it to "" will use the default option of the Desktop Environment.
2024-12-17 20:07:27 +01:00
Gustavo Iñiguez Goia
c526907d75
reload procmon method after fw rules
There was a situation where if the ebpf modules path did not exist,
the fw rules were not added, causing the daemon to crash after
connecting to the GUI.
2024-12-17 12:33:38 +01:00
Gustavo Iñiguez Goia
7d2ca8d039
updated network_aliases.json path
- Load network_aliases.json by default from /etc/opensnitchd.
 - Don't exit if network_aliases.json doesn't exist.
 - Updated Makefile to install network aliases definitions.
2024-12-17 00:38:30 +01:00
Gustavo Iñiguez Goia
ed84394dfc
Merge pull request #1237 from nolancarougepro/lan_access_control
Lan access control
2024-12-17 00:15:37 +01:00
Gustavo Iñiguez Goia
dd89509b1c
ui,stats: don't allow clicking on empty hosts
In the Events tab, don't allow double clicking on the DstHost column if
the cell is empty.
2024-12-16 23:50:36 +01:00