Commit graph

1019 commits

Author SHA1 Message Date
Gustavo Iñiguez Goia
9ef64da588 ui: fixed crash when displaying the GUI
On Fedora 34, without the appindicator extension installed, when the GUI
was displayed it crashed with the following error:

TypeError: index 0 has type 'float' but 'int' is expected.

related: #526
2021-10-08 12:57:44 +02:00
Gustavo Iñiguez Goia
fd40feb78c
Create feature-request.md 2021-10-06 23:54:37 +02:00
Gustavo Iñiguez Goia
3af6a11da2
Create config.yml 2021-10-06 23:32:44 +02:00
Gustavo Iñiguez Goia
eb51840bea
Update bug_report.md 2021-10-06 23:30:22 +02:00
Gustavo Iñiguez Goia
67afb5b8ed
Update go.yml 2021-10-06 22:52:19 +02:00
Gustavo Iñiguez Goia
655f1ebe6e updated protoc command to generate the protobuffer
closes #521
2021-10-06 11:10:57 +02:00
Gustavo Iñiguez Goia
ff99b39d09 ui, tests: added rules editor tests
to run them:
pytest tests/

They dould be integrated with a github action.
2021-10-05 16:34:30 +02:00
Gustavo Iñiguez Goia
4ea0904ff3 ui: allow to filter connections by PID
This change allows to filter connections by PID.

Others have referred to this feature as "filter connections for this
instance/session" or similar, so maybe a better wording is needed.
Open a new discussion or send a PR if you have a better sentence that
describe this option please.
2021-09-25 11:51:09 +02:00
Gustavo Iñiguez Goia
0526b84309
Allow to intercept more kernel connections (#513)
* Allow to intercept some kernel connections

Some connections are initiated from kernel space, like WireGuard
VPNs (#454), NFS or SMB connections (#502) and ip tunnels (#500).

Note: This feature is complete for x86_64, WIP for aarch64, and not supported for armhf and i386
https://github.com/evilsocket/opensnitch/pull/513#issuecomment-924400824

More information regarding this change: #493
2021-09-23 01:44:12 +02:00
Gustavo Iñiguez Goia
2c1acdbfc1 don't overwrite rules if they already exist (2/2)
Don't overwrite rules when adding or editing rules, to avoid losing
already added rules.

- When adding a rule, check if there's already a rule with the same
  name.
- After adding a new rule, enter into EDIT mode, to allow changes to the
  rule without closing the dialog.
- If the user changes the name after adding a rule, check if there's a
  rule with the same name.
- When editing a rule and the user changes the name, check if there's a
  rule with the same name.

issue #512
2021-09-19 23:57:41 +02:00
Gustavo Iñiguez Goia
c97a01d52f don't overwrite rules if they already exist.
Don't overwrite rules when adding or editing rules, to avoid losing
already added rules.

closes #512
2021-09-19 16:01:58 +02:00
Gustavo Iñiguez Goia
3b6c0412e0 rules: added more lists types to block/allow
- Added lists of IPs and network ranges. One per line. Blank lines or
  lines that start with # are ignored.
- Added lists of domains with regular expressions. One per line.
  Blank lines or lines that start with # are ignored.

Until now you could use regular expressions with the fields
"To this host" or "To this IP", to match multiple domains or IPs.
But if you wanted to use more than 2-3 domains or IPs it was not really
user friendly.

Hopefully we'll be a little more versatile to cover use cases like #461
and #485.
2021-09-18 00:17:58 +02:00
Gustavo Iñiguez Goia
500b7c7f1a debs: added step to generate daemon's proto
-> #494
2021-09-15 11:56:13 +02:00
Gustavo Iñiguez Goia
2d268654e8
Merge pull request #506 from themighty1/patch-2
need to generate go.sum otherwise we get errors
2021-09-15 10:12:49 +02:00
Gustavo Iñiguez Goia
408ce3f992
Merge pull request #505 from themighty1/patch-1
github.com/golang/protobuf deprecated
2021-09-15 09:39:30 +02:00
themighty1
35975bc760
need to generate go.sum otherwise we get errors 2021-09-15 04:28:56 +00:00
themighty1
0776c1b895
github.com/golang/protobuf deprecated 2021-09-15 04:26:53 +00:00
Gustavo Iñiguez Goia
c66d5d6bf0 ebpf: updated dependencies list for compiling 2021-09-13 11:49:27 +02:00
Gustavo Iñiguez Goia
8d3540f7f9 added action reject
When blocking a connection via libnetfilter-queue using NF_DROP the
connection is discarded. If the blocked connection is a DNS query, the app
that initiated it will wait until it times out, which is ~30s.

This behaviour can for example cause slowdowns loading web pages: #481

This change adds the option to reject connections by killing the socket
that initiated them.

Denying:
    $ time telnet 1.1.1.1 22
    Trying 1.1.1.1...
    telnet: Unable to connect to remote host: Connection timed out

    real	2m10,039s

Rejecting:
    $ time telnet 1.1.1.1 22
    Trying 1.1.1.1...
    telnet: Unable to connect to remote host: Software caused connection abort

    real	0m0,005s
2021-09-12 10:54:24 +02:00
Gustavo Iñiguez Goia
9ccb6498ec i18n: fixed fr_FR translation generation 2021-09-10 11:26:51 +02:00
Gustavo Iñiguez Goia
cddc5b6de8 ui,pop-ups:use the proc path if the args are empty
If the cmdline of a process is empty, use the process' path to create
the rule, instead of process.command field.
2021-09-09 16:17:48 +02:00
Gustavo Iñiguez Goia
d57122ad96 debs: removed dh-systemd dependency
It prevented to build the packages on < Debian Sid, and it generates the
post/pre installation/uninstall code anyway.
2021-09-09 16:14:03 +02:00
Gustavo Iñiguez Goia
499b037f84 ui, i18n: added fr_FR translation
Thanks to @Herve5. #484
2021-09-07 12:59:54 +02:00
Gustavo Iñiguez Goia
0b0255ea4f improved setting proc monitor method from cli
This change is part of the last commit.
2021-09-04 23:09:04 +02:00
Gustavo Iñiguez Goia
71d0f6d27d improved process monitor method (re)configuring
- Fixed reloading process monitor method if the configuration changes on
  disk. This can occur in two situations: 1) if it's changed from the
  UI, 2) if the user changes it manually.
