Commit graph

766 commits

Author SHA1 Message Date
Gustavo Iñiguez Goia
a6fe895a67
ui,ruleseditor: add rules correctly to the db
Operator list was not converted to JSON string when saving the rule to
the DB.

Related: #1047
(cherry picked from commit 67149269cd)
2024-06-27 14:07:45 +02:00
Gustavo Iñiguez Goia
fe66f9aa17
rules: improved operator list parsing and conversion
Previously when creating a new rule we followed these steps:
 - Create a new protobuf Rule object from the ruleseditor or the
   pop-ups.
 - If the rule contained more than one operator, we converted the
   list of operators to a JSON string.
 - This JSON string was sent back to the daemon, and saved to the
   DB.
 - The list of operators were never expanded on the GUI, i.e., they
   were not saved as a list of protobuf Operator objects.
 - Once received in the daemon, the JSON string was parsed and
   converted to a protobuf Operator list of objects.
   Both, the JSON string and the list of protobuf Operator objects were
   saved to disk, but the JSON string was ignored when loading the
   rules.

Saving the list of operators as a JSON string was a problem if you
wanted to create or modify rules without the GUI.

Now when creating or modifying rules from the GUI, the list of operators
is no longer converted to JSON string. Instead the list is sent to the
daemon as a list of protobuf Operators, and saved as JSON objects.

Notes:
 - The JSON string is no longer saved to disk as part of the rules.
 - The list of operators is still saved as JSON string to the DB.
 - About not enabled rules:
   Previously, not enabled rules only had the list of operators as JSON
   string, with the field list:[] empty.
   Now the list of operators is saved as JSON objects, but if the rule
   is not enabled, it won't be parsed/loaded.

Closes #1047

(cherry picked from commit b93051026e)
2024-06-21 11:38:46 +02:00
Gustavo Iñiguez Goia
4e7f1aeae7
Bumped versions to v1.6.6 2024-06-20 00:45:33 +02:00
Gustavo Iñiguez Goia
31fc42a764
ui,prefs: fixed changing qspinbox values
When changing qspinbox values (density scale, refresh interval, etc),
we were unintentionally changing [x] Disable popups option.

(cherry picked from commit acdd2b34ec)
2024-06-20 00:41:04 +02:00
Gustavo Iñiguez Goia
1ec8a0213a
ui: fixed exporting/importing rules
When exporting rules, use rfc3339 format for the Created field.
We were exporting it as timestamp, which caused issues when
importing the rules.

Related:
 58aa979cae
 issue #1140
(cherry picked from commit 552aed5bc5)
2024-06-19 18:56:25 +02:00
Gustavo Iñiguez Goia
94e8156ce2
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.

(cherry picked from commit ad8e2f5371)
2024-06-14 01:21:21 +02:00
Gustavo Iñiguez Goia
0fc4239453
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

(cherry picked from commit b096e664c7)
2024-06-14 01:19:32 +02:00
Gustavo Iñiguez Goia
ff407e72af
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.

(cherry picked from commit 8c25c3f7df)
2024-06-14 01:17:39 +02:00
Gustavo Iñiguez Goia
03439f4f9c
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.

(cherry picked from commit 0c8935c6e8)
2024-06-14 01:08:31 +02:00
Gustavo Iñiguez Goia
7653a0a1c1
Improve wording
(cherry picked from commit d6f3552fa0)
2024-06-14 01:06:06 +02:00
Gustavo Iñiguez Goia
c5409755bc
ui, prefs: improved loading auth options
(cherry picked from commit 0cc4d88e35)
2024-06-14 01:05:14 +02:00
Gustavo Iñiguez Goia
cd2dc2535c
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.

(cherry picked from commit a21a316e34)
2024-06-13 00:23:55 +02:00
Gustavo Iñiguez Goia
91190c80aa
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.

(cherry picked from commit f5f30b1e58)
2024-06-13 00:09:00 +02:00
Gustavo Iñiguez Goia
362c0da53f
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

