Commit graph

487 commits

Author SHA1 Message Date
Gustavo Iñiguez Goia
f54eb789ff ui: improved shutting down
We needed to close the Notifications channel of each node on close.
Closing only grpc's server was not enough.

Closes #677
2022-06-24 13:23:38 +02:00
Gustavo Iñiguez Goia
1b28fad03f ui,fw: improvemed firewall disabling
- When disabling the firewall, if the input policy is DROP, it must set
to ACCEPT, to allow outbound connections.
- Better widgets disabling/enabling.
2022-06-23 17:28:36 +02:00
Gustavo Iñiguez Goia
e1ed51e7c5 ui,notifications: fixed initialization 2022-06-23 00:53:36 +02:00
Gustavo Iñiguez Goia
98ddd01524 ui, events: improved displaying the events window
When loading and setting the query limit configured, it was causing to
fire an unwanted combobox event, resulting in a DB query without limits,
which in turns with a lot of events was causing slowdowns when displaying
the events window.
2022-06-21 21:18:25 +02:00
Gustavo Iñiguez Goia
cfb1d648a8 ui: fixed loading /etc/services
Thanks @munix9! for spotting this problem, and providing a solution:
 #671
2022-06-21 20:46:15 +02:00
Gustavo Iñiguez Goia
cbc9d2a1a9 ui, pkgs: added netbase/setup/netcfg as dependency
Added netbase (debian based distros) or setup (fedora) or netcfg
(opensuse) as dependency, to allow to read the file /etc/services.

 #671
2022-06-21 12:56:16 +02:00
Gustavo Iñiguez Goia
59ea9e146a ui: fixed exception loading /etc/services
Closes #671
2022-06-21 10:03:20 +02:00
Gustavo Iñiguez Goia
e974364629 ui, firewall: support older protobuf versions
We were using insert() and append() to add rules to the list of rules.
However these methods are only available on protobuf => 3.8.0

In order to have a better user experience, we'll use extend() instead of
append(). If insert() is available, then we'll use it. This way the
users won't have to install manually a newer protobuf version.

Note: using extend() instead of insert() means that the rule won't be
added on top of all the rules of that chain. If a user with an older
protobuf version (<= 3.8.0) adds a rule, it'll be added to the bottom of
the list, and maybe there're other rules that take precedence.
2022-06-02 00:23:15 +02:00
Gustavo Iñiguez Goia
b49de30d54 ui, icons: better DE integration
In order to display icons on the GUI, we use the Icon Naming
Specification defined by freedesktop [0].

However these icons are not always available due to several reasons.
In this situation until now, we have relied on the Qt's built-in
icons [1].

It has worked fine until Fedora 36/Gnome 4x, where even some built-in Qt
icons are missing (SP_VistaShield in particular).

Since Gnome uses symbolic icons [2], falling back to these icons when
the original one doesn't load, helps to display the missing icon.
These icons have the same name than the ones defined by freedesktop, but
with "-symbolic" as a suffix.

Tested on u16, u18, pop22.04, tumbleweed 15.3, f36, devuan/debian 11
(lxqt, unity, gnome3/4, kde).

If you think that there's a better way of handling this situation,
please, open an issue or submit a PR with a fix.

[0] https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
[1] https://doc.qt.io/qtforpython-5/PySide2/QtWidgets/QStyle.html#PySide2.QtWidgets.PySide2.QtWidgets.QStyle.StandardPixmap
[2] https://wiki.ubuntu.com/SymbolicIcons
2022-05-29 17:28:13 +02:00
Gustavo Iñiguez Goia
4e4bd9dcf7 ui, stats: fixed exception when loading tree panel 2022-05-16 11:50:41 +02:00
Gustavo Iñiguez Goia
3c524c1942 ui, rules: added description field
- Added ability to add a description to the rules.
- Display the description field on the Rules view, and remove the internal
  fields (operator, operator_data, etc).
