Commit graph

1520 commits

Author SHA1 Message Date
Peter Dave Hello
dd419f095c i18n: add basic Traditional Chinese translation 2023-07-26 02:10:17 +08:00
Gustavo Iñiguez Goia
57a7f5b63d
removed debugging logs, fixed build 2023-07-25 02:11:35 +02:00
Gustavo Iñiguez Goia
26b8415925
force to reestablish non-local connections on start
When we start to intercept connections, we flush out the conntrack
table, to force already established connections reconnect again so we
can intercept them, and let the user choose if allow or deny them.

Since we no longer use conntrack states to intercept TCP connections, we
now close existing connections, leaving to the applications reestablish
them again.
Local connections are excluded, because it may cause problems with some
local servers.

Both options interfere with the established connections, so you may
experience ocasional network interruptions when enabling the
interception for the first time.

Discussion: #995
2023-07-25 01:42:54 +02:00
Gustavo Iñiguez Goia
d1598fdf67
sys fw: allow to use wildcards to match interfaces
Now it's possible to use "br*" to match all network interfaces that
start with "br".

Closes #996
2023-07-24 16:11:12 +02:00
Gustavo Iñiguez Goia
a828ccdcba
reorganized sockets code
Moved sockets code block to netlink package.
2023-07-24 11:18:09 +02:00
Gustavo Iñiguez Goia
662cd2eda3
Better ebpf module errors
Report to the GUI and the logs, whether the modules have been found
or not, and if found, whether there have been any errors loading them.

Closes #868
2023-07-23 23:35:19 +02:00
Gustavo Iñiguez Goia
cb4d82f9ac
respect packet mark when requeueing packet 2023-07-23 22:33:08 +02:00
Gustavo Iñiguez Goia
8b4c8922c5
Added sample rule to allow localhost connections 2023-07-23 22:30:49 +02:00
Gustavo Iñiguez Goia
28f98e4fb6
misc
- Removed 'rules' from .gitignore
- Fixed typo.
2023-07-23 22:29:47 +02:00
Gustavo Iñiguez Goia
6e340a7e39
remote loggers improvements
- Remote logger: fixed a couple of leaks.
- Allow to use multiple remote loggers.
- Allow to use rfc3164 format.
2023-07-23 22:27:28 +02:00
Gustavo Iñiguez Goia
cdf6497ea7
Bump versions to v1.6.1 2023-07-23 22:18:58 +02:00
Gustavo Iñiguez Goia
f652174f75
changed addrs polling by async events
For the eBPF monitoring method, we listed and stored local addresses
every second, so that we could later check if the source IP of an
outbound connection was local or not, because sometimes we received
outbound connections like:
 443:1.1.1.1 -> 192.168.1.123:12345

This could have been alread solved on this change e090833, so maybe
we no longer need this code.

 - Now we subscribe to local addresses events, to receive add/remove
   events asynchronously, without having to list local addrs
   every second, alliviating CPU usage.

 - Fixed creating context object to cancel subroutines. It was not
   working properly when switching between proc monitor methods.
2023-07-23 21:14:47 +02:00
Gustavo Iñiguez Goia
e090833d29
intercept packets only with the SYN flag set
Using "ct state NEW" to intercept packets causes some undesired effects:
  We intercept packets that not only have the SYN flag set, like ACK,
  ACK+PSH or SYN+ACK. Mainly response packets.

  This means that the IPs are not always in the expected order:
  443:1.1.1.1 -> 192.168.1.123:12345
  which causes sometimes not to obtain the process of the connection,
  because the connection in the system appears as
  12345:192.168.1.123 -> 1.1.1.1:443

Intercepting packets with *only* the SYN flag set seems to resolve
this problem.
2023-07-23 15:14:05 +02:00
Gustavo Iñiguez Goia
481574f035
pop-ups: generate better rule names
Continuation of previous commit.
2023-07-22 21:27:46 +02:00
Gustavo Iñiguez Goia
ff22d94113
pop-ups: better unique rule names
When answering a pop-up we generate the rule name based on the
properties of the connection.
When sending the rule to the daemon, the daemon verifies that the name
is unique and save it. If it's not, it generates a unique name.

However, if you responded to a pop-up and later modified any property of
the rule without changing the name, if the same connection tried to be
established again, you were prompted to allow/deny it, generating the
same name for the rule.
This could cause some confusion, because when sending the new rule to
the daemon the rule name was regenerated to be unique, but on the GUI
it was not updated, and even more, the old-personalized rule was
replaced with the new one.
2023-07-21 11:53:34 +02:00
Gustavo Iñiguez Goia
3d8bdfc1e8
ui,rules: improved uid parsing
When creating rules filtering by UID, there're 3 possible "modes":
 - simple: 0, 1000, etc.
 - user: root (0), opensnitch (1000)
 - regexp: ^(0|1000)$

regexp was not being used correctly.
2023-07-20 16:02:12 +02: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
aa7b1e1a02
misc: removed debug msg, fixed warning msg
- Fixed displaying verdict warning message.
 - Removed debug message.
2023-07-17 16:48:44 +02:00
Gustavo Iñiguez Goia
b40da93fb4
ui, prefs: fixed displaying restart dialog
Display restart dialog was always being displayed when applying changes,
regardless if something really changed.
2023-07-17 16:10:59 +02:00
Gustavo Iñiguez Goia
8740755f64
sys fw: report errors to the GUI after reloading
- Send errors to the server (GUI) if there's any error when reloading
   the system fw rules (far from being perfect/optimal, needs a
   rewrite).
 - Don't load the configuration after saving it, let the watcher reload
   it on write change to avoid double reload/duplicated errors.
