Commit graph

26 commits

Author SHA1 Message Date
Gustavo Iñiguez Goia
335f2a783d netstat: allow to list XDP sockets
- daemon: Allow to dump XDP sockets from kernel.
 - ui: Added options to filter by RAW protocol and AF_XDP family.
 - Bumped vishvananda/netlink version to v1.3.0.
 - Updated go.mod and go.sum
2025-02-05 00:05:02 +01:00
Gustavo Iñiguez Goia
9e0f3a4797
introducing daemon tasks
daemon tasks are actions that are executed in background by the daemon.

They're started from the GUI (server) via a Notification (protobuf),
with the type TASK_START (protobuf).

Once received in the daemon, the TaskManager starts the task in
background.

Tasks may run at interval times (every 5s, 2days, etc), until they
finish an operation, until a timeout, etc.

Each task has each own configuration options, which will customize the
behaviour of its operations.

In this version, if the GUI is closed, the daemon will stop all the
running tasks.
Each Task has a flag to ignore this behaviour, for example if they need
to run until they finish and only send a notification to the GUI,
instead of streaming data continuously to the GUI (server).

 - Up until now we only had one task that could be initiated from the GUI:
   the process monitor dialog. It has been migrated to a Task{}.
 - go.mod bumped to v1.20, to use unsafe string functions.
 - go.sum updated accordingly.
2024-09-25 01:00:38 +02:00
Gustavo Iñiguez Goia
2238e63892
updated go.mod, added go.sum 2024-05-22 01:39:19 +02:00
Gustavo Iñiguez Goia
5b2cec0d4b
go.mod: updated deps, minimum required go version 2023-10-23 20:50:24 +02:00
Gustavo Iñiguez Goia
7d8eb36f60
Merge branch 'master' into oscs_fix_cjri7kgau51vtpiu8un0 2023-10-23 18:41:48 +00:00
Gustavo Iñiguez Goia
0a01e44870
Merge pull request #992 from chncaption/oscs_fix_cit2hp0au51ueorq4bpg
fix(sec): upgrade golang.org/x/sys to 0.1.0
2023-10-23 18:40:53 +00:00
Gustavo Iñiguez Goia
1176fa5b9c
updated go.mod
Bumped gopacket and netlink versions.
2023-09-22 01:05:20 +02:00
Huoxi-any
5f907e545d update golang.org/x/net v0.0.0-20211209124913-491a49abca63 to 0.7.0 2023-09-05 20:49:33 +08:00
chncaption
6ede8f06a1 update golang.org/x/sys v0.0.0-20211205182925-97ca703d548d to 0.1.0 2023-07-21 14:42:51 +08:00
Gustavo Iñiguez Goia
b560ad6967
Added systemd-resolved DNS monitor
Up until now we intercepted query and DNS answers using these methods:
 - Intercepting DNS queries to port 53.
 - Intercepting DNS answers from port 53
 - Intercepting glibc DNS functions.

Unfortunately there are scenarios where these methods are not enough:
 - When using DNSSEC, DoT, DoH, etc.
 - When resolvers return DNS answers from cache
 - When resolvers don't use glibc functions to resolve domains.
 - When applications use D-BUS to query for domain names instead of
   using UDP/TCP (VPNs, flatpaks, electron based apps, etc.).

With this new DNS monitor now we're able to intercept DNS answers when
systemd-resolved is used to resolve domains.
This includes queries from flatpaks and others containerized
applications, as well as cyphered DNS queries.

Closes #874
2023-03-10 15:04:42 +01:00
Gustavo Iñiguez Goia
b546fb9e7a
Bump nftables-go lib version to 0.1.0 2023-01-22 14:40:08 +01:00
Gustavo Iñiguez Goia
18dc32c51f
removed ftrace monitor method
deprecated, was not in use.
2023-01-21 21:03:53 +01: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
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
88b30e98d1 go.mod: updated nftables version
google/nftables removed koneu/natend lib, so we don't need it anymore.

Reported here: #623
2022-02-17 16:16:44 +01:00
Gustavo Iñiguez Goia
655f1ebe6e updated protoc command to generate the protobuffer
closes #521
2021-10-06 11:10:57 +02:00
themighty1
0776c1b895
github.com/golang/protobuf deprecated 2021-09-15 04:26:53 +00: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
da23c827f7 added nftables support
Added basic nftables support, which adds the needed rules to intercept
outgoing network traffic and DNS responses. System rules will be added
soon.

What netfilter subsystem to use is determined based on the following:
- nftables: if the _iptables_ binary is not present in the system, or
  if the iptables version (iptables -V) is
  "iptables vX.Y.Z (nf_tables)".
- iptables: in the rest of the cases.
2021-06-07 01:32:05 +02:00
Arnout Engelen
356428b6c9
Add gobpf to go.mod
gobpf was introduced in #397 but not added to go.mod yet
2021-05-19 21:21:27 +02:00
Arnout Engelen
1f26f66e8a
Support more recent protoc-gen-go
When building the project with protoc-gen-go version 1.5.1,
it fails with the following:

```
protoc -I. ui.proto --go_out=plugins=grpc:../daemon/ui/protocol/
protoc-gen-go: unable to determine Go import path for "ui.proto"

Please specify either:
	• a "go_package" option in the .proto source file, or
	• a "M" argument on the command line.

See https://developers.google.com/protocol-buffers/docs/reference/go-generated#package for more information.

--go_out: protoc-gen-go: Plugin failed with status code 1.
```

This can be fixed by adding the full go package as an option in the
proto file. To make sure the code is generated to the correct path,
we also have to add add the `paths=source_relative` option to the
protoc plugin.

After this, the code is generated correctly, but the generated code
references classes like grpc.ClientConnInterface which were introduced
in 1.27.0.
2021-03-28 16:38:21 +02:00
Gustavo Iñiguez Goia
e13015ce67 updated import paths 2020-12-09 18:18:42 +01:00
NP-Hardass
08abdd0950 go.mod: add netns as indirect dependency for netlink 2020-09-08 17:07:28 -04:00
Gustavo Iñiguez Goia
c0fb84a0e3 changed go.mod to not depend on a fixed release 2020-07-17 02:03:03 +02:00
Raphael
ffbb138bd6 equip go.mod file with packages 2020-07-16 23:06:32 +02:00
Raphael
563247a87c add go.mod and remove old Gopkg.lock 2020-07-16 23:05:25 +02:00