- Added DB migrations.
- Improved rules' executable path field tooltip (#661).

Closes #652 #466
2022-05-12 13:38:23 +02:00
Gustavo Iñiguez Goia
db4646dec8 rpm pkgs: deploy dns ebpf module, add grpcio as dep
- Deploy DNS eBPF module when installing the daemon.
- Include python3-grpcio as dependency. For older systems we'll use the
  old .spec file.
2022-05-05 01:16:38 +02:00
Gustavo Iñiguez Goia
b626e3fea2 bump nftables dependency version, packaging changes
- Bump nftable version to depend on latest version with fixes.
- Include opensnitch-dns.o eBPF object when creating the deb package.
- Replaced Suggests by Recommends, to install addtional but not
  essential packages (like python3-pyasnc, and others).
- Added python3-grpcio, python3-protobuf and python3-slugify as
  dependencies.
  For systems without these packages, we'll use the old debian/ dir.
2022-05-04 18:36:50 +02:00
Gustavo Iñiguez Goia
cb74058b96 Bump versions to 1.6.0rc1 2022-05-04 14:47:45 +02:00
Gustavo Iñiguez Goia
d9e0c59158
Allow to configure firewall rules from the GUI (#660)
* Allow to configure firewall rules from the GUI (WIP)

New features:
- Configure and list system firewall rules from the GUI (nftables).
- Configure chains' policies.
- Add simple rules to allow incoming ports.
- Add simple rules to exclude apps (ports) from being intercepted.

This feature is only available for nftables. iptables is still supported,
you can add rules to the configuration file and they'll be loaded, but
you can't configure them from the GUI.

More information: #592
2022-05-03 22:05:12 +02:00
Gustavo Iñiguez Goia
16c95d77fd ui: use default font for GUI labels.
There were some labels that didn't use the default font (Sans). This
caused that the labels text were not following system's theme.

Closes: #650
2022-04-19 01:41:35 +02:00
Gustavo Iñiguez Goia
0aef656c42 ui: allow to use GUI themes
Now the user can personalize GUI's appearance (#424).

There're 15 default themes, dark and light, that will help integrating
on some environments (#303, #335).

More themes can be added, by creating a new xml under
~/.config/opensnitch/themes/ or
/usr/lib/python3/dist-packages/opensnitch/

The lib used is https://github.com/UN-GCPDS/qt-material.
https://github.com/UN-GCPDS/qt-material#custom-colors
2022-03-22 13:16:18 +01:00
Gustavo Iñiguez Goia
6c54c2c52f ui: icons updated for better visibility on light themes
On light themes, the systray icon was barely visible. With the new
icons:
 - on dark themes should be pretty similar to what we already had.
 - on light themes they are much more distinguishables now.

Closes: #643, #339
2022-03-10 17:59:03 +01:00
Gustavo Iñiguez Goia
0a4c44bf71 ui: better rules listing
- Reduce query complexity by querying only connections table.
- Fixed filtering fields.
2022-03-01 16:37:02 +01:00
Gustavo Iñiguez Goia
e7ba2bdf7b ui: fixed launching the GUI on LxQt
Closes #618
2022-02-27 01:30:18 +01:00
Gustavo Iñiguez Goia
43adcef675 ui, events: fixed crash when clicking on the Rules column 2022-02-23 10:40:51 +01:00
Gustavo Iñiguez Goia
377b4c8f48 ui, events: improved UX, fixed Users' query
- Improved user experience, by remembering rows selection when going
  back from a detail view. Fixes #620.
- Fixed Users' view query (it didn't list user's connections
  correctly and it wasn't efficient).
2022-02-19 10:55:54 +01:00
Gustavo Iñiguez Goia
3128dec63c ui, events: improved restoring rules' columns
Restore rules' columns properly after:
 - double clicking on the Rules column of the main tab -> and then
   clicking on the back button.
 - clicking on the Temporary/Permanent items of the Rules tab.
 - clicking on a Rule and going back again to the list of rules.

Misc:
 - Disallow double-clicks when entering into a detail view from the
Events tab.
 - Removed extra/repeated columns adjusting.

Closes #619
2022-02-17 01:45:22 +01:00
Gustavo Iñiguez Goia
dd7cb13777 ui, pop-ups: fixed exception when app args are empty
reported here: #617
2022-02-10 21:56:35 +01:00
Marko Zajc
feaf8de508
Fix a minor typo (#610)
* ui, preferences: fixed typo
2022-02-05 20:58:27 +01:00
Gustavo Iñiguez Goia
c396ed652c ui, stats: fixed typo 2022-02-02 18:32:15 +01:00
Gustavo Iñiguez Goia
87722a71cd ui: fixed displaying clean events button
The button to delete events of a view is not displayed on the Nodes or
Rules view. It's only displayed in these views when entering into a
detail view.

Closes #605
2022-02-02 18:16:38 +01:00
tioguda
c716a9862a
Update Brazilian Portuguese translation 2022-01-29 13:19:14 -03:00
Gustavo Iñiguez Goia
c67e72075c ui, events window: allow to delete rules pressing DEL key
misc: initialize properly tables' header labels.

closes #601
2022-01-29 12:55:24 +01:00
Gustavo Iñiguez Goia
d9e8699702 Bump versions to v1.5.0 2022-01-28 23:29:31 +01:00
Gustavo Iñiguez Goia
c86125824c ui, notifications: fixed crash when dbus service fails
In some scenarios, showing a notificatio led to a crash with the error:

Dbus.Error.ServiceUnknown: The name ... was not provided by any .service
files.
2022-01-28 16:27:13 +01:00
Gustavo Iñiguez Goia
75cfd39ee1 ui, events: fixed delay displaying the main window
If the events were saved to a DB on disk,
there were long delays when opening the events window.

Now the events window loads faster, but the Events view is not as
performant as before. It means that while you're monitoring connections,
the GUI may consume 1-5% of the CPU and ~25% when you apply a filter
(only in that moment).

With the previous approach the CPU usage was close to 0-1% in both
cases, so we need to find a way of not causing long delays while being
performant.

More about this:
https://github.com/evilsocket/opensnitch/issues/566#issuecomment-1014930627
2022-01-20 00:04:56 +01:00
Gustavo Iñiguez Goia
bb253629e8 Bump versionis to v1.5.0rc2 2022-01-17 01:10:38 +01:00
Gustavo Iñiguez Goia
3ef33f6b31 ui: updated translations 2022-01-16 13:25:12 +01:00
Gustavo Iñiguez Goia
d8a36f8d41 ui, tests: fixed, added new ones. 2022-01-14 01:25:56 +01:00
Gustavo Iñiguez Goia
fd231e7645 ui: set app icon on all dialogs, misc.
- Use a good quality icon on all dialogs.
- Set the icon off when closing, to let the user know that we're
  exiting.
- Decreased time to wait to exit to 5secs.
2022-01-10 19:40:39 +01:00
Gustavo Iñiguez Goia
568ce696b5 ui: fixed crash with old pyqt, db improvements.
- setDesktopFileName() is only available since 5.7.
- use pragma quick_check to improve DB loading when events are saved to
  disk.
- optimize DB on close.
2022-01-09 13:08:19 +01:00
Gustavo Iñiguez Goia
2c825409da ui, deb: added python3-notify2 dependency
Also add python3-pyasn as Recommends.
2022-01-08 16:09:14 +01:00
Gustavo Iñiguez Goia
d264bb0e3a ui: fixed disabled buttons, improved svg icon 2022-01-08 11:58:39 +01:00
Gustavo Iñiguez Goia
7e5d809683 ui, prefs, notifications: fixes
- Fixed preferences dialog status error messages.
- Improved notifications
2022-01-08 01:00:04 +01:00
Gustavo Iñiguez Goia
1c523784a8 ui, notifications: fixed timeout
Timeouts are milliseconds, not seconds.
2022-01-07 19:07:23 +01:00
Gustavo Iñiguez Goia
843412d73e ui, notifications: allow to use system notifications
WIP.

Until now we used Qt's systray notifications. They couldn't be disabled
and didn't integrate well with non-Qt based Desktop Environments. Also
we depended on the system tray availability, which is not always
available (i3, phosh, ...).

Now the user can choose to use Qt's notifications, the system
notification service or disabled them completely.

Pros:
 - The notification style is defined by the Desktop Environment.
 - Can be configured globally from the system settings.
 - In many DEs, the notifications are grouped into a single view. So if
   you miss any event, you can go there and check out what happened.
 - Now we can display notifications on DEs where we couldn't before.
 - It's a standard supported by major DEs.

Cons:
 - Sometimes we can't connect to the D-Bus mainloop instance. We need to
   investigate it.

TODO:
 - Deny/Allow new outgoing connections from the notifications,
   replacing the current pop-ups.

Requested here: #468 , #476 and #477 .
2022-01-07 18:32:17 +01:00
Gustavo Iñiguez Goia
2d2a970735 ui, prefs: use buttons to change spins' values
Instead of the builtin buttons to increase the value of spin boxes, use
regular buttons. It'll be easier to use on touchable devices.

Note: This feature can also be achieved by customizing SpinBoxes' css
style.
2022-01-06 11:43:05 +01:00
Gustavo Iñiguez Goia
db901a870b ui, prefs: allow to configure events purge interval
Depending on the amount of network traffic, it may be necessary to purge
events faster.
2022-01-04 16:00:57 +01:00
Gustavo Iñiguez Goia
a2a0b8be20 ui: misc improvements
- If sys.exit() fails, force exit after 10s.
- Close db connection on exit.
- When closing the GUI (server), set connected nodes to offline.
  The status will be updated when nodes connect again / when the server
  is available again.
  Otherwise, we may end up with nodes marked as _online_ when in reality
  they're not connected.
- Add nodes on the main thread.
2022-01-04 00:21:30 +01:00
Gustavo Iñiguez Goia
9c54334b8e ui, pop-ups: set default app icon if none is found 2022-01-03 17:57:11 +01:00
Gustavo Iñiguez Goia
ac3965e3c0 ui: fixed app icon on gnome-shell/wayland, crash
- OpenSnitch icon was not shown when pressing alt+tab.
- Fixed crash when a node disconnected and the DB was updated.
2022-01-01 10:03:34 +01:00
Gustavo Iñiguez Goia
40098131bf ui, events: dont show context menu on rules' view 2022-01-01 00:00:06 +01:00
Gustavo Iñiguez Goia
67c9a7fa12 ui: added missing config.py changes, misc 2021-12-30 22:06:17 +01:00
Gustavo Iñiguez Goia
42b8774f52 ui, addrs view: display network name (ASN) per IP
Per IP listed in the Address view, display the ASN that the IP belongs
to.

The user must have installed the package python3-pyasn.

If the ASN DB files exist under user's opensnitch directory, we'll try
to load them:
 - ~/.config/opensnitch/ipasn_db.dat.gz
 - ~/.config/opensnitch/asnames.json

Otherwise we'll try to load the one shipped with the python3-pyasn
package (/usr/lib/python3/dist-packages/data/ipasn_20140513_v12.dat.gz)

The package python3-pyasn provides 3 utils to download latest data:
- pyasn_util_download.py --latest
- pyasn_util_convert.py --single rib.20211230.1600.bz2 ~/.config/opensnitch/ipasn_db.dat
- gzip ~/.config/opensnitch/ipasn_db.dat

More info: https://github.com/hadiasghari/pyasn
2021-12-30 18:55:43 +01:00