- Ensure that we don't crash if there's an error changing the
  method and ebpf is active.
- When changing monitor method to ebpf and it fails to start, stop it
  anyway. It helps cleaning up kprobes and avoiding the error
  "cannot write...: file exists".
2021-09-04 21:18:22 +02:00
Gustavo Iñiguez Goia
f5bb478c99 use GUI's default action when applying a verdict
When the daemon connects to the GUI, use the default action
configured on the GUI to apply a verdict on new connections.

We were using daemon's default action, so if it was Allow but the user
had configured Deny on the GUI it was allowing connections, causing some
confusion (#489)

TODO: apply this action not only on connecting to the GUI, but also when
saving the configuration from the GUI.
2021-09-03 17:37:26 +02:00
Gustavo Iñiguez Goia
fa7df6595d fixed exception when cleaning up the cache
Under certain situations, while cleaning up the cache of inodes,
if an item was deleted we could end up accessing a nil item.

Spotted on ubuntu18.
2021-09-02 20:51:18 +02:00
Gustavo Iñiguez Goia
18f0c9133d ui, rules editor: fixed parsing duration
When adding a new rule we were getting the duration as it appeared on
the combo box. It was used to create a Golang time.

However translators were translating the duration strings (30s, 5m,
etc), causing errors when saving the rule.

Now we just look for the index of the selected duration.
2021-09-01 02:08:58 +02:00
Gustavo Iñiguez Goia
d624780141
Merge pull request #487 from freddii/master
updated german translation
2021-08-31 15:33:40 +02:00
freddii
1fa4e421ca updated german translation 2021-08-31 12:53:23 +02:00
Gustavo Iñiguez Goia
041cf456dc Bump versions to v1.4.0 2021-08-27 13:48:20 +02:00
Gustavo Iñiguez Goia
d11a98e418 fixed interception and system fw rules, default action
- The firewall rules defined in /etc/opensnitchd/system-fw.json take
precedence over the interception rules, but we were inserting the
interception rules before the system's ones. With this change #455
should be fixed.

- On the other hand, the DefaultAction was not being applied correctly
  in all cases. As of today the DefaultAction is applied in 2 scenarios:
  * When the daemon is connected to the GUI and the user doesn't answer
    a pop-up.
  * When the daemon is not connected to the GUI.

  However as we don't parse all network protocols, even if the GUI is
  connected we may end up parsing a connection and don't know what to do
  with it. In this case the DefaultAction was always Deny.

  Now in the above scenario, i.e.: when the GUI is connected but we
  can't parse a connection, we'll apply the DefaultAction configured by
  the user.
2021-08-25 13:06:32 +02:00
Gustavo Iñiguez Goia
7c991dd85f
Merge pull request #479 from gnuhead-chieb/master
Update Japanese translation
2021-08-23 10:40:13 +02:00
Gustavo Iñiguez Goia
96722ed740 blocklists: sanitize hosts entries
Remove \r\n\t\s from the end of each line of a blocklist.

If the entries of a list had these characters caused to not match
connections and not apply the rule.

closes #429
2021-08-22 23:07:25 +02:00
gnuhead-chieb
48538323ca
Add files via upload 2021-08-22 08:03:11 +09:00
Flávio Costa
e85ba18a17
Update Brazilian Portuguese translation (#478)
* Update Brazilian Portuguese translation
2021-08-20 20:51:39 +02:00
Gustavo Iñiguez Goia
49c171df4c Use eBPF as procs monitor method by default
If eBPF is not available we'll fallback to proc parsing.
2021-08-17 13:54:46 +02:00
Gustavo Iñiguez Goia
94fa3c8093 ui, stats: better window restoration on KDE
Latest approach seems to not always work (latest KDE on kubuntu 20 and
manjaro as of today).

This seems to work better:
https://doc.qt.io/qt-5/qwidget.html#setWindowState
2021-08-13 18:03:10 +02:00
Gustavo Iñiguez Goia
a354ae22e1 statistics: fixed missed connections
Previous behaviour:

 1) Before version 1.0.0b the daemon kept a list of processes that had
 established connections. The list was displayed on the GUI as is, so
 the maximum number of connections displayed were 100 (hardcoded).

 2) When the intercepted connections reached 100, the last entry of the
    list was removed, and a new one was inserted on the top.