(cherry-picked from bf9801f917)
2024-06-12 22:04:50 +02:00
Gustavo Iñiguez Goia
9a605d3ef3
ui: versions comparing improvements
Some checks failed
CI - build eBPF modules / build (6.0, 1.6.0) (push) Has been cancelled
Test resources validation / Install tools (push) Has been cancelled
Build status / Build (push) Has been cancelled
When comparing UI/daemon versions to see if they're compatible, we only
use the first 2 components (1.7.xxx), so discard the rest to allow
different versions (1.6.5.1, 1.6.5-1, 1.6.5-rc1, etc)
2024-02-09 17:01:55 +01:00
Gustavo Iñiguez Goia
b05eace022
Bump GUI versions to 1.6.5.1 2024-02-09 14:51:17 +01:00
Gustavo Iñiguez Goia
6809776393
pop-ups: fixed regression for remote nodes
When a new pop-up is triggered from a remote node, the GUI crashed.
This error was introduced by this commit 9fc1da5.

Thanks to @zero77 for reporting it super fast (#1093).
2024-02-09 13:21:01 +01:00
Gustavo Iñiguez Goia
1d2c0703ff
pop-ups: filter by absolute path+cmdline on some cases
Some checks failed
CI - build eBPF modules / build (6.0, 1.6.0) (push) Has been cancelled
Test resources validation / Install tools (push) Has been cancelled
Build status / Build (push) Has been cancelled
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:53:07 +01:00
Gustavo Iñiguez Goia
dd3aba1a6a
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.

(cherry picked from commit 016f4842ff)
2024-02-08 15:34:05 +01:00
Gustavo Iñiguez Goia
60c6ac4aa8
Bump daemon and ui versions to 1.6.5 2024-01-10 01:05:34 +01:00
Gustavo Iñiguez Goia
946799b5e9
removed checksum references 2024-01-08 22:15:08 +01:00
Gustavo Iñiguez Goia
f93825a550
ui: make fw dialog status label selectable
- Allow to select by mouse or keyboard the status messages of the
   firewall.
 - Enable word wrapping.

(cherry picked from commit e905163a03)
2024-01-08 20:53:31 +01:00
Gustavo Iñiguez Goia
af121bb8e6
ui: fixed config option
(cherry picked from commit 94492f0a71)
2024-01-08 20:52:45 +01:00
Gustavo Iñiguez Goia
435dffc0a1
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

(cherry picked from commit 6006717b86)
2024-01-08 19:26:17 +01:00
Gustavo Iñiguez Goia
cc203a4a12 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).

(cherry picked from commit 250dcb1f6d)
2024-01-08 15:56:14 +01:00
Gustavo Iñiguez Goia
e033cbc342 ui,pop-ups: updated AppImage pattern
rel: #1066
(cherry picked from commit 4f9b69961c)
2024-01-08 15:51:42 +01:00
Gustavo Iñiguez Goia
9fc1da509a 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

(cherry picked from commit 56775cd62a)
2024-01-08 15:51:35 +01:00
Gustavo Iñiguez Goia
f0437a179f 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

(cherry picked from commit 827d7398f5)
2024-01-08 15:51:29 +01:00
Gustavo Iñiguez Goia
ec3f515980 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
(cherry picked from commit 4499a5aaf0)
2024-01-08 15:51:22 +01:00
Gustavo Iñiguez Goia
c3dc1fcc4a
ui: use single quotes for raw strings
Some checks failed
CI - build eBPF modules / build (6.0, 1.5.0) (push) Has been cancelled
CI - build eBPF modules / build (6.0, master) (push) Has been cancelled
Test resources validation / Install tools (push) Has been cancelled
Build status / Build (push) Has been cancelled
part of the previous commit. Missed this change.
2023-11-08 14:36:59 +01:00
Gustavo Iñiguez Goia
6c25be1176
ui: use raw strings notation to for regexps
and silence python3.12 warnings.
2023-11-08 14:14:07 +01:00
Gustavo Iñiguez Goia
f29e6dcc14
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:57:14 +01:00
Gustavo Iñiguez Goia
6e08629fed
ui,prefs: set db in-memory name correctly
Instead of :memory:, use file::memory:

