Commit graph

1138 commits

Author SHA1 Message Date
Gustavo Iñiguez Goia
868974f593 don't send events to gui is nolog is true
part of 6666eb8ccf
2022-07-06 16:26:28 +02:00
Gustavo Iñiguez Goia
f289d94677 ui, pop-ups: reverted change to adjust window size
Closes #693
2022-07-06 12:37:30 +02:00
Gustavo Iñiguez Goia
560f5c3fd9 ui, pop-ups: improved actions logic 2022-07-05 15:58:56 +02:00
Gustavo Iñiguez Goia
521f97bf94 ui,pop-ups: added reject option
Added option to reject new connections from the pop-ups:

- Configurable from the preferences, Default Action option.
- By default there're 2 buttons as always: Deny - Allow
  - If the Default Action is Reject: Reject - Allow
- The Deny button now has an activable menu, from where you can select
  non-default options (ex: reject connections while the Default Action
  is Allow/Deny).

Closes #613 #571
2022-07-04 23:45:50 +02:00
Gustavo Iñiguez Goia
6666eb8ccf ui,rules: added option to exclude connection events
New option to exclude connections from being logged.

Closes #691
2022-07-04 11:14:26 +02:00
Gustavo Iñiguez Goia
7347afd1f0
Merge pull request #689 from nberlee/icmpv6-nft
fw: support for icmpv6 nftables in system rules
2022-07-02 19:31:25 +02:00
Nico Berlee
5721ca9479
fw: support for icmpv6 nftables in system rules
- Add support for all available nftables ICMPv6 types (ip6tables -m icmpv6 --help)
- Build nftables ICMPv6 rules
- Create a default outbound ICMPv6 echo-request/reply rule
  (currently outbound echo-request ICMPv6 is by default denied)

Signed-off-by: Nico Berlee <nico.berlee@on2it.net>
2022-07-02 18:14:40 +02:00
Gustavo Iñiguez Goia
96fbc8536a
Merge pull request #684 from nberlee/fix-compile-issue
ebpf: fix compiler issue
2022-07-01 18:10:57 +02:00
Nico Berlee
ab42752b6b
ebpf: fix compiler issue
Signed-off-by: Nico Berlee <nico.berlee@on2it.net>
2022-07-01 17:47:16 +02:00
Gustavo Iñiguez Goia
f558ce75c0 ui: show message boxes on top of the other dialogs
Closes #682
2022-06-27 16:35:30 +02:00
Gustavo Iñiguez Goia
e7024e3fe0 ebpf: support for long paths
Added support to report absolute path to a binary up to 4096 characters,
defined here:

https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/limits.h#L13
2022-06-27 14:42:54 +02:00
Gustavo Iñiguez Goia
f54eb789ff ui: improved shutting down
We needed to close the Notifications channel of each node on close.
Closing only grpc's server was not enough.

Closes #677
2022-06-24 13:23:38 +02:00
Gustavo Iñiguez Goia
4ce8b0e57c ebpf: improved process detection/new events module
Improved process detections by monitoring new processes execution.
It allow us to know the path of a process before a socket is opened.

Closes #617

Other improvements:
 - If we fail to retrieve the path of a process, then we'll use the comm
   name of the connection/process.
 - Better kernel connections detection.
 - If debugfs is not loaded, we'll try to mount it, to allow to use
   eBPF monitor method.

Future work (help wanted):
 - Extract command line arguments from the kernel (sys_execve, or mm
   struct).
 - Monitor other functions (execveat, clone*, fork, etc).
 - Send these events to the server (GUI), and display all the commands
   an application has executed.
2022-06-24 01:09:45 +02:00
Gustavo Iñiguez Goia
1b28fad03f ui,fw: improvemed firewall disabling
- When disabling the firewall, if the input policy is DROP, it must set
to ACCEPT, to allow outbound connections.
- Better widgets disabling/enabling.
2022-06-23 17:28:36 +02:00
Gustavo Iñiguez Goia
e1ed51e7c5 ui,notifications: fixed initialization 2022-06-23 00:53:36 +02:00
Gustavo Iñiguez Goia
98ddd01524 ui, events: improved displaying the events window
When loading and setting the query limit configured, it was causing to
fire an unwanted combobox event, resulting in a DB query without limits,
which in turns with a lot of events was causing slowdowns when displaying
the events window.
2022-06-21 21:18:25 +02:00
Gustavo Iñiguez Goia
cfb1d648a8 ui: fixed loading /etc/services
Thanks @munix9! for spotting this problem, and providing a solution:
 #671
2022-06-21 20:46:15 +02:00
Gustavo Iñiguez Goia
cbc9d2a1a9 ui, pkgs: added netbase/setup/netcfg as dependency
Added netbase (debian based distros) or setup (fedora) or netcfg
(opensuse) as dependency, to allow to read the file /etc/services.

 #671