2023-07-15 20:32:42 +02:00
Gustavo Iñiguez Goia
77c49d533c
ui,fw: export rules to clipboard, rule dialog improvements
- Added option to export fw rule to clipboard in json format.
- Improvements to receive notifications on the fw rules dialog.
2023-07-15 17:13:58 +02:00
Gustavo Iñiguez Goia
1b3003e007
ui,fw: allow to filter rules by UUID
- also removed debug trace.
2023-07-15 13:51:54 +02:00
Gustavo Iñiguez Goia
3de24febf8
sys fw: improved rules errors logs 2023-07-13 17:24:38 +02:00
Gustavo Iñiguez Goia
4827d973e0
ui: notifications improvements
- Allow to receive and display errors when deleting app rules.
- Fixed error displaying notifications on the main window.
- Improvements to receive notifications on the fw dialog.
2023-07-13 16:59:29 +02:00
Gustavo Iñiguez Goia
ad1cdd4015
tests: better sys-fw log,meta and ip tests 2023-07-12 12:53:13 +02:00
Gustavo Iñiguez Goia
eaec4a825c
tests: added sys-fw conntrack tests 2023-07-11 15:32:15 +02:00
Gustavo Iñiguez Goia
3ca5645c7e
tests: added quota tests 2023-07-11 13:53:01 +02:00
Gustavo Iñiguez Goia
7441aa2ccc
tests: rewritten nat tests
Move common nat checks to its own file.
2023-07-11 13:15:26 +02:00
Gustavo Iñiguez Goia
c2e6032a86
tests: added needed helpers 2023-07-11 01:16:23 +02:00
Gustavo Iñiguez Goia
dad8c0c65d
tests: added queue, nat tests
- Added queue, snat, dnat, redirect, tproxy and masquerade tests.
- Return errors if verdict parameters are not formatted as expected.
2023-07-11 00:57:15 +02:00
Gustavo Iñiguez Goia
7df5c5a244
ui,fw: enable Save button when changing parms
When editing a sys-fw rule, enable Save button if verdict parameters
change.
2023-07-11 00:44:04 +02:00
Gustavo Iñiguez Goia
6ddd4dcee6
tests: added meta tests, improved ip tests 2023-07-09 23:05:12 +02:00
Gustavo Iñiguez Goia
b1ebc0eb22
sys fw: fixed setting marks on packets
Fix for meta mark set 666
2023-07-09 23:03:50 +02:00
Gustavo Iñiguez Goia
a18404fba9
tests: added sys-fw ip and iface tests
- Added ip daddr, saddr tests.
- Added basic iface tests.
2023-07-08 21:50:46 +02:00
Gustavo Iñiguez Goia
c9567bfc14
Merge pull request #974 from tioguda/master
i18n: update Brazilian Portuguese translation
2023-07-07 15:42:36 +02:00
Gustavo Iñiguez Goia
78d82ec07d
Merge pull request #985 from nnsee/fix-pipefail
Use temporary files instead of piping in ebpf Makefile
2023-07-07 14:04:44 +02:00
Gustavo Iñiguez Goia
603c4ab39a
tests: added sys-fw verdict tests
- Added accept, drop, return and jump tests.
- Added reject tests.
2023-07-07 13:56:25 +02:00
Rasmus Moorats
122608bced
use temporary files instead of piping in ebpf Makefile 2023-07-07 13:28:58 +03:00
Gustavo Iñiguez Goia
1a063d10e2
tests: added new sys fw tests
- Added counter tests.
- Added ethernet addresses tests.

Added comments to some functions.
2023-07-07 00:46:09 +02:00
Gustavo Iñiguez Goia
e268a88cff
tests: added sys fw ports tests 2023-07-06 17:59:30 +02:00
Gustavo Iñiguez Goia
28fab440da
sys,fw: check for errors when adding ports rules
Verify that ports are correctly converted to int, for single and range
ports.
2023-07-06 17:58:17 +02:00
Gustavo Iñiguez Goia
84df5135ff
tests: added log and protocol expressions 2023-07-06 16:02:14 +02:00
Gustavo Iñiguez Goia
654a0fb54b
updated compilation/tests workflow 2023-07-06 14:40:47 +02:00
Gustavo Iñiguez Goia
aa8e793dc4
sys,fw: fixed compilation 2023-07-06 14:33:56 +02:00
Gustavo Iñiguez Goia
18e583d20e
tests: updated sys fw tests 2023-07-06 14:27:54 +02:00
Gustavo Iñiguez Goia
344819eb30
sys,fw: export more internal funcs 2023-07-06 14:09:54 +02:00
Gustavo Iñiguez Goia
d474e7f57a
sys,fw: export some internal utils. 2023-07-06 13:36:57 +02:00
Gustavo Iñiguez Goia
b366f5f8b3
ui, ruleseditor: fixed translating username<->uid
When selecting a user from the dropdown list, it should set the uid of
the user in the text line. But sometimes, the format "user (uid)" was
set (instead of just "uid").
2023-07-05 13:36:51 +02:00
Gustavo Iñiguez Goia
d94154f0bd
tests: added missing testdata for ui/client 2023-07-04 13:57:58 +02:00
Gustavo Iñiguez Goia
2acace985e
small ui/client reorganization 2023-07-04 13:35:58 +02:00