Commit graph

1808 commits

Author SHA1 Message Date
Gustavo Iñiguez Goia
aea751793f
ui, procdialog: added missing import 2024-09-25 21:53:18 +02:00
Gustavo Iñiguez Goia
ee225cd815
ui,procdialog: allow to filter sockets and files
Two new options has been added to filter the process open files list by
sockets and regular files (by default it display pipes, etc).
2024-09-25 21:45:38 +02:00
Gustavo Iñiguez Goia
9e0f3a4797
introducing daemon tasks
daemon tasks are actions that are executed in background by the daemon.

They're started from the GUI (server) via a Notification (protobuf),
with the type TASK_START (protobuf).

Once received in the daemon, the TaskManager starts the task in
background.

Tasks may run at interval times (every 5s, 2days, etc), until they
finish an operation, until a timeout, etc.

Each task has each own configuration options, which will customize the
behaviour of its operations.

In this version, if the GUI is closed, the daemon will stop all the
running tasks.
Each Task has a flag to ignore this behaviour, for example if they need
to run until they finish and only send a notification to the GUI,
instead of streaming data continuously to the GUI (server).

 - Up until now we only had one task that could be initiated from the GUI:
   the process monitor dialog. It has been migrated to a Task{}.
 - go.mod bumped to v1.20, to use unsafe string functions.
 - go.sum updated accordingly.
2024-09-25 01:00:38 +02:00
Andika Triwidada
23811e749e * Add Indonesian translation
* sort translation files in opensnitch_i18n.pro
2024-09-23 12:01:13 +00:00
Gustavo Iñiguez Goia
05eed4ef04
ui,plugins: added missing files
The plugins were not included when building the wheel.
2024-09-20 23:08:17 +02:00
Gustavo Iñiguez Goia
c832accf5d
ui,popups: new button to update the checksum of all rules
When filtering by checksum and the checksum of a rule changes, we
display a warning on the popup, indicating that something happened.

The user had the option to update the checksum of one rule, directly
from the popup.

Now there's a new button to update all the rules that have a checksum as
filtering parameter.
2024-09-20 22:48:32 +02:00
Gustavo Iñiguez Goia
61727af788
ui,rules: do not verify lists path on remote nodes
When creating/editing rules to filter by lists of nets/IPs/domains, we
check if the path entered is a directory.

However on remote nodes, the path may not exist where the GUI is
running, but be valid where the daemon is running.

Now we only check the path if the node where it's being configured is
local.

Closes #1174
2024-09-18 00:20:05 +02:00
Gustavo Iñiguez Goia
f669c780b4
ui: fixed syntax warning building appimages paths
SyntaxWarning: invalid escape sequence '\.'

