Commit graph

1055 commits

Author SHA1 Message Date
Gustavo Iñiguez Goia
d264bb0e3a ui: fixed disabled buttons, improved svg icon 2022-01-08 11:58:39 +01:00
Gustavo Iñiguez Goia
7e5d809683 ui, prefs, notifications: fixes
- Fixed preferences dialog status error messages.
- Improved notifications
2022-01-08 01:00:04 +01:00
Gustavo Iñiguez Goia
1c523784a8 ui, notifications: fixed timeout
Timeouts are milliseconds, not seconds.
2022-01-07 19:07:23 +01:00
Gustavo Iñiguez Goia
843412d73e ui, notifications: allow to use system notifications
WIP.

Until now we used Qt's systray notifications. They couldn't be disabled
and didn't integrate well with non-Qt based Desktop Environments. Also
we depended on the system tray availability, which is not always
available (i3, phosh, ...).

Now the user can choose to use Qt's notifications, the system
notification service or disabled them completely.

Pros:
 - The notification style is defined by the Desktop Environment.
 - Can be configured globally from the system settings.
 - In many DEs, the notifications are grouped into a single view. So if
   you miss any event, you can go there and check out what happened.
 - Now we can display notifications on DEs where we couldn't before.
 - It's a standard supported by major DEs.

Cons:
 - Sometimes we can't connect to the D-Bus mainloop instance. We need to
   investigate it.

TODO:
 - Deny/Allow new outgoing connections from the notifications,
   replacing the current pop-ups.

Requested here: #468 , #476 and #477 .
2022-01-07 18:32:17 +01:00
Gustavo Iñiguez Goia
2d2a970735 ui, prefs: use buttons to change spins' values
Instead of the builtin buttons to increase the value of spin boxes, use
regular buttons. It'll be easier to use on touchable devices.

Note: This feature can also be achieved by customizing SpinBoxes' css
style.
2022-01-06 11:43:05 +01:00
Gustavo Iñiguez Goia
db901a870b ui, prefs: allow to configure events purge interval
Depending on the amount of network traffic, it may be necessary to purge
events faster.
2022-01-04 16:00:57 +01:00
Gustavo Iñiguez Goia
a2a0b8be20 ui: misc improvements
- If sys.exit() fails, force exit after 10s.
- Close db connection on exit.
- When closing the GUI (server), set connected nodes to offline.
  The status will be updated when nodes connect again / when the server
  is available again.
  Otherwise, we may end up with nodes marked as _online_ when in reality
  they're not connected.
- Add nodes on the main thread.
2022-01-04 00:21:30 +01:00
Gustavo Iñiguez Goia
9c54334b8e ui, pop-ups: set default app icon if none is found 2022-01-03 17:57:11 +01:00
Gustavo Iñiguez Goia
ac3965e3c0 ui: fixed app icon on gnome-shell/wayland, crash
- OpenSnitch icon was not shown when pressing alt+tab.
- Fixed crash when a node disconnected and the DB was updated.
2022-01-01 10:03:34 +01:00
Gustavo Iñiguez Goia
40098131bf ui, events: dont show context menu on rules' view 2022-01-01 00:00:06 +01:00
Gustavo Iñiguez Goia
67c9a7fa12 ui: added missing config.py changes, misc 2021-12-30 22:06:17 +01:00
Gustavo Iñiguez Goia
42b8774f52 ui, addrs view: display network name (ASN) per IP
Per IP listed in the Address view, display the ASN that the IP belongs
to.

The user must have installed the package python3-pyasn.

If the ASN DB files exist under user's opensnitch directory, we'll try
to load them:
 - ~/.config/opensnitch/ipasn_db.dat.gz
 - ~/.config/opensnitch/asnames.json

Otherwise we'll try to load the one shipped with the python3-pyasn
package (/usr/lib/python3/dist-packages/data/ipasn_20140513_v12.dat.gz)

