Commit graph

801 commits

Author SHA1 Message Date
Gustavo Iñiguez Goia
f63a48deff
calculate the ram usage of a process in the daemon
- Calculate the ram usage of a process in the daemon, using the page
   size of the system.
 - Added new functions to read some details of a process, so we can use
   them in other parts of the code.
2024-10-15 00:49:58 +02:00
Gustavo Iñiguez Goia
83fad69316
tasks: added sockets monitor task (netstat)
Added new task to monitor local sockets of nodes, similar to ss or
netstat.

More info: #1112
2024-10-07 23:40:40 +02:00
Gustavo Iñiguez Goia
61d81f7055
Merge pull request #1195 from atriwidada/master
Add Indonesian translation
2024-09-28 16:34:30 +00:00
Gustavo Iñiguez Goia
58613543e2 added new task nodemonitor
Added new task to monitor the resources of remote nodes, like
ram, swap, number of processes or load average of the system.

The task is initiated when the user selects a node, and the data
received from the node is added to the right panel of the Nodes tab.

The task is stopped when changing to another tab, or when deselecting a
node.

Particularly useful for monitoring remote nodes.
2024-09-28 10:09:19 +02:00
Gustavo Iñiguez Goia
aea751793f
ui, procdialog: added missing import 2024-09-25 21:53:18 +02:00
Gustavo Iñiguez Goia
ee225cd815
ui,procdialog: allow to filter sockets and files
Two new options has been added to filter the process open files list by
sockets and regular files (by default it display pipes, etc).
2024-09-25 21:45:38 +02:00
Gustavo Iñiguez Goia
9e0f3a4797
introducing daemon tasks
daemon tasks are actions that are executed in background by the daemon.

They're started from the GUI (server) via a Notification (protobuf),
with the type TASK_START (protobuf).

Once received in the daemon, the TaskManager starts the task in
background.

Tasks may run at interval times (every 5s, 2days, etc), until they
finish an operation, until a timeout, etc.

Each task has each own configuration options, which will customize the
behaviour of its operations.

In this version, if the GUI is closed, the daemon will stop all the
running tasks.
Each Task has a flag to ignore this behaviour, for example if they need
to run until they finish and only send a notification to the GUI,
instead of streaming data continuously to the GUI (server).

 - Up until now we only had one task that could be initiated from the GUI:
   the process monitor dialog. It has been migrated to a Task{}.
 - go.mod bumped to v1.20, to use unsafe string functions.
 - go.sum updated accordingly.
2024-09-25 01:00:38 +02:00
Andika Triwidada
23811e749e * Add Indonesian translation
* sort translation files in opensnitch_i18n.pro
2024-09-23 12:01:13 +00:00
Gustavo Iñiguez Goia
05eed4ef04
ui,plugins: added missing files
The plugins were not included when building the wheel.
2024-09-20 23:08:17 +02:00
Gustavo Iñiguez Goia
c832accf5d
ui,popups: new button to update the checksum of all rules
When filtering by checksum and the checksum of a rule changes, we
display a warning on the popup, indicating that something happened.

The user had the option to update the checksum of one rule, directly
from the popup.

Now there's a new button to update all the rules that have a checksum as
filtering parameter.
2024-09-20 22:48:32 +02:00
Gustavo Iñiguez Goia
61727af788
ui,rules: do not verify lists path on remote nodes
When creating/editing rules to filter by lists of nets/IPs/domains, we
check if the path entered is a directory.

However on remote nodes, the path may not exist where the GUI is
running, but be valid where the daemon is running.

Now we only check the path if the node where it's being configured is
local.

Closes #1174
2024-09-18 00:20:05 +02:00
Gustavo Iñiguez Goia
f669c780b4
ui: fixed syntax warning building appimages paths
SyntaxWarning: invalid escape sequence '\.'

