Commit graph

1467 commits

Author SHA1 Message Date
Gustavo Iñiguez Goia
edc9b17010
sys,fw: return errors when loading configurations 2023-07-01 23:13:31 +02:00
Gustavo Iñiguez Goia
f1ef00a5fd
tests: added nftables/system tests
- test add/delete system fw rules
- test fw config disabled.
2023-07-01 22:41:04 +02:00
Gustavo Iñiguez Goia
4a19fde155
tests: run tests as root 2023-06-30 16:29:20 +02:00
Gustavo Iñiguez Goia
0a2dcf6406
tests: added basic nftables/rules tests 2023-06-30 16:19:50 +02:00
Gustavo Iñiguez Goia
e345d61076
tests: added nftables/monitor tests 2023-06-30 10:51:18 +02:00
Gustavo Iñiguez Goia
78ac6c0f6b
tests: disable some tests by default, added utils.go tests
- These tests require permissions for creating new namespaces.
  By default disable them for now.
- Added utils.go tests.
2023-06-29 16:19:47 +02:00
Gustavo Iñiguez Goia
d3b40108c7
tests: added sys fw basic tables/chains tests 2023-06-29 11:27:18 +02:00
Gustavo Iñiguez Goia
5a0bd3bc27
added more requirements checks, minor code refactor
- Check kernel configs NET_DIAG_*.
- config.SaveConfiguration() -> config.Save()
2023-06-28 11:24:24 +02:00
Gustavo Iñiguez Goia
8240b7bfda
ui/client: minor code reorganization 2023-06-27 16:47:47 +02:00
Gustavo Iñiguez Goia
de45e1698b
ui: minor code reorganization 2023-06-27 16:19:51 +02:00
Gustavo Iñiguez Goia
af9a5ad0e1
updated bug report template 2023-06-25 21:51:04 +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
81d7333c2b
ui,prefs: changed default tab 2023-06-25 14:27:30 +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
Gustavo Iñiguez Goia
a233006d78
added more checks to -checks-requirements
Closes #976
2023-06-25 02:36:12 +02:00
Gustavo Iñiguez Goia
6d45d9db12
Merge pull request #975 from WojtekWidomski/master
Allow starting the GUI in background when tray not available
2023-06-25 00:43:48 +02:00
Gustavo Iñiguez Goia
dbc5a9cef3
ui,prefs: allow to configure certs and auth type
- Added options to configure authentication type and certs from the
  preferences dialog.
- Reorganize code a little bit to displaya message when restarting the
  GUI is needed.