After v1.0.0 we started saving connections to a DB on the GUI side, to
get rid of the hardcoded connections limit. However, the point 2) was
still present that caused some problems:
 - When the backlog was full we kept inserting and deleting connections
   from it continuously, one by one.
 - If there was a connections burst we could end up missing some
   connections.

New behaviour:
 - The statisics are deleted from the daemon everytime we send them to
   the GUI, because we don't need them on the daemon anymore.
 - If the GUI is not connected, the connections will be added to the
   backlog as in the point 2).
 - When the backlog reaches the limit, it'll keep deleting the last
   one in order to insert a new one.
 - The number of connections to keep on the backlog is configurable.
 - If the statistics configuration is missing, default values will be
   150 (maxEvents) and 25 (maxStats).

Notes:
 If the GUI is saving the data to memory (default), there won't be
 any noticeable side effect.
 If the GUI is configured to save the connections to a DB on disk, and
 the daemon sends all the backlog at once, the GUI may experience a
 delay and a high CPU spike. This can occur on connecting to the daemon
 (because the backlog will be full), or when an app sends too many
 connections per second (like nmap).
2021-08-13 12:18:10 +02:00
Gustavo Iñiguez Goia
2b8c931762 ui, events: translate columns headers
Related: #465
2021-08-12 15:12:11 +02:00
Gustavo Iñiguez Goia
38d4fb9ae5 Bump versions to v1.4.0rc4 2021-08-11 17:16:56 +02:00
Gustavo Iñiguez Goia
5a6dd28072 cache of PIDs: added new tests, fixed rare crash
- New tests to validate deleion of PIDs.
- Fixed potential out-of-bounds when deleting PIDs from cache.
2021-08-11 14:19:43 +02:00
Gustavo Iñiguez Goia
6ce099ffd5 ui, events: fixed restoring state when minimized
On KDE the events window was not restored to previous state when the
window was minimized to the taskbar.

This was fixed by @themighty1 in this PR #315, but there was an
unexpected behaviour on others DE.

As I haven't seen this error in others DE, we apply the original
fix, but only when the DE in use is KDE.
2021-08-09 15:28:15 +02:00
Gustavo Iñiguez Goia
0910249fb2 ui: fixed typos, improvements.
- Fixed typos in the preferences dialog (#465).
- Fixed hiding/showing rules combobox.
- Keep opensnitchd/default-config.json format when saving node's
  configuration from the GUI.
2021-08-09 13:30:56 +02:00
Gustavo Iñiguez Goia
ba7c4e1878 allow to configure what firewall to use
Before this change, we tried to determine what firewall to use based on
the version of iptables (if -V legacy -> nftables, otherwise iptables).

This caused problems (#455), and as there's no support yet for nftables
system firewall rules, it can't be configured to workaround these
errors.

Now the default firewall to use will be iptables.
If it's not available (installed), can't be used or the configuration
option is empty/missing, we'll use nftables.
2021-08-09 00:32:27 +02:00
Gustavo Iñiguez Goia
db18b0cc63
Merge pull request #470 from ovari/master
Update opensnitch-hu_HU.ts
2021-08-08 12:51:34 +02:00
Gustavo Iñiguez Goia
bca5ffa9b5 ui,rules: update rules last_seen field on new stats
Update the last_seen field every time a new connection is established.
2021-08-08 12:29:37 +02:00
ovari
dd94c3fe1a
Update opensnitch-hu_HU.ts 2021-08-06 18:28:24 +10:00
Gustavo Iñiguez Goia
388c98e559 ui,preferences dialog: fixed crash
qcombobox placeHolderText preference was set as translatable, and it
caused a crash.
2021-08-03 01:11:12 +02:00
Gustavo Iñiguez Goia
f96e44dc93 ui: improved UI internationalization, columns fix
- Now the columns names of the details views can be translated (#465).
- Fixed columns size restoring when clicking on the Events tab to view
  the details of an item (process, rule or node).
2021-08-02 17:16:10 +02:00