Commit graph

782 commits

Author SHA1 Message Date
themighty1
59216458af Add a custom view/model to display the connections list more efficiently than currently with QSqlQueryModel.
The major steps are:

    - take advantage of sqlite's default autoincremented rowid column
    - add index of the db columns
    - when a filter is applied, we build a map of rowids corresponding to the filter
    - when user scrolls the view, query the db only for that portion of db which contains the rows to be displayed
    - because sqlite cannot use an index when a wildcard is at the start of the LIKE expression, e.g. "process LIKE '%sbin%'", use a workaround:
      - keep track of all distinct values in each column
      - check in python if any of the distinct values contain the filter string
      - reconstruct the query string: instead of "process LIKE '%sbin%'" we use "process IN (<list of distinct values containing 'sbin'>)"

    Minor steps:
    - mimic some QSqlQueryModel's methods so that our model can be a drop-in replacement
    - disable view's default scrollbar and use our own scrollbar which is aware of how many rows are in the db
2020-12-18 16:14:27 +03:00
Gustavo Iñiguez Goia
438ceca57d Bump version to 1.3.0 2020-12-16 18:59:03 +01:00
Gustavo Iñiguez Goia
2f2363785e updated pkgs url paths 2020-12-16 18:14:37 +01:00
Gustavo Iñiguez Goia
ce3db74e2f removed server api/lib
A common api/lib that other tools can use in order to commnicate with
nodes: a GUI, a TUI, a proxy that sends stats to a remote DB, etc...

In future versions we may add it back.
2020-12-16 18:08:00 +01:00
Gustavo Iñiguez Goia
4443673ed1 fixed how we check rules
- Rules are checked in alphabetical order.
- Deny and Priority rules must take precedence.
- If a rule matches and it's Allow-NoPriority, then return the rule.
- Otherwise we'll return nil.
2020-12-15 16:09:28 +01:00
Gustavo Iñiguez Goia
b6cbc6769e fixed rules Enabled check 2020-12-13 11:50:58 +01:00
Gustavo Iñiguez Goia
db31e5b71a fw: fixed 100% CPU spike, fixed cleaning rules
- Fixed 100% CPU spike when pausing interception from the GUI
gustavo-iniguez-goya/opensnitch/issues/104
- Fixed monitoring fw rules after re-enabling interception.
- Fixed cleaning up interception and system rules.
2020-12-12 18:16:59 +01:00
Gustavo Iñiguez Goia
f751dc13c6 removed sudo from Makefiles
Documentation must be updated to indicate when to use sudo.

closes #291
2020-12-11 23:42:47 +01:00
Gustavo Iñiguez Goia
719c906267 fixed regexp rules when using case-sensitive strings 2020-12-11 22:03:00 +01:00
Gustavo Iñiguez Goia
f3d5292ccc ui, prefs: allow to configure if show popups or not 2020-12-11 13:44:46 +01:00
Gustavo Iñiguez Goia
d47e75d76f fixed filtering by dst network, fixed regression
- Fixed complex rules.
- Fixed filtering by destination network.
2020-12-10 23:09:24 +01:00
Gustavo Iñiguez Goia
d22ae3a6a0 ui, pop-ups: fixed network rule type, fixed typo, ..
- Fixed network rules types.
- Fixed typo when resetting expanded view.
- Limit rule name length. It was causing errors saving the file to disk
  it it was too long.
2020-12-10 22:28:21 +01:00
Gustavo Iñiguez Goia
e13015ce67 updated import paths 2020-12-09 18:18:42 +01:00
Gustavo Iñiguez Goia
6c32461392 Updated README 2020-12-09 16:35:27 +01:00
Gustavo Iñiguez Goia
3a3d3d8f42 Merge opensnitch 1.3.0-rc2 2020-12-09 15:41:18 +01:00
Gustavo Iñiguez Goia
66c356508c ui, prefs: added checkbox to disable connections pop-ups
Instead of setting manually the default timeout to 0, use a checkbox to do
the same.
2020-12-08 00:46:52 +01:00
Gustavo Iñiguez Goia
f5e3494d12 ui,stats: added icons to the tabs and restyling 2020-12-07 21:56:17 +01:00
Gustavo Iñiguez Goia
aed5c861ac ui, popups: allow to filter by networks, bug fixes
- Allow to filter connections by destination network. closes #89

