Commit graph

44 commits

Author SHA1 Message Date
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
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
c97c322bcb
allow to secure (abstract) unix socket comms
- Allow to use SSL certificates to secure unix sockets communications.
- Allow to use abstract users sockets for server and nodes.

Go gRPC doesn't seem to understand unix sockets addresses that start
with "unix-abstract:", and python gRPC doesn't seem to understand
"unix:@" addresses.
Therefore, on the server (python gRPC) we use the format "unix:@" to
specify the address where the server will listen on, and rewrite it to
"unix-abstract:" before starting the server.

Note about certs and abstract unix sockets:
 When creating the SSL certificates, you'll have to specify the
 address of the unix socket as the Common Name of the certificates:

  Address: "unix:@my-abstract-socket"

  Common Name: @my-abstract-socket
2023-07-19 01:31:13 +02:00
Gustavo Iñiguez Goia
9259442451
ui: minor improvements
- delete ipc socket on exit
- save ipc socket under /run/user/.../opensnitch/
- added new contributor
2023-06-25 15:28:43 +02:00
Gustavo Iñiguez Goia
f63d9dce72
ui,prefs: allow to configure CA cert for TLS comms
TLS simple: server cert + key
TLS mutual: CA cert + server cert + server key
2023-06-25 13:56:05 +02:00
Gustavo Iñiguez Goia
b1e85da2f7
ui: restrict ipc socket permissions
- Restrict ipc socket permissions to the current user.
- Store ipc socket in the runtime private dir of the user.
2023-06-25 13:48:56 +02:00
Wojtek Widomski
440e00dae1 add --background command line argument 2023-06-24 14:24:10 +02:00
Wojtek Widomski
4e87b1f8e4 use QLocalSocket and QLocalServer
use QLocalSocket and QLocalServer instead of lockfile
This allows to open window of running instance
when user is trying to start new instance.
2023-06-24 13:46:42 +02:00
Gustavo Iñiguez Goia
11bb32cbae
ui: allow to load credentials from settings file
- added munix9 to the list of contributors.
2023-06-24 00:52:42 +02:00
Gustavo Iñiguez Goia
12b4cf3104
added option to secure channel communications
Allow to cypher channel communications with certificates.

There are 3 authentication types: simple, tls-simple and tls-mutual.

 - 'simple' wont't cypher communications.
 - 'tls-simple' uses a server key and certificate for the server, and a
   common CA certificate or the server certificate to authenticate all
   nodes.
 - 'tls-mutual' uses a server key and certificate for the server, and a
   client key and certificate per node.

There are 2 options to verify how gRPC validates credentials:
 - SkipVerify: https://pkg.go.dev/crypto/tls#Config
 - ClientAuthType: https://pkg.go.dev/crypto/tls#ClientAuthType

Example configuration:
    "Server": {
        "Address": "127.0.0.1:12345",
        "Authentication": {
            "Type": "tls-simple",
            "TLSOptions": {
                "CACert": "/etc/opensnitchd/auth/ca-cert.pem",
                "ServerCert": "/etc/opensnitchd/auth/server-cert.pem",
                "ClientCert": "/etc/opensnitchd/auth/client-cert.pem",
                "ClientKey": "/etc/opensnitchd/auth/client-key.pem",
                "SkipVerify": false,
                "ClientAuthType": "req-and-verify-cert"
            }
        }
    }

More info: https://github.com/evilsocket/opensnitch/wiki/Nodes
2023-06-23 16:51:36 +02:00
Gustavo Iñiguez Goia
0a30906305
ui: minor refactoring
- Use Message util.
  Maybe it'd be better to display a desktop notification for a more
  better experience, or a dialog box if notify2 is not installed.