2023-06-24 18:28:04 +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
b3f772c34d
ui: added needed file for auth with certificates 2023-06-23 17:05:45 +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
0d6b9101b0
ui: configure GUI autostart from global preferences 2023-06-22 12:15:44 +02:00
Gustavo Iñiguez Goia
6f752d56fe
ui,prefs: allow to configure gRPC channel max size 2023-06-22 01:42:13 +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
Gustavo Iñiguez Goia
c2da6d11c8
Merge pull request #969 from jackffmm/master
Dinit service file
2023-06-21 23:29:13 +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
Gustavo Iñiguez Goia
6e61958c23
ui: let DEs control notifications timeouts
There have been some issues (#673) informing that the notifications
timeout were not working on KDE.

On 843412d I wrote that the timeout unit is millisecond, as stated on
the docs here:
https://notify2.readthedocs.io/en/latest/#notify2.Notification.set_timeout

But after some trial and error:
 - set_timeout() units are in seconds, at least for KDE 5.26.3, Xfce
   4.18 and GNOME 43.
 - not specifying the timeout with set_timeout() lets the Desktop
   Environment handle the timeout for us, from their respective
   preferences window.

So at least now there're some DEs where the notifications are closed as
expected.
2023-06-20 12:48:03 +02:00
Gustavo Iñiguez Goia
f7eec83367
sys fw: allow to add icmp types by commas
- Previously we only supported multiple ICMP types on the same rule
by adding multiple keys:
 Key: type
 Value: echo-request
 Key: type
 Value: echo-reply

Now it's possible to specify them using ',':
 Key: type
 Value: echo-request,echo-reply

- Validate ICMP types before adding them.
2023-06-20 01:14:57 +02:00
jackffmm
0753ee3230
Add files via upload 2023-06-17 23:56:58 +02:00
Gustavo Iñiguez Goia
01069d363b
ui,fw: added help button to open the fw rules wiki 2023-06-17 12:01:26 +02:00
Gustavo Iñiguez Goia
06f333c281
ui,prefs: increased default timeout widget size 2023-06-17 11:41:21 +02:00
Gustavo Iñiguez Goia
370a978b24
changed systray warning help url 2023-06-16 11:48:47 +02:00
Gustavo Iñiguez Goia
0e6f9995e8
Bump rpm versions to 1.6.0.1 2023-06-16 11:42:22 +02:00
Gustavo Iñiguez Goia
5f5cf11c67
updated systray warning help url 2023-06-16 01:59:09 +02:00
Gustavo Iñiguez Goia
01dc1d2e9b
Bumped debian packages versions to 1.6.0.1
1.6.0-rc.5-1 is newer than 1.6.0-1 unfortunately.
2023-06-15 23:52:56 +02:00
Gustavo Iñiguez Goia
c42232d92e
ui,events: fixed behaviour jumping to the rules view
* There was a situation where the details of an app rule was not being
displayed correctly:
 - on the tab rules select any system fw rule.
 - go to the Events tab
 - double click on the Rule column to view the details.
 - instead of the app rules details, the list of system fw rules was
   displayed.

* On the other hand, when going back from the details view, the list of
  rules was not being refreshed correctly.

  In this situation now we select the Application rules view.
2023-06-15 19:18:58 +02:00
Gustavo Iñiguez Goia
a897dd9dc3
ui: updated url with fw config upgrade instructions
Some users coming from v1.5.x version may end up with an incompatible fw
configuration, so point them to a url with instructions to solve it.
2023-06-15 17:05:54 +02:00
Gustavo Iñiguez Goia
7905bf4477
ui: make some label texts selectable by mouse 2023-06-15 16:15:34 +02:00
Gustavo Iñiguez Goia
64a5222950
ui:don't allow duplicated values when adding fw rules
When adding fw rules, don't allow duplicated values. For example:

 "Name": "meta",
 "Values": [
   {
     "Key": "mark",
     "Value": "2"
   },
   {
     "Key": "mark",
     "Value": "2"
   }
2023-06-15 13:01:53 +02:00
Gustavo Iñiguez Goia
6402031f54
ui,fw: beautify rules parameters,organized imports 2023-06-15 01:46:47 +02:00
Gustavo Iñiguez Goia
cf3205b209
ui, prefs: set pop-ups tab as the default tab 2023-06-15 01:26:13 +02:00
Gustavo Iñiguez Goia
682e6d667b
ui, prefs: reorganized Nodes options 2023-06-15 01:24:21 +02:00
Gustavo Iñiguez Goia
aa71b7d9f6
ui, prefs: fixed exception loading outdated config
Be sure that users with outdated default-config.json files can load and
save the configuration (those without LogUTC).
2023-06-15 01:07:20 +02:00
Gustavo Iñiguez Goia
000a2f1848
avoid notifications errors when saving config
- fsnotify notifies 2 WRITE events sometimes (known bug), which leads to
read 0 bytes one of the times.

As now we send these errors to the GUI, on some systems we were
displaying an error reading the config, which was not really the case.

- Only parse the config before writing it to disk, instead of call the
  load() method.
2023-06-15 00:50:07 +02:00
Gustavo Iñiguez Goia
77c3cf4512
fw rules: beautify rules escription
make it more nftables style:
 ip daddr 127.0.0.1 tcp dport 53 accept
instead of:
 ip daddr == 127.0.0.1 tcp dport == 53 accept

It'll be easier to translate our rules to nftables rules in this way.
2023-06-14 17:31:12 +02:00
Gustavo Iñiguez Goia
9bad34bb16
changed default config permissions on saving
- Changed default permissions of default-config.json, system-fw.json
 - Changed bool values by constants.
2023-06-14 12:10:19 +02:00
Gustavo Iñiguez Goia
cc2b4f5824
ui,fw: don't allow empty rules 2023-06-14 01:27:40 +02:00