- Do not send a rule if the operator data is empty.
- Fixed displaying the path of a process, if it's not in the command
  line, e.g.:
  binary: /usr/bin/curl
  cmdline: curl -L github.com
2020-12-07 13:22:56 +01:00
Gustavo Iñiguez Goia
ac9fc47d9a auditd: don't parse proctitle field, use cmdline instead
auditd proctitle field sems to be trunctated to 128 characters, which
causes in some situations to not obtain the complete command line.
2020-12-07 13:01:10 +01:00
Gustavo Iñiguez Goia
2878721189 ui, rpm: added python3-protobuf as weak dependency
We're incompatible for some reason with the package python3-grpcio
distributed by many distros, but python3-protobuf works fine.
2020-12-04 01:35:02 +01:00
Gustavo Iñiguez Goia
1f415a5799 added option to filter by destination network
Now you can filter by destination network, for example:
- 127.0.0.1/8
- 192.168.1.0/24

This will ease to solve the request #89 .

Some common network ranges have also been added so you can select them
from a combo box. More info #73.

Added process.id operator operand for future use, in order to filter by
PID.
2020-12-04 01:11:47 +01:00
Gustavo Iñiguez Goia
ad2927d75d ui,rpm: added slugify dependency for SuSe systems 2020-12-03 21:27:38 +01:00
Gustavo Iñiguez Goia
a7babc7b63 ui,rpm: add python3-slugify as weak dependency
python3-slugify is not available in all rpm based distributions.

Adding it as weak dependency will install it if the package is
available, thus avoiding to install it using pip.
2020-12-03 00:46:43 +01:00
Gustavo Iñiguez Goia
6619124db7 Bumped versions to 1.3.0rc2 2020-11-28 12:26:39 +01:00
Gustavo Iñiguez Goia
3c06fbf8d3 ui: added .spec file for create UI rpms 2020-11-28 12:20:46 +01:00
Gustavo Iñiguez Goia
c25f49d8a7 ui: fixed launching the UI on more environments
Better resolve where the UI python package is.

related #59
2020-11-28 11:02:03 +01:00
Gustavo Iñiguez Goia
f9d9af9a5f ui: replaced deprecated tostring() by tobytes()
> Deprecated since version 3.2, will be removed in version 3.9.

And they did!

https://docs.python.org/3.9/library/array.html#array.array.tobytes
2020-11-28 01:41:46 +01:00
Gustavo Iñiguez Goia
df952d974e fixed errors when IPv6 is not enabled in the system
If IPv6 was not enabled we failed to add IPv6 rules.

closes #96
2020-11-26 16:25:48 +01:00
Gustavo Iñiguez Goia
0b85f6be10 ui, pop-ups: improved connections visualizing
The path and arguments of a process were not displayed correctly.
closes #93

On the other hand, the combo box option (allow/deny) "from this process"
was misleading. Changed by "from this executable". #94
2020-11-24 17:46:12 +01:00
Gustavo Iñiguez Goia
e8683e77be improved packets parsing
We were checking several times if a packet was IPv6.

Additionally we were itereating over all the layers of the packet, when
in reality we're only interested in network layer and transport layer.

This change brings down packets parsing from ~200µs to ~2µs.
2020-11-24 01:35:36 +01:00
Gustavo Iñiguez Goia
99afc6cccb audit: stop reading messages when calling Stop() 2020-11-22 13:31:10 +01:00
Gustavo Iñiguez Goia
26ca52d127 audit: schedule deletion of old events
Instead of check for old events every time we add a new one, do it every
5 minutes.

This improves the performance significantly.
2020-11-22 01:00:43 +01:00
Gustavo Iñiguez Goia
cdea3b5175 deb, ui: bump version to 1.3.0~rc-1 2020-11-20 13:33:44 +01:00
Gustavo Iñiguez Goia
0b806e050e ui, proc details: better descriptors formatting 2020-11-20 01:34:53 +01:00
Gustavo Iñiguez Goia
c1e8bc3156 netlink: de/serialize ipv6, dump socket list
- De/Serialize IPv6 connections.
- Added SocketsDump() to list all sockets currently in the kernel.
- [proc details] Resolve all the sockets an application has opened
  and translate them to network data, e.g:
  ```
  ls -l /proc/1234/fd/
    0  ... 25 -> socket[12345678]
  ```
  to
  ```
    0 .... 25 -> socket[12345678] - 54321:10.0.2.2 -> github.com:443,
  state: established
  ```
