Commit graph

839 commits

Author SHA1 Message Date
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
Gustavo Iñiguez Goia
ffd70836f6
ui, pop-ups: set details scrollbar position correctly
When adding the details of a connection, the scrollbar was always at the
bottom of the view.
2023-11-22 01:34:09 +01:00
Gustavo Iñiguez Goia
2f04d0f27f
ui: added option to save checksum settings 2023-11-20 00:47:00 +01:00
Gustavo Iñiguez Goia
afe92de45e
ui,prefs: added checksum option to the popup section
Added option to select by default on the pop-ups checksum verification.
2023-11-19 23:12:15 +01:00
Gustavo Iñiguez Goia
4499a5aaf0
ui,stats: fixed adding rules to the db from context menu
When cloning a rule, or applying a rule to a node, if the rule was of
type List (had multiple operators), the operators were not saved to the
DB.

Closes: #1027
2023-11-15 00:59:01 +01:00
Gustavo Iñiguez Goia
6d056b8a7b
Bump daemon and GUI versions
Current changes are no longer compatible with 1.6.x.
2023-11-09 01:05:46 +01:00
Gustavo Iñiguez Goia
9528fb0e6b
ui: use single quotes for raw strings
part of the previous commit. Missed this change.
2023-11-08 14:28:45 +01:00
Gustavo Iñiguez Goia
e6ae9ca6ef
ui: use raw strings notation to for regexps
and silence python3.12 warnings.
2023-11-08 13:58:59 +01:00
Gustavo Iñiguez Goia
2d96ec1fc7
ui: restrict unix socket to the current user
By default, restrict reading from the unix socket to the user who
launched the GUI.
2023-11-08 00:48:44 +01:00
Gustavo Iñiguez Goia
d08da08431
ui,prefs: set db in-memory name correctly
Instead of :memory:, use file::memory:

Related: #1030
2023-11-06 15:40:01 +01:00
Gustavo Iñiguez Goia
de58e099ec
ui: allow to delete old events of the in-memory db
Not deleting events from in-memory db can lead to a high mem usage under
certain scenarios.

Previous attempt to solve this issue wrote events to disk in a temporal
file (when using file::memory:?cache=shared).

Related issues: #844 #857

Closes: #1030
2023-11-04 00:27:50 +01:00
Gustavo Iñiguez Goia
9d1182a48f
ui,prefs: enable/disable max days db checkbox
When selecting to store events on disk, the max days db checkbox must be
clickable.
2023-11-03 23:02:42 +01:00
Gustavo Iñiguez Goia
e63f4c13c8
ui: preserve rules' columns width
Preserve rules' columns width when selecting rules left panel items.

Closes: #822
2023-10-31 01:19:01 +01:00