- Changed the local host rule from using regexp to network operator
- Updated destination IP check from specific addresses to CIDR notation (127.0.0.0/8)
- Added new rule for IPv6 localhost connections (::1/128)
- Added nolog property to prevent logging of localhost traffic
- Preprend the chroot of a process to the path:
Even if a process is executed from a chroot (or a different mount
namespace), the kernel reports the path as it were from the host.
For chrooted processes, now we prepend the chroot to the path:
Instead of /usr/bin/curl -> /var/cache/pbuilder/usr/bin/curl
Note: if the process is emulated (with qemu for example), the
checksum will be of the emulator.
- For proceses launched from /proc, like /proc/self/exe or
/proc/<pid>/fd/<number>, we were replacing in the cmdline "/proc/*"
with the absolute path of the binary:
Path: /usr/bin/curl
Cmdline reported: /proc/<pid>/fd/<number> -L 1.1.1.1
Cmdline "fixed": /usr/bin/curl -L 1.1.1.1
Now we only do that for /proc/self/exe, and leave
/proc/<pid>/fd/<number> as is, since Path is already the absolute
path to the binary.
Path: /usr/bin/spotify
Cmdline reported: /proc/self/exe
Cmdline "fixed": /usr/bin/spotify
Path: /usr/bin/curl
Cmdline reported: /proc/<pid>/fd/<number> -L 1.1.1.1
Cmdline final: /proc/<pid>/fd/<number> -L 1.1.1.1
- better process interception on aarch64 and armhf.
- on armhf getting proc arguments is ignored due to an error, but we
were not marking the event as INCOMPLETE_ARGS, so we were not reading
the compete cmdline.
Up until now we've been using https://github.com/iovisor/gobpf/ for
intercepting events from the kernel, and it has worked very well.
Unfortunately it's deprecated since 2021 (iovisor/gobpf#304), which means
that some of the known issues and limitations won't be fixed.
After evaluating some options, I've migrated the code from gobpf to
github.com/cilium/ebpf.
More info: #1222, #1312
- Convert remote syslog to remote. There's no real difference between
both, and the code was the same.
Maybe we could limit the logging formats allowed.
- Remote logger: Added option to reopen the connection after n errors
trying to send messages.
tested on several distros with different kernels, as well as in a
private fork and this test doesn't fail.
So until we figure out why it's failing here, let's skip it for now.
- Fixed issue when configuring several loggers.
- Remote logger:
- open as many connections with the remote server as
specified in the Workers field.
- open and handle every connection in each own goroutine.
- get rid of the locks.
- Moved Info message to Trace.
- When applying a default action on a connection (because the daemon is
not connected to the GUI), log the connection details. It eases the
task of creating rules without a GUI.
- Minimize the risk of race conditions when we're prompting the user to
allow/deny a connection, while we're still reading proc's environ file.
(this was actually a leak).
- Preallocate the Env map with the expected environ vars.
Some use cases:
- Reject connections initiated by certain paths:
Deny all connections initiated by cron*:
/usr/sbin/cron
/usr/bin/curl
"action": "reject",
"operator: {
"type": "list",
"operand": "list",
"data": "",
"list": [
{
"type": "regexp",
"operand": "process.parent.path",
// /usr/bin/crond , /usr/bin/crontab, ...
"data": "^/usr/(s|)bin/cron"
}
]
}
- Reject or Allow connections of binaries launched by another app:
"action": "allow",
"operator": {
"type": "list",
"operand": "list",
"data": "",
"list": [
{
"type": "simple",
"operand": "process.parent.path",
"data": "/opt/spotify/bin/spotify"
},
{
"type": "simple",
"operand": "process.path",
"data": "/usr/bin/wget"
}
]
}
You can also combine multiple parent paths, to allow a command launched
from a specific chain of processes:
/usr/lib/systemd/systemd
/usr/sbin/cron
/bin/sh
/usr/bin/curl
The order is checked from the newest process to the oldest (curl -> sh
-> cron -> systemd)
The operand can be used with any of the existing types (simple, regexp,
etc).
Related: #406
Disabled rules were part of the active rules. The fields were not
evaluated, but we still went through the entire list.
Not adding them to the list of active rules improves matching time,
especially when there're a lot of disabled rules.
It mainly affected when matching rules that were non-priority or
ordered alphabetically, with action Allow.
- 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
Sometimes we may receive a connection event after the exit of a
process:
[exec] /bin/xxx, pid 1234
[exit] /bin/xxx, pid 1234
[new conn] pid 1234 -> process unknown (on exec event and no /proc entry)
In these scenarios, we delay the deletion from cache a little
bit, to keep the PID available for a longer time.
- Structs fields alignment fixed.
- Dump more sockets via netlink, in order to display them with the
SocketsMonitor task (netstat).
- Fixed serializing netlink data:
d237ee16c3 (diff-f7f6108a60)
There was a situation where if the ebpf modules path did not exist,
the fw rules were not added, causing the daemon to crash after
connecting to the GUI.
When the Process Connector is used to intercept exec events, get and
build the process tree of a process.
PROCESS CONNECTOR feature was added here: 7a9bb17829
Nfqueue bypass option skips the enqueue of packets to userspace
if no application is listening to the queue.
https://wiki.nftables.org/wiki-nftables/index.php/Queueing_to_userspace
If this flag is not specified, and for example the daemon dies
unexpectedly, all the outbound traffic will be blocked.
Up until now we've been using this flag by default not to block network
traffic if the daemon dies or is killed for some reason. But some users
want to use precisely this behaviour (#884, #1183, #1201).
Now you can configure it, to block connections if the daemon
unexpectedly dies.
The option is on by default in the configuration (QueueBypass: true).
If this item is not present in the daemon config file, then it'll be
false.
- Calculate the ram usage of a process in the daemon, using the page
size of the system.
- Added new functions to read some details of a process, so we can use
them in other parts of the code.