2022-06-21 12:56:16 +02:00
Gustavo Iñiguez Goia
59ea9e146a ui: fixed exception loading /etc/services
Closes #671
2022-06-21 10:03:20 +02:00
Gustavo Iñiguez Goia
32243c2cfd some ebpf,dns improvements
When using the DNS ebpf module there were some timeouts handling
connections, as well as some (nearly) imperceptible delays resolving
domains.
2022-06-10 17:01:18 +02:00
Gustavo Iñiguez Goia
2ca8bb4d4b
Merge pull request #666 from JeremyMahieu/master
Fixes attachment of dns uprobes when libc is stripped of symbol names
2022-06-07 12:44:33 +02:00
Jeremy Mahieu
69ca95b796 fixes attachment of dns uprobes when libc is stripped of symbol names (.dynsym instead of .symtab) 2022-06-07 00:04:08 +02:00
Gustavo Iñiguez Goia
e974364629 ui, firewall: support older protobuf versions
We were using insert() and append() to add rules to the list of rules.
However these methods are only available on protobuf => 3.8.0

In order to have a better user experience, we'll use extend() instead of
append(). If insert() is available, then we'll use it. This way the
users won't have to install manually a newer protobuf version.

Note: using extend() instead of insert() means that the rule won't be
added on top of all the rules of that chain. If a user with an older
protobuf version (<= 3.8.0) adds a rule, it'll be added to the bottom of
the list, and maybe there're other rules that take precedence.
2022-06-02 00:23:15 +02:00
Gustavo Iñiguez Goia
b49de30d54 ui, icons: better DE integration
In order to display icons on the GUI, we use the Icon Naming
Specification defined by freedesktop [0].

However these icons are not always available due to several reasons.
In this situation until now, we have relied on the Qt's built-in
icons [1].

It has worked fine until Fedora 36/Gnome 4x, where even some built-in Qt
icons are missing (SP_VistaShield in particular).

Since Gnome uses symbolic icons [2], falling back to these icons when
the original one doesn't load, helps to display the missing icon.
These icons have the same name than the ones defined by freedesktop, but
with "-symbolic" as a suffix.

Tested on u16, u18, pop22.04, tumbleweed 15.3, f36, devuan/debian 11
(lxqt, unity, gnome3/4, kde).

If you think that there's a better way of handling this situation,
please, open an issue or submit a PR with a fix.

[0] https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
[1] https://doc.qt.io/qtforpython-5/PySide2/QtWidgets/QStyle.html#PySide2.QtWidgets.PySide2.QtWidgets.QStyle.StandardPixmap
[2] https://wiki.ubuntu.com/SymbolicIcons
2022-05-29 17:28:13 +02:00
Gustavo Iñiguez Goia
12b1adfe03 loggers: improved remote_syslog logging
Under heavy network traffic load, writing to a remote syslog fails with
a timeout. Under this situation the connection didn't recover from that
state, blocking other connections.

To ensure that we continue working normally, as well as keep sending
events to syslog:

- Set a max timeout when writing to a remote syslog.
- Restart the connection with the server, if there're more than 10
  errors.

With these fixes along with few other changes, writing to remote syslog
is more reliable, it works as expected.