2020-11-20 00:53:29 +01:00
Gustavo Iñiguez Goia
c969e7909d ui: fallback to Qt built-in icons if no valid icon theme configured
There're several situations where the icons of the app don't show up:
 - icon theme not configured.
 - icon theme configured but lacks standard icons defined by the
   standard (freedesktop).
 - icon theme configured but Qt doesn't load it.

If we fall into any of these cases, use the Qt built-in icons .

More information on this issue: #53

* removed non-used imports.
2020-11-19 01:00:58 +01:00
Gustavo Iñiguez Goia
df3e7c3ef7 ui, stats/database: removed non used imports 2020-11-18 15:36:12 +01:00
Gustavo Iñiguez Goia
76f078e146 Update issue templates 2020-11-18 10:59:02 +01:00
Gustavo Iñiguez Goia
98d7cc0d2d ui, stats: fixed syntax error when restoring rules label
closes #90
2020-11-18 00:40:21 +01:00
Gustavo Iñiguez Goia
3c0ba1e5c1 ui, process details dialog improvements
- Allow to monitor applications having the dialog open.
- If an application has multiple pids, but some are already closed and
  others are still running, don't close the dialog so you can select
  which pid to monitor.
2020-11-17 23:11:49 +01:00
Gustavo Iñiguez Goia
a517ebe9bc ui,stats: fixed crash caused by a typo 2020-11-17 00:21:03 +01:00
Gustavo Iñiguez Goia
3a080cef3e ui: added missing processdetails file 2020-11-16 21:18:16 +01:00
Gustavo Iñiguez Goia
c8d1161061 added dialog to inspect details of a process in realtime (procfs)
New dialog added to display details of a process in realtime, gathered
from ProcFS.
Process tab -> double click on an app -> click on the button with the
search icon.

We have also improved the discovery of apps icons and names. It should
work better on systems where the DE is not properly configured.

Tested, but not bulletproof, still in beta.
2020-11-16 17:09:52 +01:00
Gustavo Iñiguez Goia
a3a7becbc8 fixed exception if system-fw.json doesn't exist
closes #88
2020-11-15 00:53:13 +01:00
Gustavo Iñiguez Goia
8b7e761aef deb: better RC version
1.3.0~rc > 1.2.0
1.3.0 > 1.3.0~rc
2020-11-14 12:17:18 +01:00
Gustavo Iñiguez Goia
9ca70b6d46 deb, rpm: install system-fw.json 2020-11-13 17:29:37 +01:00
Gustavo Iñiguez Goia
b41aadbaac daemon packaging: set the next release version (rc) 2020-11-13 17:29:37 +01:00
Gustavo Iñiguez Goia
6286eca7d1
Merge pull request #86 from bloowitt/stringcheck
Edit strings for UI
2020-11-13 17:25:04 +01:00
Alex Ortiz de Guinea
8c715e7af7 Edit strings for UI 2020-11-13 16:18:15 +00:00
Gustavo Iñiguez Goia
831ab347e3 Merge branch 'priority-rules' into main
Added option to let the users define iptables rules.

The system rules are added in the file /etc/opensnitchd/system-fw.json
with this format:
```
{
    "SystemRules": [
        {
            "Rule": {
                "Description": "Allow pptp VPN",
                "Table": "mangle",
                "Chain": "OUTPUT",
                "Parameters": "-p gre",
                "Target": "ACCEPT",
                "TargetParameters": ""
            }
        }
    ]
}
```
On the mangle table, OUTPUT chain, these rules are added before
the NFQUEUE interception rule, so any rule you add there bypasses the
interception. Useful to allow traffic you don't want to intercept.

This feature solves in some way the issue some users have connecting to
VPNs when the Default Action configured in the daemon is Deny.

For example:
- OpenVPN when keepalive is configured and ICMP is used.
- PPTP because the GRE routing protocol is blocked.
- probably others like IPSEC.

(regarding WireGuard, as far as I can tell it works just fine, see #61).

closes #47
2020-11-13 00:14:39 +01:00