-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos/opensnitch: Add support for EPBF process monitor #229627
Conversation
@onny looks good, I did some build tests last night, can you add a conditional for kernel version to be at least 5.10?
I don’t think a path flag being added In the upstream source is a hard requirement for this PR, since the file can still be linked by Also the version should be |
6dbf3fe
to
b3d14cc
Compare
@Slime90 Added the changes. I'm going to test it on my local setup :) Can you tell me where you got the kernel version requirement? Do we have any older kernels here on NixOS? |
@onny i checked the repl to see which kernel packages 22.11 currently has, and built the ebpf module backward until it failed. Everything from 5.10 and up built fine. I’m not sure I see any new config to install the ebpf module though in the service module, I think that should be achievable, so the user doesn’t have to go do an extra step. This should only be installed if ebpf is the chosen process monitor method in the service config Edit: My brain is fried, is just including the src in environment.etc conditionally enough to trigger the build before the link? |
If we target master after 23.05 release we might drop this kernel version condition? |
The minimum kernel version condition is to allow maximum compatibility, and you can see in other places that this is a common practice. The system can be configured for many Linux kernels ranging from 4.x to latest, even though they are not default for the release. Users should be able to build this module for every nixos supported kernel version, in this case the build breaks below 5.10 because of missing in tree dependencies so we must set that as the minimum version |
1b6f50b
to
0ee14bd
Compare
Updated PR, now only contains commits related to EPBF process monitor support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- The new system rules do not work, as no
system-fw.json
is present at/etc/opensnitchd/system-fw.json
. Though I am unsure whether this is deemed important for the nixos use-case. - The used firewall in
services.opensnitch.settings.Firewall
should be set according tonetworking.nftables.enable
to either"iptables"
or"nftables"
.
Since the missing system-fw.json file results in errors in the daemon log, I placed the file into the desired directory. For now the file is not configurable.
I thought we already moved to nftables by default since switching to iptables-nftables-compat? #81172 |
Tests introduced with this PR ( #248011) succeed on with this PR |
Created an upstream bug report on this evilsocket/opensnitch#1013 |
This looks good to me, does anyone have any more objections to merging ? |
I tested it, but I think this should reverted. Unlike the Application rules, which are each placed in separate files, the system level rules are constrained to a single File. Perhaps as a compromise add a copy of the file, if it doesn't exist yet at system activation?
A casual glance at that PR, suggests that only the backend was switched to Having tested with |
Co-authored-by: Slime90
@MinerSebas okay fixed it :) |
Description of changes
Adding support for EPBF process monitor. As described here in the manual, this is the default monitor mode for OpenSnitch because it is more efficent and secure.
Nftables usage and epbf monitor mode is now default as defined in upstream configuration. The old monitor method can be configured like this:
Optionally depends on upstream ability to configure the kernel module path evilsocket/opensnitch#928
Sucessfull build depends on opensnitch version update #246373
Work was done by @Slime90 which I'll add as a co-author to this PR.
Fixes #227294
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)