We need to find the root cause of this behavior, and further test it
(#638).
2022-05-25 17:46:27 +02:00
Gustavo Iñiguez Goia
558f3a78c3 prevent mem leak on Subscribe() 2022-05-24 17:41:03 +02:00
Gustavo Iñiguez Goia
37caf49ca3 removed unused channel
It caused sometimes panics on exit.
2022-05-23 14:52:51 +02:00
Gustavo Iñiguez Goia
0ba5fc44c9 run tests on every change, fixed fw options
- Run unit tests on every push/pr.
- Silence gcc warnings, it doesn't seem to work and causes unit tests to
  fail:
  https://github.com/golang/go/issues/6883#issuecomment-383800123
- Improved firewall configuration contraints, to meet with this table:
  https://wiki.nftables.org/wiki-nftables/index.php/Netfilter_hooks#Hooks_by_family_and_chain_type
2022-05-18 17:47:39 +02:00
Gustavo Iñiguez Goia
5453a49692 tests: updated rules tests
- Updated rules tests to use the new description field.
- Removed debugging traces from the loggers module.
2022-05-18 15:27:53 +02:00
Gustavo Iñiguez Goia
7b610c0176 added way to send events to syslog
Now you can send events to syslog, local or remote.
This feature was requested here #638

This feature allows you to integrate opensnitch with your SIEM. Take a
look at the above discussion to see examples with
syslog-ng+promtail+loki+grafana.

There's only one logger implemented (syslog), but it should be easily
expandable to add more type of loggers (elastic, etc).

The event format can be CSV or RFC5424. It sould also be easy to add
more formats.

- Allow to configure stats workers. They were hardcoded to 4.
2022-05-17 16:28:59 +02:00
Gustavo Iñiguez Goia
4e4bd9dcf7 ui, stats: fixed exception when loading tree panel 2022-05-16 11:50:41 +02:00
Gustavo Iñiguez Goia
3c524c1942 ui, rules: added description field
- Added ability to add a description to the rules.
- Display the description field on the Rules view, and remove the internal
  fields (operator, operator_data, etc).
- Added DB migrations.
- Improved rules' executable path field tooltip (#661).

Closes #652 #466
2022-05-12 13:38:23 +02:00
Gustavo Iñiguez Goia
db4646dec8 rpm pkgs: deploy dns ebpf module, add grpcio as dep
- Deploy DNS eBPF module when installing the daemon.
- Include python3-grpcio as dependency. For older systems we'll use the
  old .spec file.
2022-05-05 01:16:38 +02:00
Gustavo Iñiguez Goia
b626e3fea2 bump nftables dependency version, packaging changes
- Bump nftable version to depend on latest version with fixes.
- Include opensnitch-dns.o eBPF object when creating the deb package.
- Replaced Suggests by Recommends, to install addtional but not
  essential packages (like python3-pyasnc, and others).
- Added python3-grpcio, python3-protobuf and python3-slugify as
  dependencies.
  For systems without these packages, we'll use the old debian/ dir.
2022-05-04 18:36:50 +02:00
Gustavo Iñiguez Goia
cb74058b96 Bump versions to 1.6.0rc1 2022-05-04 14:47:45 +02:00
Gustavo Iñiguez Goia
d9e0c59158
Allow to configure firewall rules from the GUI (#660)
* Allow to configure firewall rules from the GUI (WIP)

New features:
- Configure and list system firewall rules from the GUI (nftables).
- Configure chains' policies.
- Add simple rules to allow incoming ports.
- Add simple rules to exclude apps (ports) from being intercepted.

This feature is only available for nftables. iptables is still supported,
you can add rules to the configuration file and they'll be loaded, but
you can't configure them from the GUI.

More information: #592
2022-05-03 22:05:12 +02:00
Gustavo Iñiguez Goia
16c95d77fd ui: use default font for GUI labels.
There were some labels that didn't use the default font (Sans). This
caused that the labels text were not following system's theme.

Closes: #650
2022-04-19 01:41:35 +02:00
Gustavo Iñiguez Goia
0aef656c42 ui: allow to use GUI themes
Now the user can personalize GUI's appearance (#424).

There're 15 default themes, dark and light, that will help integrating
on some environments (#303, #335).

More themes can be added, by creating a new xml under
~/.config/opensnitch/themes/ or
/usr/lib/python3/dist-packages/opensnitch/

The lib used is https://github.com/UN-GCPDS/qt-material.
https://github.com/UN-GCPDS/qt-material#custom-colors
2022-03-22 13:16:18 +01:00
Gustavo Iñiguez Goia
6c54c2c52f ui: icons updated for better visibility on light themes
On light themes, the systray icon was barely visible. With the new
icons:
 - on dark themes should be pretty similar to what we already had.
 - on light themes they are much more distinguishables now.

Closes: #643, #339
2022-03-10 17:59:03 +01:00
Gustavo Iñiguez Goia
a2f237aa1b updated ebpf modules compilation steps 2022-03-07 01:27:28 +01:00
Gustavo Iñiguez Goia
0a4c44bf71 ui: better rules listing
- Reduce query complexity by querying only connections table.
- Fixed filtering fields.
2022-03-01 16:37:02 +01:00
Gustavo Iñiguez Goia
e7ba2bdf7b ui: fixed launching the GUI on LxQt
Closes #618
2022-02-27 01:30:18 +01:00
Gustavo Iñiguez Goia
43adcef675 ui, events: fixed crash when clicking on the Rules column 2022-02-23 10:40:51 +01:00
Gustavo Iñiguez Goia
93f61d09e8 ebpf cache improvements
The eBPF cache is meant mainly for certain applications that
establish 2-4 new connections in under 1-2 seconds. Thus, a cache of 1
minute per item was too much, 10-20 seconds is enough.

Also, check old items every minute to keep the number of items low.
2022-02-22 20:33:29 +01:00
Gustavo Iñiguez Goia
4babc52524 exclude ::1 from dns cache
It caused some problems. See #629
2022-02-21 17:51:29 +01:00
Gustavo Iñiguez Goia
f575ba0651
Merge pull request #625 from cinerea0/master
Allow building on systems using musl
2022-02-19 22:03:45 +01:00
Gustavo Iñiguez Goia
377b4c8f48 ui, events: improved UX, fixed Users' query
- Improved user experience, by remembering rows selection when going
  back from a detail view. Fixes #620.
- Fixed Users' view query (it didn't list user's connections
  correctly and it wasn't efficient).
2022-02-19 10:55:54 +01:00
cinerea0
a550252f79 daemon: allow building on musl 2022-02-18 20:36:56 -05:00
Gustavo Iñiguez Goia
026f05d9cc dns, ebpf: do not crash on exit when in DEBUG
If the daemon crashes on exit, fw rules are not deleted.
2022-02-18 00:42:54 +01:00
Gustavo Iñiguez Goia
51c5cd53da actions: updated go version to 1.15
Needed to compile the daemon with latest nftables lib version.
2022-02-18 00:33:26 +01:00