The package python3-pyasn provides 3 utils to download latest data:
- pyasn_util_download.py --latest
- pyasn_util_convert.py --single rib.20211230.1600.bz2 ~/.config/opensnitch/ipasn_db.dat
- gzip ~/.config/opensnitch/ipasn_db.dat

More info: https://github.com/hadiasghari/pyasn
2021-12-30 18:55:43 +01:00
Gustavo Iñiguez Goia
d08469ce6f ui, db: use transactions to speed up inserts 2021-12-30 17:36:06 +01:00
Gustavo Iñiguez Goia
c1d6d943e8 ui: keep a limited number of events in the db, misc
- Allow to keep a maximum number of events in the db, purging oldest
  every hour.
- Perform db operations on the thread that created the connection with
  the DB, to avoid segfaults.
- VACUUM db on exit.
- New db index on the rules' field time.
2021-12-30 13:10:04 +01:00
Gustavo Iñiguez Goia
c70c289bc8 ui: improved detail views, apply rules to nodes
- Order detail views by Time column correctly.
- Fixed rules editor to apply a rule to All nodes when there's more
  than one node connected.
- Added options to apply rules to a node (#576).
  On the Rules tab select one or more rules, right click on them ->
  Apply to: <node>
2021-12-27 23:37:15 +01:00
Gustavo Iñiguez Goia
a4c8971ca2
Merge pull request #578 from tioguda/master
Updated brazilian translation
2021-12-27 23:37:00 +01:00
tioguda
a290cef539
Fix Brazilian Portuguese translation 2021-12-27 19:31:16 -03:00
Gustavo Iñiguez Goia
c203d7caae
Merge pull request #577 from tioguda/master
Update translation
2021-12-27 21:10:48 +01:00
tioguda
973e83b952
Update Brazilian Portuguese translation 2021-12-27 17:03:45 -03:00
Gustavo Iñiguez Goia
17f8f3a3d1 ui: added missing __init__.py file
Needed for create the python package correctly: python setup.py build

Otherwise the build does not copy directories/files without that file.

Reported here: #565
2021-12-27 20:30:52 +01:00
Gustavo Iñiguez Goia
434bbf9850 ui: better key navigation, improved scrollbars
- Fixed key navigation, scrollbars positioning and resizing event.
- Delegate rows painting operation to data().
- Emit dataChanged() only when the visible rows have changed.
2021-12-26 14:38:30 +01:00
Gustavo Iñiguez Goia
deee72aa50 ui: make GUI usable with thousands of records
The GUI was not usable when there were thousands of records. It used to
get frozen while loading large amount of data, specially when using a DB
stored on disk. Besides, when entering in the details view of an event
it was not possible to filter records by text.

Changes:
- Load by default 50 records instead of all records returned by a query.
- Improved/fixed detail views' queries.

New:
- Allow to filter data in all views, including detail views.
- Allow to limit records in all views.
- Added a help button to display a ballon message with useful
  information.

Fixes:
- selection jumping continuously to row 256 when there were more than
  256 rows.
https://github.com/evilsocket/opensnitch/issues/565#issuecomment-997346990

Even without setting query limits, the GUI is more usable than before,
but it needs more work. WIP.
2021-12-24 15:39:34 +01:00
Gustavo Iñiguez Goia
7c87baff13 ebpf: fixes (TODOs) and improvements
Fixed a problem that caused an infinite loop, leading to fallback to
ProcFS and missing some network events.

Discussion: #550
2021-12-20 15:58:16 +01:00
Gustavo Iñiguez Goia
9770cf5fba ui, events: allow to copy selection to the clipboard
The fields are separated by commas.
2021-12-17 16:24:41 +01:00
Gustavo Iñiguez Goia
8b3e886e99 ui, events: allow to filter events by date/hour
It was possible to filter by full date (xx/dd/mm hh:mm:ss:sss) but no by
hour (12:34).
2021-12-16 15:23:36 +01:00
Gustavo Iñiguez Goia
9e53997489 ui, pop-ups: better countdown behaviour
Now the countdown is stopped when clicking on any of the buttons of the
pop-ups.

Closes #528
2021-12-16 13:08:57 +01:00
Gustavo Iñiguez Goia
13c747ce79 ui, events: better rows selection
As events are received from the daemon, the list of events is reloaded,
and the selection of rows was lost.
This caused several side effects: difficulty to delete multiple rules,
as well as analyze listed events because they were reloaded constantly.

Now if a row is selected, the new events are not loaded until rows
selection is not cleared.

closes #560
2021-12-15 20:35:00 +01:00
Gustavo Iñiguez Goia
7006604db9 ui, pop-ups: better dest domain selection
We had 3 options to filter connections by domain:
- www.domain.com
- *domain.com
- *.domain.com

The second option was a workaround to allow filter domain.com

Now we handle last 2 situations with a single option(/regular expression).

closes #536
2021-12-15 20:01:36 +01:00
Gustavo Iñiguez Goia
91ff72be7b daemon,deb: fixed enabling/starting daemon
The custom postinst and prerm scripts were preventing to use debhelpers
helpers, which in turn were causing installation failures on SysV
systems and not enabling the daemon service.

Closes #558
2021-12-10 20:47:09 +01:00
Gustavo Iñiguez Goia
479b8ded59 improved connections parsing
Under certain conditions, when we dumped inodes via netlink, we were
linking network connections to wrong applications.

- To improve this situation:

1) Use netfilter's UID by default:
   Sometimes the UID reported via netlink was different than the one
   reported by libnetfilter. libnetfilter UID is always correct.
   If you had a rule that filtered by UID, this problem could cause to
   prompt you again to allow the connection.

