Commit graph

1225 commits

Author SHA1 Message Date
Gustavo Iñiguez Goia
8da5d072f7
ui, sys fw: allow to filter fw rules by more fields 2022-12-20 22:37:58 +01:00
Gustavo Iñiguez Goia
7b99383546
find connections with connection fields swapped
Under certain situations, like when using systemd-resolved as DNS
resolver, we receive outbound connections with the fields swapped:

Instead of: local-port:local-ip -> public-ip:public-port
we receive: public-port:public-ip -> local-ip:local-port

Sometimes this behaviour causes network slowdowns, or no network at all.

If we swap the fields of these connections, then we're able to get the
process and keep functioning as usual. But what causes this behaviour is
yet unknown, and needs further analysis.

See these issues for more information: #779 , #711
2022-12-20 17:16:20 +01:00
Gustavo Iñiguez Goia
a45ba914e3
better ebpf tasks cancellation
It should improve daemon stopping times.
2022-12-19 18:38:13 +01:00
Gustavo Iñiguez Goia
b8b8342cae
ui, prefs: fixed logic when changing the db type 2022-12-19 12:34:27 +01:00
Gustavo Iñiguez Goia
afa23f5ac2
sys fw: improved rules, profiles policies
- Allow to use commas to define conntrack states:
  ("related,established")
- Remove profile's rules when switching from Deny to Allow.
- Fixed checking duplicated rules.

Closes #778
2022-12-19 10:59:43 +01:00
Gustavo Iñiguez Goia
50217afc9f
added initial support for ICMP and SCTP
Closes: 714
2022-12-18 00:41:06 +01:00
Gustavo Iñiguez Goia
342c75a6e1
better errors, fixed default sys fw conf 2022-12-16 17:09:37 +01:00
Gustavo Iñiguez Goia
c81dc22c02
sys fw: allow to change fw type from the GUI
- Configuration of system firewall rules from the GUI is not supported for
 iptables. Up until now only a warning was displayed, encouring to change
 fw type manually.

 Now if configured fw type is iptables (default-config.json, Firewall:),
 and the user opens the fw dialog, we'll ask the user to change it from
 the GUI.

- Add fw rules before connecting to the GUI. Otherwise we send to the
  GUI an invalid fw state.
2022-12-16 17:03:36 +01:00
Gustavo Iñiguez Goia
9e630d009d
ebpf: fixed loading modules on arm32 arch
Make use of kernel macros to decide for what architectures we compile
the modules.

On armv7l the connections module was failing due to iptunnel_xmit, so
exclude it from being compiled.

One can export ARCH=arm, ARCH=i386 or ARCH=arm64 to compile the modules
for these architectures, instead of hacing to edit the source files.
2022-12-13 23:59:54 +01:00
Gustavo Iñiguez Goia
1775da2b48
sys fw: silence error parsing configuration 2022-12-11 22:11:37 +01:00
Gustavo Iñiguez Goia
e7cbbb7489
ui,prefs: fixed asking the user to restart the GUI
Fixed asking to restart the GUI when the user changes the server
address.
2022-12-11 18:25:31 +01:00
Gustavo Iñiguez Goia
93e1135b4a
better ebpf errors printing
Provide more information when loading ebpf modules fails.
2022-12-11 17:25:05 +01:00
Gustavo Iñiguez Goia
0f51ea0c79
ui, fw: disable output policy configuration
Disable for now output policy configuration. Setting it to Drop blocks
all outbound connections.
2022-12-11 16:28:24 +01:00
Gustavo Iñiguez Goia
23b1a6b75e
fw: restore chains policy where applicable
If the user configures chains' policy to Drop, we need to restore it to
Accept when exiting, otherwise we could block connections
unintentionally.
2022-12-11 14:15:17 +01:00
Gustavo Iñiguez Goia
2e2f1768f2
improved errors printing 2022-12-11 11:41:47 +01:00
Gustavo Iñiguez Goia
e2a822b731
better errors printing
Explain a littler bit better some errors.
2022-12-10 21:49:48 +01:00
Gustavo Iñiguez Goia
daae591d05
impoved alerts
- Increased number of alerts to queue.
- Fixed sending alerts to server.
2022-12-09 17:03:02 +01:00
Gustavo Iñiguez Goia
aa1e28e624
ui: fixed apps icon discovery
Use HighContrast icons as last resort to display app icons.
This fixes an issue on Fedora 37, where the pop-up was not displaying
the app icon.
2022-12-08 16:04:21 +01:00
Gustavo Iñiguez Goia
58ceb90996
deb: fixed latest changelog datetime 2022-12-08 11:42:18 +01:00
Gustavo Iñiguez Goia
1a493b9da1
ebpf: improved process details gathering
In order to detect short-lived processes we intercept new processes
executions as they happen, and cache them for later use.

