Commit graph

1736 commits

Author SHA1 Message Date
Gustavo Iñiguez Goia
aa0d5f14dd
ui,fw: fixed enable/disable global button
When there were no nodes connected, we disabled the global fw button
that enables/disables the fw.

Unfortunately when a node connected to the GUI, this button was not
clickable anymore.
2024-12-13 23:38:28 +01:00
Gustavo Iñiguez Goia
d825f1e9b0
ui,fw: fixed restoring policies when disabling fw
When disabling the fw, we change the default input and output policy to
Accept, not to block connections.

Due to a problem reloading the fw in the daemon, the policy was not
changed as expected.

This problem must be fixed in the daemon, but for the time being,
sending two configuration changes solves the issue (one for changing the
policy, and another one for disabling the fw).

Closes: #1225
2024-12-13 21:11:50 +01:00
Gustavo Iñiguez Goia
b1e279fb6b
get process tree when using process conector
When the Process Connector is used to intercept exec events, get and
build the process tree of a process.

PROCESS CONNECTOR feature was added here: 7a9bb17829
2024-12-13 20:14:55 +01:00
Gustavo Iñiguez Goia
353e10a638
Merge pull request #1229 from ariel-anieli/unused-vars-warns
Clear out warnings about unused variables
2024-12-09 00:52:46 +01:00
Ariel Otilibili
af7076663a Clear out warnings about unused variables
Seen while compile eBPF using `make CC=clang`.

```
opensnitch.c:330:6: warning: unused variable 'zero_key' [-Wunused-variable]
  330 |         u32 zero_key = 0;
      |             ^~~~~~~~
opensnitch.c:372:6: warning: unused variable 'zero_key' [-Wunused-variable]
  372 |         u32 zero_key = 0;
```

Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
2024-12-03 20:57:45 +01:00
Gustavo Iñiguez Goia
dd7271429e
ui,prefs: allow to configure more internal options
Allow to configure:
 - Bypass queue.
 - Firewall rules monitoring interval.

Related: 6622df9d38
2024-11-26 21:37:04 +01:00
Gustavo Iñiguez Goia
db84b551cc
ui,popups: fixed exception getting node address when adding a new rule
When a popup was displayed to the user, if they took more than 120s to
respond, the address of the node was lost.

This is because the daemon has hardcoded a max timeout of 120s. If it
fires, the call to AskRule is closed and the context is lost.

In this situation, save the address of the node at the start of AskRule,
so we can reuse it later.

Closes: #1219
2024-11-25 23:24:29 +01:00
Gustavo Iñiguez Goia
cdf93c72c1 ui: fixed delay closing the GUI
When closing the GUI we were not stopping notifications channel in all
cases, causing some issues (delays, log in/out problems, ...).

Closes #1217
2024-11-24 00:53:02 +01:00
Gustavo Iñiguez Goia
9a51e88ebc
updated/added new translations
- Updated de_DE, fr_FR, hu_HU, lt_LT, nb_NO, ru_RU, tr_TR and zh_TW
   translations.
 - Added Czech, Hindi, Indonesian, Italian and Swedish translations.
2024-11-06 23:06:04 +01:00
Gustavo Iñiguez Goia
06ffffbbe1
Merge pull request #1209 from atriwidada/minor_fix
Make example explanation consistent with regex - take #2
2024-10-23 00:51:55 +02:00
Gustavo Iñiguez Goia
7fd436a00f
ui/fw: allow to configure outbound default policy
Related: #1183, #884, #1201
2024-10-20 00:29:05 +02:00
Gustavo Iñiguez Goia
4091962770
cache of events minor fixes
- fixed storing the old proc after rebuilding the pids tree, when an
   item is replaced in cache.
 - removed not needed rlock.
2024-10-19 23:59:44 +02:00
Gustavo Iñiguez Goia
5fa561607f
daemon/ui tests updated 2024-10-19 20:43:45 +02:00
Gustavo Iñiguez Goia
6622df9d38
allow to configure nfqueue bypass flag
Nfqueue bypass option skips the enqueue of packets to userspace
if no application is listening to the queue.
https://wiki.nftables.org/wiki-nftables/index.php/Queueing_to_userspace

If this flag is not specified, and for example the daemon dies
unexpectedly, all the outbound traffic will be blocked.

Up until now we've been using this flag by default not to block network
traffic if the daemon dies or is killed for some reason. But some users
want to use precisely this behaviour (#884, #1183, #1201).

Now you can configure it, to block connections if the daemon
unexpectedly dies.

The option is on by default in the configuration (QueueBypass: true).
If this item is not present in the daemon config file, then it'll be
false.
2024-10-19 10:51:40 +02:00
Andika Triwidada
c53026c7b6 Quota example typo fix 2024-10-18 04:29:57 +00:00
Gustavo Iñiguez Goia
ebac200642
ReadEnv() minor improvement
- Improved peformance parsing the environment variables of a process.
 - Added ReadEnv() test.

For a 4kb environ file:

Benchmark-Old    58070 ns/op   19264 B/op   68 allocs/op
Benchmark-New    49174 ns/op   17488 B/op   12 allocs/op
2024-10-18 01:08:43 +02:00
Andika Triwidada
6d6afc4baf Make example explanation consistent with regex - take #2 2024-10-17 00:42:58 +00:00
Gustavo Iñiguez Goia
f63a48deff
calculate the ram usage of a process in the daemon
- Calculate the ram usage of a process in the daemon, using the page
   size of the system.
 - Added new functions to read some details of a process, so we can use
   them in other parts of the code.
2024-10-15 00:49:58 +02:00
Gustavo Iñiguez Goia
609edefbb7
added cache of events tests 2024-10-15 00:15:05 +02:00
Gustavo Iñiguez Goia
c3939c7dfd
added tasks tests
added tests for TaskManager, nodeMonitor and pidmonitor.
2024-10-11 00:01:00 +02:00
Gustavo Iñiguez Goia
e20e79d686
tasks improvements 2024-10-10 23:48:56 +02:00
Gustavo Iñiguez Goia
c1c7138e37
refactored tasks notifications
moved to their own file.
2024-10-10 00:24:29 +02:00
Gustavo Iñiguez Goia
3bf429b9ca
getProcPids() minor improvement
reduce allocs a little bit.
2024-10-09 23:54:40 +02:00
Gustavo Iñiguez Goia
83fad69316
tasks: added sockets monitor task (netstat)
Added new task to monitor local sockets of nodes, similar to ss or
netstat.

More info: #1112
2024-10-07 23:40:40 +02:00
Gustavo Iñiguez Goia
2fc1977d32
Merge pull request #1198 from C0rn3j/patch-1
Update README.md - Fix Discord link nesting
2024-09-28 16:39:36 +00:00
Gustavo Iñiguez Goia
61d81f7055
Merge pull request #1195 from atriwidada/master
Add Indonesian translation
2024-09-28 16:34:30 +00:00
Gustavo Iñiguez Goia
58613543e2 added new task nodemonitor
Added new task to monitor the resources of remote nodes, like
ram, swap, number of processes or load average of the system.

The task is initiated when the user selects a node, and the data
received from the node is added to the right panel of the Nodes tab.

The task is stopped when changing to another tab, or when deselecting a
node.

Particularly useful for monitoring remote nodes.
2024-09-28 10:09:19 +02:00
Martin
c7a4a2130b
Update README.md
Fix discord link being accidentally nested, it still worked before though.
2024-09-26 13:48:23 +02:00
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