Related: #1030
2023-11-06 21:49:35 +01:00
Gustavo Iñiguez Goia
c35baf364e
Bump ui version to v1.6.4
Added qgnomeplatform-qt5 as dependency for rpm packages. Otherwise on
Fedora 29 there's no window decorations.
2023-11-06 01:14:38 +01:00
Gustavo Iñiguez Goia
bcbfe3bbe2 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-06 00:01:14 +01:00
Gustavo Iñiguez Goia
ad896b47a7 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-06 00:01:01 +01:00
Gustavo Iñiguez Goia
afa235d1a9 ui: preserve rules' columns width
Preserve rules' columns width when selecting rules left panel items.

Closes: #822
2023-11-06 00:00:41 +01:00
Gustavo Iñiguez Goia
572e0c56b7 ui: fixed crash while refreshing views
There was a problem while refreshing and reconfiguring the views'
columns, which caused segfaults.
2023-11-05 23:59:59 +01:00
Gustavo Iñiguez Goia
d1ac73c416 ui: improved views behaviour
- Fixed painting rows while scrolling using the mouse.
   Sometimes blank lines were inserted at the bottom of the views when
   scrolling with the mouse.
 - Avoid to rerepaint rows when switching views or scrolling.
 - Selecting a row marks it for tracking, ensuring it's deselected when
   the row is not visible, and reselected when the row becomes visible
   during scrolling.

The following behaviour has not changed:
 - Selecting a row that was previously selected, deselects it.
 - Keyboard navigation.

Not fixed yet:
 - Selecting all the rows of a view with the mouse, visibles and not visibles.
 - Entering into a detailed view, going back to the previous view, and
   select (restore) the row that was previously selected (causes a
   segfault in a particular case).

Related: #1037
2023-11-05 23:59:39 +01:00
Gustavo Iñiguez Goia
b3b98ac209 ui,stats: improved rules deletion
When selecting rules with CTRL+A it was not deleting all the rules.
Besides rules with the name empty was sent to the daemon.

Related: #1037
2023-11-05 23:59:00 +01:00
Gustavo Iñiguez Goia
47ca758e7c ui,rules: fixed refrehsing list, fixed typos
- Fixed refreshing list when deleting rules.
- Fixed typos that were preventing errors from being displayed correctly.

Closes: #1056
2023-11-05 23:58:31 +01:00
Gustavo Iñiguez Goia
d3e118e4cf ui,rules: fixed typo
It was preventing from diplaying an error when trying to open the
ruleseditor to edit a rule.
2023-11-05 23:57:44 +01:00
Gustavo Iñiguez Goia
d18194832e ui,stats: fixed typo 2023-11-05 23:57:15 +01:00
petterreinholdtsen
2ee9d33aa0 Fixed typo in translatable string (Your are->You are).
Typo discovered during translation.
2023-11-05 23:54:52 +01:00
Gustavo Iñiguez Goia
79ac6306a5
Bump GUI version to v1.6.3
Some checks failed
CI - build eBPF modules / build (6.0, 1.5.0) (push) Has been cancelled
CI - build eBPF modules / build (6.0, master) (push) Has been cancelled
Test resources validation / Install tools (push) Has been cancelled
Build status / Build (push) Has been cancelled
2023-08-17 00:28:37 +02:00
Gustavo Iñiguez Goia
eb89a90e55
ui: fixed setting daemon default action
Reject option was not being taken into account.

Closes #1017
2023-08-16 11:55:46 +02:00
selfdenial
feee8919b7 Introduce Sqlite3 WAL mode 2023-08-08 22:37:24 -06:00
Gustavo Iñiguez Goia
6556eed1ae
ui,prefs: allow to configure node's TLS settings
Some checks failed
CI - build eBPF modules / build (6.0, 1.5.0) (push) Has been cancelled
CI - build eBPF modules / build (6.0, master) (push) Has been cancelled
Test resources validation / Install tools (push) Has been cancelled
Build status / Build (push) Has been cancelled
2023-07-31 13:16:52 +02:00
Gustavo Iñiguez Goia
ce7c3f8002
Bump versions to v1.6.2 2023-07-31 00:36:33 +02:00
Gustavo Iñiguez Goia
331fa177d8
ui,db: added neede files for schema upgrades, other improvements
- Added needed files to upgrade DB schema.
- Use datetime.strptime instead of fromisoformat, to support python3.6
- More debug logs to better analyze problems.

Related: #988
2023-07-31 00:19:39 +02:00