(#1154)
2024-09-17 22:48:37 +02:00
Gustavo Iñiguez Goia
14747a04ad
ui,plugins: added configuration examples 2024-09-17 00:24:48 +02:00
Gustavo Iñiguez Goia
81757c6840
Merge pull request #1187 from ariel-anieli/makefile-ebpf
ebpf_prog/Makefile: removed useless `LLVM_STRIP`
2024-09-16 21:39:26 +00: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
Ariel Otilibili
5428278ed9 ebpf_prog/Makefile: removed useless LLVM_STRIP
`LLVM_STRIP` appears only once in Makefile:

```
$ grep LLVM Makefile
LLVM_STRIP ?= llvm-strip -g
```

Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2024-09-13 19:28:18 +02:00
Gustavo Iñiguez Goia
791e28d764
Merge pull request #1179 from abuturabofficial/patch-1
remove lagacy cname_trackers.txt reference from update_adlists.sh
2024-09-10 22:28:03 +00:00
Gustavo Iñiguez Goia
8bb1d44db8
Merge pull request #1185 from ariel-anieli/makefile-ebpf
ebpf_prog/Makefile: temp files are now handled by a pattern rule
2024-09-10 22:21:38 +00:00
Ariel Otilibili
cfd267a56a ebpf_prog/Makefile: temp files are now handled by a pattern rule
* `%.bc` are autoremoved: these LLVM IR files are intermediate [1]
* `%.o` are now produced by a wildcard search
* introduced `.SUFFIXES:` for cleaning up the implicit rules [2]
* else Makefile would have generated `%.o` from its own database.

[1] https://www.gnu.org/software/make/manual/html_node/Chained-Rules.html
[2] https://www.gnu.org/software/make/manual/html_node/Suffix-Rules.html

Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2024-09-10 12:06:49 +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
AbuTurab
f8d38cff9e
remove lagacy cname_trackers.txt reference
AdGuard no longer maintains/supports that file type, and the link points to a 404 error page.
2024-08-29 11:02:37 +05:00
Simone Margaritelli
1984fb9954
Update README.md 2024-07-13 16:43:29 +02:00
Gustavo Iñiguez Goia
86f0bea18d
updated workflow compilation deps
google.golang.org/protobuf/cmd/protoc-gen-go@v1.34.2 generates
protobuffers incompatible with go1.17, it fails with the error:
"ui/protocol/ui.pb.go:2716:47: predeclared any requires go1.18 or later
(-lang was set to go1.17; check go.mod)"

Notes:
 - consider using go1.18 as min required version if there's no problem
   compiling the daemon on Debian <= 13 and other distros.
 - github.com/golang/protobuf is deprecated and we should get rid of
it.
2024-07-03 14:41:31 +02:00
Gustavo Iñiguez Goia
f882cf428b
fw: fixed adding 'counter' obj to rules
https://wiki.nftables.org/wiki-nftables/index.php/Quick_reference-nftables_in_10_minutes#Counter
2024-07-03 14:26:11 +02:00
Gustavo Iñiguez Goia
c89b4908ce
deb: warn about buggy python3-grpcio version (1.30.2-3build6)
Ubuntu jammy package python3-grpcio, version 1.30.2-3build6, has a bug
which causes applications to use 100% of the CPU.

If after installing we detect that the buggy version is installed,
display a warning to the user with instructions on how to solve the
problem and links to the bug reports.

More information:
 - https://bugs.launchpad.net/ubuntu/+source/grpc/+bug/1971114
 - https://github.com/evilsocket/opensnitch/issues/647
2024-07-02 00:02:46 +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
68de35141b
use go-gen-grpc@v1.3.0 for compiling the daemon
With @1.4.0 fails with the error "undefined: grpc.StaticMethod"
2024-06-11 01:15:31 +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
58aa979cae
fixed loading rules when Created field is a timestamp
When exporting rules from the GUI, the Created field was exported as
timestamp. Importing rules worked fine, because json.Marshall() accepts
the timestamp format.

However, when the daemon was loading a rule with the Created field as
timestamp, since the field was defined as time.Time, it expected a RFC3339
string (https://pkg.go.dev/time#Time.UnmarshalJSON)
so it failed to parse the timestamp and the rule was not loaded.

Now the field is defined as string, it's always saved as RFC3339, and if
we fail to parse these fields we'll use a temporary date instead of
failing loading the rule.

More info:
https://github.com/evilsocket/opensnitch/issues/1140#issuecomment-2140904847

Closes #1140
2024-06-10 23:54:54 +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
41690b2d2d
set default rules directory if empty
Use /etc/opensnitchd/rules as the default directory if it has not been
provided via configuration.
2024-05-29 23:43:46 +02:00
Gustavo Iñiguez Goia
5234df7513
Merge pull request #1139 from redanaheim/master
Remove duplicate regex in system.go for -check-requirements
2024-05-27 21:23:12 +00:00
redanaheim
fa2f1068f6
Remove duplicate regex in system.go for -check-requirements 2024-05-26 23:22:53 +00:00
Gustavo Iñiguez Goia
03747ea0e3
improved config file reloading behaviour
Start monitoring the config file every time we read the file, to survive:
 - malformed json file
 - intermediate file removal (when writing we receive 2 write events,
   one of0 bytes)

"A watch will be automatically removed if the watched path is deleted or
renamed"
"A path can only be watched once; watching it more than once is a no-op and
will not return an error"
https://pkg.go.dev/github.com/fsnotify/fsnotify#Watcher.Add
2024-05-23 01:47:59 +02:00
Gustavo Iñiguez Goia
2238e63892
updated go.mod, added go.sum 2024-05-22 01:39:19 +02:00
Gustavo Iñiguez Goia
c0d1da20d2
improved rules reloading, cli parameters
- When reloading rules from a path:
   stop existing (domains,ips,regexp) lists monitors, stop rules
   watcher and start watching the new dir for changes, delete existing
   rules from memory, etc.
 - Previously, cli parameters (queue number, log file, etc) were taking
   into account before loading the configuration.
   Now the configuration file is loaded first (default-config.json), and
   if any of the cli parameter has been specified, it'll overwrite the
   loaded configuration from file.

   This means for example that if you use "-process-monitor-method proc",
   and "ebpf" is configured in default-config.json, firstly "ebpf" will
   be configured, and later "proc".

   (-queue-num option for now requires to match config option
   cfg.FwOptions.QueueNumber)
2024-05-22 00:47:54 +02:00
Gustavo Iñiguez Goia
661e3da48f
kill established connections only on fw/monitor changes 2024-05-19 23:43:12 +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
Gustavo Iñiguez Goia
1e6d2d464b
updated default-config.json with latest added opts
More info about these options:
https://github.com/evilsocket/opensnitch/wiki/Configurations
2024-05-16 00:51:30 +02:00
Gustavo Iñiguez Goia
eede54c525
allow to customize ebpf options
Allow to customize:

 - EventsWorkers: number of goroutines to handle kernel events.
   Default 8.

 - QueueEventsSize: max number of events in the queue.
   By default 0, meaning that it'll relay on the available goroutines to
   process the events. If it's > 0, and the daemon can't process the
   events fast enough, they'll be queued. Once the queue is full, it'll
   behave as it was of size 0.

If there're lost events, a message will be logged: "Lost ebpf events..."
2024-05-16 00:31:54 +02:00
Gustavo Iñiguez Goia
84361449f2
loggers, remote_syslog: check if we're connected
when writing, check if we're connected, or reconnecting.
2024-05-15 00:06:26 +02:00
Gustavo Iñiguez Goia
efc05663eb
fw: allow to configure interception queue number
- Added new configuration field to allow configure fw interception
   number queue (default to 0):
   "FwOptions": {
      "QueueNum": 0
   }
   (we still need to reconfigure nfqueue queues in order for this to
take effect).
 - If the fw configuration path is not supplied, default to
   /etc/opensnitchd/system-fw.json
2024-05-14 23:41:25 +02:00
Gustavo Iñiguez Goia
9afadcb009
fixed segfaults when loading fw/loggers
- The loggers were not being properly initialized.
 - The fw was only being load on reload, instead of on startup
   and reload.

Kudos to @1fishe2fishe for reporting this problem and proposing a
fix in #1130!
2024-05-14 19:47:35 +02:00
Gustavo Iñiguez Goia
221955ecf0
Merge pull request #1126 from tioguda/master
i18n: updated Brazilian Portuguese translation
2024-05-14 11:57:53 +00:00
Gustavo Iñiguez Goia
c9ad9005e3
fw minor changes
use struct{} instead of bool for exit channels, func parms cosmetic
change.
2024-05-13 01:38:57 +02:00