When a new connection is established, then we check if the PID of the
connection is cached, and use the details of the process to ask the user
to allow or deny it.

However, there're some situations where the path or cmdline of a PID,
doesn't correspond with the one that's establishing the connection.

Given the same PID:
 - Sometimes we receive from the tracepoint a wrong/non-existent path.
 - Other times we receive a "helper" which is the one executing the
   real binary that opens the connection.

For these reasons now when a new connection is established, we read the
path to the binary from proc. If the PID is cached and the cached path
differs, then we'll use the path from proc.

We lose a bit of performance, but hopefully we'll be more consistent
with what the user expect, while at the same time keeping intercepting
short-lived processes.

Downsides: for execveat() executions we won't display the original binary.

Closes #771
2022-11-27 14:03:13 +01:00
Gustavo Iñiguez Goia
71747ebed5
ebpf instructions updated 2022-11-18 21:50:42 +01:00
Gustavo Iñiguez Goia
314ee820ce
centralized ebpf modules loading 2022-11-18 20:38:52 +01:00
Gustavo Iñiguez Goia
678b1a925e
Update README.md 2022-11-17 17:56:47 +01:00
Gustavo Iñiguez Goia
da8a97c78e
ui, fw dialog: fixed displaying icons
On Fedora 37 (and maybe others) the icons + and - were not displayed
correctly.
2022-11-17 00:29:48 +01:00
Gustavo Iñiguez Goia
31d2cd550d
ui: fixed launcher import 2022-11-17 00:07:42 +01:00
Gustavo Iñiguez Goia
fcecff3d36
rpm: fixed installed files 2022-11-16 22:57:07 +01:00
Gustavo Iñiguez Goia
c64b2df03c
ebpf: delete expired exec events from cache
Whenever a process exits, we delete the corresponding entry from
cache.

But when a process executes a new process (sh -c ls), we receive an
exit event for the parent, while the child continues working with *the
same PID*. Sometimes we don't receive exit events for the child, so the
entry was never removed from cache.

We should properly detect the exits, but forthe time being, delete
expired processes from cache every minute.
2022-11-15 23:30:26 +01:00
Gustavo Iñiguez Goia
6bfe6cef8d
Bump versions to 1.6.0-rc.3 2022-11-15 00:52:23 +01:00
Gustavo Iñiguez Goia
bfe7b579f7
Merge pull request #769 from szimszon/master
Here port should be also port in hungarian language.
2022-11-14 20:31:22 +01:00
Gustavo Iñiguez Goia
da3a9dc19f ui: handle alert msgs on the main thread 2022-11-14 10:23:57 +01:00
Szimszon
d750caed4a
Here port should be also port in hungarian language.
Port translation was "kikötő" which means harbor and we need here "port" or "portszám" for port.
2022-11-13 20:19:43 +01:00
Gustavo Iñiguez Goia
80cbf7450a
ui: fixed exception when checking node address
Thanks @JeremyMahieu ! for reporting it and providing a solution.