(#1154)
2024-09-17 22:48:37 +02:00
Gustavo Iñiguez Goia
14747a04ad
ui,plugins: added configuration examples 2024-09-17 00:24:48 +02:00
Gustavo Iñiguez Goia
2a233c1d8b ui: introducing plugins, improved actions
Up until now we had a way of customizing the views, by defining
"actions". See for context cba52cf3d8

The configuration syntax has not changed, but now every "action" is a
python plugin, for example when loading this configuration:

    {
      "name": "commonDelegateConfig",
      "actions": {
        "highlight": {
          "enabled": true,
          "cells": [
            {
              "text": ["allow", "✓ online"],
              "color": "white",
              "bgcolor: "green",

we'll try to load "highlight" as plugin, which should exist under
opensnitch/plugins/highligh/highlight.py

Three new plugins has been added:
 - Highlight: colorize cells or rows based on patterns.
 - Downloader: a simple downloader which downloads files to local
   directories, for example to download blocklists.
 - Virustotal: a plugin to analyze IPs, domains and checksums with the
   API of virustotal when a new popup is fired.

There're 3 points where the plugins are configured and executed:
 - opensnitch/service.py - _load_plugins() (background/global plugins)
 - opensnitch/dialogs/prompt/__init__.py - _configure_plugins(), _post_popup_plugins()
 - opensnitch/dialogs/processdetails.py - _configure_plugins()

Plugins can't be configured from the GUI (yet).

For more details, read:
 opensnitch/plugins/__init__.py
 opensnitch/actions/__init__.py
 opensnitch/plugins/downloader/downloader.py
 opensnitch/plugins/virustotal/virustotal.py
2024-09-16 22:55:06 +02:00
Gustavo Iñiguez Goia
2e90f3832d ui: restrict allowed characters in the rule name
Since the name of the rule is used for the file name on the disk,
certain characters caused issues when saving the rule, like '/'.

Now if the user types or pastes '/' in the name field, a warning is
displayed, indicating that some characters are not allowed.

Closes #1166
2024-09-03 13:52:07 +02:00
Gustavo Iñiguez Goia
acdd2b34ec
ui,prefs: fixed changing qspinbox values
When changing qspinbox values (density scale, refresh interval, etc),
we were unintentionally changing [x] Disable popups option.
2024-06-20 00:32:46 +02:00
Gustavo Iñiguez Goia
552aed5bc5
ui: fixed exporting/importing rules
When exporting rules, use rfc3339 format for the Created field.
We were exporting as timestamp, which caused issues when importing them.

Related:
 58aa979cae
 issue #1140
2024-06-19 00:00:36 +02:00
Gustavo Iñiguez Goia
ad8e2f5371
ui: keep working if pyinotify fails loading
pyinotify has stopped working in python3.12, it fails loading with the
error:
ModuleNotFoundError: No module named 'asyncore'

For now, ignore this error and keep working as usual.
Applications icons will be loaded on GUI startup, but we loose the
ability of discovering the icons of applications while the GUI is
running.

Closes: #1132
2024-06-11 00:26:57 +02:00
Gustavo Iñiguez Goia
7a878e9516
ui: updated extensions to discover apps' icons 2024-06-05 00:22:04 +02:00
Gustavo Iñiguez Goia
b096e664c7
ui: fixed exporting rules to the clipboard
We were not formatting the "created" date field properly.
More info: https://github.com/evilsocket/opensnitch/issues/1140#issuecomment-2140904847
2024-05-31 00:09:23 +02:00
Gustavo Iñiguez Goia
33c592007f
ui,prefs: allow to configure more options
Allow to configure from the preferences dialog:
 - max stats and events.
 - rules path (use default path if empty).
 - internal GC percentage, flush connections on start.

Disabled daemon's DefaultDuration option when the daemon is not
connected to the server (GUI). By default is "once".

Improved configuration parsing.
Minor improvements to display status messages.
2024-05-30 00:30:02 +02:00
Gustavo Iñiguez Goia
8c25c3f7df
ui,prefs: node auth settings improvements
- Added "More information" label to the preferences dialog, and open a
   link to our wiki with more information.
 - Allow to configure node auth settings from the GUI:
   When we added the authentication options (12b4cf3104,
   6556eed1ae, f63d9dce72)
   we allowed to configure auth options from the GUI, but only if the
   nodes already had the options configured. If the auth options
   received were empty, we simply disabled the auth options on the
   preferences dialog.

   Now we build the configuration in this scenario, and sent it back to
   the nodes.
2024-05-18 21:56:17 +02:00
Gustavo Iñiguez Goia
427447574f
Merge pull request #1135 from ponychicken/patch-1
Improve wording in Top menu
2024-05-18 08:36:51 +00:00
Gustavo Iñiguez Goia
0c8935c6e8
ui, prefs: ignore SameFile error when enabling autostart
When clicking [x] Autostart the GUI upon login, ignore the exception if
src and dst (opensnitch_ui.desktop) are the same file.
2024-05-18 10:33:16 +02:00
ponychicken
d6f3552fa0
Improve wording 2024-05-18 09:16:55 +02:00
Gustavo Iñiguez Goia
a21a316e34
ui, prefs: load and conf daemon DefaultAction
In f5f30b1e58 we added the option to
reject connections as DefaultAction.

If configured, load and set it in the preferences dialog.
2024-05-18 00:51:54 +02:00
Gustavo Iñiguez Goia
0cc4d88e35
ui, prefs: improved loading auth options 2024-05-18 00:50:30 +02:00
Gustavo Iñiguez Goia
8cadf5316e
ui: fixed deleting rules
reverts 2ec37ed593

Closes: #1133
2024-05-18 00:03:48 +02:00
tioguda
df6c7d53f3 i18n: updated Brazilian Portuguese translation 2024-05-06 09:52:27 -03:00
Gustavo Iñiguez Goia
f5f30b1e58
added Reject to the list of DefaultActions(s)
We only offered two options for the DefaultAction option: allow/deny.

Since a long time ago we support "reject"ing connections, but it was not
configurable as the DefaultAction.

Closes: #1108
2024-05-01 00:23:48 +02:00
Gustavo Iñiguez Goia
bf9801f917
ui: allow to configure screen/themes scale factor
Added new options to the Preferences dialog, to configure screens/themes
scale factor.

If the UI is using the System theme (default), configure Qt scale
options (needs UI restart):
QT_AUTO_SCREEN_SCALE_FACTOR (default True)
QT_SCREEN_SCALE_FACTORS (If auto scale is False, use this value(s))

The user can configure different scale factors for multiple screens, by
separating values with ; (1;1.5, etc...)

https://doc.qt.io/qt-5/highdpi.html#high-dpi-support-in-qt

If the UI is using a qt-material theme, you can configure the "density"
scale of the theme:
https://github.com/UN-GCPDS/qt-material?tab=readme-ov-file#density-scale

https://github.com/evilsocket/opensnitch/wiki/GUI-known-problems#gui-size-problems-on-4k-monitors

Closes: #1102
2024-04-27 19:02:54 +02:00
Gustavo Iñiguez Goia
2ec37ed593
ui: fixed deleting rules with list limits
Fixed deleting rules when the GUI is configured to display a maximum
number of rules.
2024-02-11 11:41:49 +01:00
Gustavo Iñiguez Goia
fbd17a29da
pop-ups: filter by absolute path+cmdline on some cases
If the pop-ups' target is to filter by cmdline, but the typed/launched
command is not absolute or it starts with /proc, also filter by the
absolute path to the binary.
2024-02-08 17:45:21 +01:00
Gustavo Iñiguez Goia
016f4842ff
ui:use appimages pattern as default target if found
If the path of a process starts with /tmp/.mount_*, which is the common
path for appimages, use it as the default target on the popups.

Previously it was only added to the list of targets, but preselecting it
will help users to create rules for appimages.
2024-01-22 12:54:10 +01:00
Gustavo Iñiguez Goia
d9287bf601
ui: display alert details by double-clicking on it 2024-01-04 12:15:39 +01:00
Gustavo Iñiguez Goia
dc48d392f2
ui: save and display alerts/events from the daemon
New option to save and display alerts/events received from the daemon,
like system fw errors or eBPF modules errors.

Until now we only displayed a desktop message, making it difficult to
review the message in detail, or other actions.
2024-01-03 20:22:45 +01:00
Gustavo Iñiguez Goia
e905163a03
ui: make fw dialog status label selectable
- Allow to select by mouse or keyboard the status messages of the
   firewall.
 - Enable word wrapping.
2023-12-20 01:08:49 +01:00
Gustavo Iñiguez Goia
94492f0a71
ui: fixed config option 2023-12-17 20:52:39 +01:00
Gustavo Iñiguez Goia
6006717b86
ui: allow to configure refresh interval
Up until now, the GUI was refreshed if:
 - it was not minimized or hidden.
 - if there were new events (even if we received events from the daemon,
   they were filtered out if they were duplicated).

But still, there were scenarios where refreshing the views every second
(more or less) was too much, like when monitoring multiple machines.

Now it's possible to configure the views' refresh interval, regardless
of what the daemon sends.

Asked here: #1073
2023-12-17 20:19:40 +01:00
Gustavo Iñiguez Goia
250dcb1f6d
ui,popups: fixed adding rules when there's no path
Fixed creating rules when there's no path nor cmdline reported (with [x]
Debug invalid connections).
2023-12-06 12:57:59 +01:00
Gustavo Iñiguez Goia
d7c7a08d6f
ui,popups: fixes and refactoring 2023-12-03 12:38:55 +01:00
Gustavo Iñiguez Goia
daa5ebbd1c
ui: updated translations generation
include the new prompt dialog files.
2023-12-03 11:53:35 +01:00
Gustavo Iñiguez Goia
1cb52afbf9
ui, popups: internal changes 2023-12-03 01:50:28 +01:00
Gustavo Iñiguez Goia
d3ba9d65ce
ui, popups: refactoring 2 2023-12-01 23:58:00 +01:00
Gustavo Iñiguez Goia
c297b0b539
ui, popups: refactoring
will help to write unit tests more easily.
2023-12-01 23:05:40 +01:00
Gustavo Iñiguez Goia
4f9b69961c
ui,pop-ups: updated AppImage pattern
rel: #1066
2023-11-25 01:09:59 +01:00
Gustavo Iñiguez Goia
198595a2b8
ui, popups: minor refactoring 2023-11-25 00:54:28 +01:00
Gustavo Iñiguez Goia
56775cd62a
ui,popups: add AppImages' path pattern to the options
If the path of the process starts with /tmp/.mount, it typically
indicates that the application is an AppImage.

These apps create a random directory under /tmp, with the pattern
/tmp/.mount_<appId>XXXXXX, where the AppImage is mounted (it's not
always the case, but it usually is).

a0373541c1/runtime.c (L202)

The problem is that if you allow the path to the executable, the next
time you launch the AppImage, the path won't match the rule, and you'll
be prompted again to allow the outbound connection.

So as a helper for the users, if we find the path of the process starts
with /tmp/.mount_, we add an option to the combo box to select the path,
which creates a regular expression to match the AppImage.

Requested here: #1066, #543, #408
2023-11-25 00:12:29 +01:00
Gustavo Iñiguez Goia
827d7398f5
ui: print a warning if XDG_SESSION_TYPE is not set
If XDG_SESSION_TYPE is not set there're no icons on the GUI.
More info: #999
2023-11-24 23:23:49 +01:00
Gustavo Iñiguez Goia
02cf65ac33
ui,popups: allow to update checksums
When the checksum of a binary changes, due to an update or something
else, you'll be prompted to allow the outbound connection if the
previous checksum of the rule doesn't match the new one.

Without a visual warning was almost impossible to know what was going
on. Besides, you had to dismiss that pop-up, find the rule, and update
the checksum.

Now there's a warning message, and you can update the rule from
the pop-up.

Related: #413
2023-11-24 00:57:13 +01:00