- Translate warning message.
2023-06-22 01:17:06 +02:00
Gustavo Iñiguez Goia
c387ddf468
ui: minor refactoring
- Removed unused imports.
- Moved max gRPC channel settings to config.py
2023-06-22 00:49:03 +02:00
munix9
59621017e9
xdg updates + autostart + lockfile (#964)
* require pyxdg

* extend xdg, introduce autostart

* use xdg_current_desktop from opensnitch.utils.xdg

* control autostart in tray

* dont use pkill anymore

* check if os-ui is already running

* don't require pyxdg (for now)

* simplify xdg_current_desktop

* do not use pyxdg (for now), use some code from there

* update autostart status when menu is open

* fix possible SameFileError
2023-06-21 23:28:13 +02:00
selfdenial
9a89ad98b9 Use if statements instead of match/case to set max_message_length. 2023-06-05 10:21:08 -06:00
selfdenial
f6623fad95 Add non-gui setting for gRPC server max_message_length. 2023-06-03 23:29:40 -06:00
Gustavo Iñiguez Goia
e786bf5c50
ui, i18n: allow to change language from the GUI
Restarting the GUI is required for now.

Closes #709 #803
2023-02-28 01:59:10 +01:00
Petter Reinholdtsen
3d38ffbd07 Added copyright and license header to daemon/main.go and ui/bin/opensnitch-ui.
Based on git history with no lower threshold on contributions, so any
contributors get a copyright claim in the code.
2023-01-23 06:13:40 +00:00
Gustavo Iñiguez Goia
9762ec377e
ui, cli: added options to enable debug messages 2023-01-16 13:41:53 +01:00
Gustavo Iñiguez Goia
e952f73e18
ui: fixed crash on Wayland resizing the pop-ups
- Fixed crash on Wayland (Fedora 37) when setting the minimum and
   maximum size of a pop-up. setMinimumSize() makes crash the GUI.
 - With the above fix, we don't need to set QT_QPA_PLATFORM
   (Closes: #794)
2023-01-10 00:32:01 +01:00
Gustavo Iñiguez Goia
5264988a36
ui: fixed pop-up crash on wayland
Clicking on the [+] pop-up button crashes the GUI on wayland (f37).
Switching to xcb plugin fixes this problem (QT_QPA_PLATFORM=xcb)
2023-01-07 22:26:31 +01:00
Gustavo Iñiguez Goia
ba5208ef02
ui, cli: added proto/grpc versions to cli tool
Display what versions is using the GUI. It'll help to debug issues.

For next releases we may need to check incompatibilities between grpc
and protobuf (#790).
2023-01-06 23:57:15 +01:00
Gustavo Iñiguez Goia
30a8c90829
ui: enable HighDpiPixmaps, fixed nodes list
- Enable high-dpi pixmaps for icons.
 - Fixed nodes connections listing when accesing from the Events view.
2023-01-03 12:31:12 +01:00
Gustavo Iñiguez Goia
c7ee55ab1a
ui, cli: added debug option, better help.
- Added --debug option, to get stacktraces when the GUI segfaults.
 - Added examples to show how to listen on IP addresses.
2023-01-03 00:59:12 +01:00
Gustavo Iñiguez Goia
9d5823c48b
ui: improved nodes management
- Fixed reconfiguring nodes address from/to unix sockets <-> net
   sockets.
 - Fixed updating nodes status when connecting/disconnecting.
2023-01-02 19:54:15 +01:00
Gustavo Iñiguez Goia
31d2cd550d
ui: fixed launcher import 2022-11-17 00:07:42 +01:00
Gustavo Iñiguez Goia
915b325a00
ui: allow to configure (local) server address
Up until now, the daemon communicated with the GUI via a unix socket,
stored in /tmp.

/tmp however can be erased at any time (tmpreaper, systemd-tmpfiles.d),
which may lead to remove our unix socket file, and hence losing
connectiong with the daemon.

Now the user has the option to store the socket file under
/run/user/$uid/opensnitch/
https://www.linuxbase.org/betaspecs/fhs/fhs.html#runRuntimeVariableData

In the future we may switch to this path by default.
2022-10-06 13:57:52 +02:00
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
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
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
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
4332469fc2 improved nodes connectivity handling
problem:
 - after losing network connectivity node<->server, the node didn't restore
   the connection. In reality, the connection with the server was not
   closed, but the notifications channel was closed due to inactivity
   after 20s.

set inactivity timeouts to 20s on both node and server. Previous
timeouts were 2h for the main connection and 20s for the streaming
channels (notifications).

- get rid of the logic to determine if the server is alive or not based
  on sending pings.
  Instead, use the connection events when a node connects/disconnects
  (Subscribe).
  The Ping call is still used to send the statistics.

other:
- fixed exception when updating the status of a node.
2021-04-11 20:55:14 +02:00
Gustavo Iñiguez Goia
a6d1e585e1 ui, bin: fixed typo that prevented loading translations 2021-01-03 00:50:35 +01:00
Gustavo Iñiguez Goia
e05cb3a865 added support for internazionalization
Read ui/i18n/README.md for information about how to add new
languages.

requested here: #319
2021-01-02 21:40:19 +01:00
Gustavo Iñiguez Goia
c25f49d8a7 ui: fixed launching the UI on more environments
Better resolve where the UI python package is.

related #59
2020-11-28 11:02:03 +01:00
Gustavo Iñiguez Goia
7deb2f3212 ui: fixed python3 system libs path on OpenSuse
/usr/lib/python3/dist-packages/ was missing on OpenSuse TumbleWeed.
Maybe it's not the best solution, but solves the problem for now.

Reported by zaggynl here #59.
2020-09-26 01:13:32 +02:00
Gustavo Iñiguez Goia
1101c1efab UI: allow to configure max allowed clients.
Default set to 10 instead of 4.
2020-05-12 01:18:40 +02:00
Gustavo Iñiguez Goia
c4a9a21afa fixed HighDpi scaling
This should fix the warning message:
"Attribute Qt::AA_EnableHighDpiScaling must be set before
QCoreApplication is created."

Which should fix the small fonts reported by some users.
We may also need AA_UseHighDpiPixmaps.
2020-02-22 00:48:19 +01:00
Gustavo Iñiguez Goia
b409eca0ed Fixed UI crash when configuring high dpi scaling on some systems
On LinuxMint18 even with a compatible PyQt lib, it crashes, so just
don't set this option.
2020-02-19 01:04:58 +01:00
Gustavo Iñiguez Goia
1e6d2c0b67 Unified UI config files
Originally UI config file was saved to ~/.opensnitch/ui-config.json

Now those values are saved to ~/.config/opensnitch/settings.conf, along
with new ones.

Closes #3
2020-02-09 20:56:26 +01:00
Gustavo Iñiguez Goia
77018a82a1 EnableHighDpiScaling only if qt version >= 5.6.0
It was addded in 5.6 version
https://doc-snapshots.qt.io/qtforpython/PySide2/QtCore/Qt.html
2019-11-25 21:41:25 +01:00
MiWCryptAnalytics
f8ede5ed0e
Add UI Scaling for HiDPi Support
This fixes the scaling issue on hi dpi displays (4K, etc) that render the window too small with overlapping widgets.
2018-09-17 23:52:51 -04:00
evilsocket
1833e78177
UI default behaviour can now be configured with a JSON file (closes #153) 2018-04-16 12:54:25 +02:00
evilsocket
ec6ecea8b4
UI is now using python3 2018-04-11 15:35:29 +02:00
evilsocket
2355c3c400
made ui application pip installable (ref #118) 2018-04-10 16:56:29 +02:00
Renamed from ui/main.py (Browse further)