Closes #766
2022-11-10 00:00:54 +01:00
Gustavo Iñiguez Goia
a3538a728f
systemd service: wait 10s to stop, otherwise kill daemon 2022-10-27 17:53:42 +02:00
Gustavo Iñiguez Goia
1a1e87c474
workflows: execute daemon tests on changes 2022-10-23 11:49:22 +02:00
Gustavo Iñiguez Goia
ec31ee0814
sys fw: added option to filter by MAC 2022-10-23 11:36:51 +02:00
Gustavo Iñiguez Goia
a9f3b20881
ui: set some strings as not translatable
ref: #759
2022-10-20 23:16:12 +02:00
Gustavo Iñiguez Goia
736c3f9c51
rules: make .json files accessible only to root by default 2022-10-20 21:01:29 +02:00
Gustavo Iñiguez Goia
44500f9c09
pkgs, deb: improvements
- Don't share sources (reduces deb size).
 - Install eBPF modules under /usr/lib/opensnitchd/ebpf/
   /etc/is only mean for configuration files, and /usr/lib for object
   files and libraries.
   https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s07.html#purpose6
   https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch04s06.html#purpose22
 - Added NEWS file, to inform users about breaking changes and other
   relevant changes.
2022-10-19 13:13:45 +02:00
Gustavo Iñiguez Goia
037f00827e
tests workflow: run on workflow updates, manually 2022-10-18 23:59:44 +02:00
Gustavo Iñiguez Goia
0d46b2e42f
stop ebpf monitor cleanly 2022-10-18 23:29:50 +02:00
Gustavo Iñiguez Goia
474a6373cf
ebpf: allow to load modules from more directories
Up until now we loaded the eBPF modules from /etc/opensnitchd.

However there has been some problems upgrading the modules to newer
versions with the deb packages, because every file under /etc/ is
treated as a conffile, and whenever a conffile changes it prompt you to
update it or not. Some users decided to no upgrade it, ending up with
eBPF modules incompatible with the new daemon.

https://www.debian.org/doc/manuals/maint-guide/dother.en.html#conffiles

On the other hand, the FHS dictates that /etc/ is for configuration
files, and /usr/lib for object files:

"/usr/lib includes object files and libraries. [21] On some systems,
it may also include internal binaries that are not intended to be
executed directly by users or shell scripts."

https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch04s06.html

So now, we look for the eBPF modules under /usr/local/lib/opensnitchd/ebpf/
or /usr/lib/opensnitchd/ebpf/, and as a last resort under
/etc/opensnitchd/
2022-10-18 18:46:40 +02:00
Gustavo Iñiguez Goia
820e7d5fe9
ui: create /run/user/ dirs with proper permissions
"$XDG_RUNTIME_DIR defines the base directory relative to which user-specific
non-essential runtime files and other file objects (such as sockets,
named pipes, ...) should be stored. The directory MUST be owned by the
user, and he MUST be the only one having read and write access to it.
Its Unix access mode MUST be 0700."

https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
2022-10-18 00:15:25 +02:00
Gustavo Iñiguez Goia
b2ccb34c17
ui,rules: allow to filter by fields of the rules
Requested here: #756
2022-10-15 12:01:48 +02:00
Gustavo Iñiguez Goia
040d4bf921
ui, rules editor: allow to select multicast range
Closes #755
2022-10-14 01:20:54 +02:00
Gustavo Iñiguez Goia
728c2554ad
ui minor fixes
- Firewall dialog: disable widget when firewall is not active.
- Firewall rule dialog: enforce quotas units format.
- Nodes: fixed exception.
2022-10-14 00:59:00 +02:00
Gustavo Iñiguez Goia
7cbfca6b1f
ebpf: increased ring buffer size, hook execveat
Increased perf map buffer size to avoid lose events under heavy loads.

Hook execveat to intercept executions from memory.
2022-10-13 01:44:23 +02:00
Gustavo Iñiguez Goia
09e9a8ac79
fw: report initialization errors
Allow send fw initialization errors to the server (UI).
2022-10-13 00:08:52 +02:00
Gustavo Iñiguez Goia
6c9eb35456
Merge pull request #757 from tioguda/master
Update Brazilian Portuguese translation
2022-10-12 15:32:40 +02:00
tioguda
a812b26719
Update Brazilian Portuguese translation 2022-10-12 09:45:48 -03:00
Gustavo Iñiguez Goia
477e6aadb0
new feature: send alerts to the server/UI
Up until now some error and warning messages were only logged out to the
system, not allowing the user know what was happening under the hood.

Now the following events are notified:
 - eBPF related errors.
 - netfilter queue errors.
 - configuration errors.

WIP, we'll keep improving it and build new features on top of this one.
2022-10-12 13:31:45 +02:00