2) Use the netlink entry that matches exactly the properties of an
   outgoing connection:
   There're some in-kernel sockets that doesn't match 1:1 outgoing
   connections (daemon/netlink/socket.go#L22).
   In order to identify the applications that initiate these network
   connections we use a workaround. But under certain conditions
   (source port reuse), we were associating connections to wrong
   applications.
   So in order to avoid this problem, if there's a 1:1 match use that
   netlink entry. If not, fallback to the workaround.

- misc: added more logs to better debug these issues.
2021-11-15 13:26:52 +01:00
Gustavo Iñiguez Goia
743ef71d7e rules: don't load rules that fail to compile
Be sure that we don't load invalid regexp rules.

related: #536
2021-11-12 12:08:31 +01:00
Gustavo Iñiguez Goia
689c83fa77
Merge pull request #540 from ryanolton/master
Prompt UI height and width fixes
2021-11-04 15:08:52 +01:00
Ryan Olton
c3039dd524 set prompt width and height after initial display; set prompt minimum and maximum size using initial width and height values 2021-11-04 09:41:08 -04:00
Gustavo Iñiguez Goia
9d0c5a104e ui: fixed GUI loading when DE autologin is on
Fixed GUI loading behaviour when DE's autologin is on.

Background:
 Sometimes the system tray is not available, so our app's icon
 does not show up. In this case we show the GUI to allow the user
 manage the rules and view connections.

If the user activated the autologin option, on KDE (and probably others)
our service was launched before the panel was ready, so the system tray was
not available yet and we were showing the Events window.

Changes:
- Delay 10s the check to see if the system tray is available, to give it
  time to load.
- Add X-KDE-Autostart-after=panel to kcm_opensnitch.desktop, to launch
  the GUI only after the panel is loaded.
- Misc: removed OpenSnitch entry from System Settings on KDE, and update
  the categories where the app is shown in the menus.

Closes #535
2021-10-28 18:24:29 +02:00
Gustavo Iñiguez Goia
c609b09f1d ui, tests: added Preferences dialog tests
TODO: test db configuration changes. There're problems clicking on the
QMessageBox.
2021-10-25 13:54:08 +02:00
Gustavo Iñiguez Goia
e8dd17418f Bump versions to v1.5.0rc1 2021-10-19 12:00:22 +02:00
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