Skip to content

Conversation

@LordGrimmauld
Copy link
Contributor

@LordGrimmauld LordGrimmauld commented Jun 25, 2025

Upstream PR merged: linux-audit/audit-userspace#467

Needed to fix #419093

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • Nixpkgs 25.11 Release Notes (or backporting 24.11 and 25.05 Nixpkgs Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
  • NixOS 25.11 Release Notes (or backporting 24.11 and 25.05 NixOS Release notes)
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other contributing documentation in corresponding paths.

Add a 👍 reaction to pull requests you find important.

@LordGrimmauld
Copy link
Contributor Author

This would be augmented by #420001, but not strictly necessary. I just believe it makes sense to adopt both, and bring both to modern standards. This is a good opportunity.

@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Jun 25, 2025
@LordGrimmauld LordGrimmauld force-pushed the audit-plugins branch 3 times, most recently from ea6d40c to a4bcc35 Compare June 28, 2025 12:42
@LordGrimmauld
Copy link
Contributor Author

The upstream PR just landed

@LordGrimmauld LordGrimmauld marked this pull request as ready for review June 28, 2025 12:44
@LordGrimmauld LordGrimmauld force-pushed the audit-plugins branch 3 times, most recently from 2bd5220 to c7b37e7 Compare June 28, 2025 14:50
@LordGrimmauld
Copy link
Contributor Author

Ran the VM test by rebasing to master, worked perfectly fine

@LordGrimmauld
Copy link
Contributor Author

LordGrimmauld commented Jun 30, 2025

linux-audit/audit-userspace#469 (comment)

A new release is planned for next Monday

if this isn't merged by then, i'll bump to 4.0.6 (assuming that is the next release tag) instead of fetching the patch.

It might also make sense to test service restarting in the VM test, though i did so by adding that on my local branch and it "just worked", so chances are we are unaffected by that.

])
);
options = {
# space_left needs to be larger than admin_space_left, yet they default to be the same if left open.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be an assertion?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe. Problem is, this does not have to be a number, it can also be e.g. "10%", and the other can be a number, making assertions extremely awkward (and fully impossible if one is % and the other is absolute).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrote an assert. It will not check the case where one is % and the other absolute, but it does check %/% and abs/abs

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a gut feeling that this is one of those too complex assertions that will become a maintancen burden but since it's already written I won't ask you to undo it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe, and then i can still remove it. But the regex to match for definitions is quite strict, so there shouldn't be anything unexpected happening here.

Comment on lines 173 to 259
security.auditd.plugins = {
af_unix = {
path = lib.getExe' pkgs.audit "audisp-af_unix";
args = [
"0640"
"/var/run/audispd_events"
"string"
];
format = "binary";
};
remote = {
path = lib.getExe' pkgs.audit "audisp-remote";
config = { };
};
filter = {
path = lib.getExe' pkgs.audit "audisp-filter";
args = [
"allowlist"
"/etc/audit/audisp-filter.conf"
(lib.getExe' pkgs.audit "audisp-syslog")
"LOG_USER"
"LOG_INFO"
"interpret"
];
config = { };
};
syslog = {
path = lib.getExe' pkgs.audit "audisp-syslog";
args = [ "LOG_INFO" ];
};
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This configuration is not introspectable from the options search. Reconfiguring the module from the config block is not ideal.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but i am not super sure how to do this better. I still want to allow for arbitrary plugins to be configurable, and these default plugins need to be configured somewhere.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no good answer for how to do this any other way, sorry.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if there isn't a better way to do this, then this should be fine. Yes its not really introspectable, but without a solution its not actionable either

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, i added the definition to defaultText, that should be acceptable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a good enough solution for now and definitely a significant improvement over the status quo.

@LordGrimmauld
Copy link
Contributor Author

Thanks for the detailed review! I copied most of the descriptions from the man pages, but it is entirely fair to adjust them to our style of documentation that is properly searchable and readable.

I can try the assertion (though the logic will get awkward). Making the default plugins introspectable is more complex, not sure how to approach that yet.

@LordGrimmauld LordGrimmauld force-pushed the audit-plugins branch 2 times, most recently from 99e24cf to 57ddbb7 Compare July 2, 2025 06:53
@LordGrimmauld
Copy link
Contributor Author

Seeing as i have some work to do here still, it is probably better to get #421698 merged (so we can start the staging cycle) and fix up the nix support to be able to configure this stuff later. That way we don't need to hurry as much, which is just prone to unnecessary mistakes.

@LordGrimmauld LordGrimmauld marked this pull request as draft July 2, 2025 07:41
@LordGrimmauld LordGrimmauld marked this pull request as ready for review July 2, 2025 07:55
@nixpkgs-ci nixpkgs-ci bot removed 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. labels Jul 2, 2025
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. labels Jul 2, 2025
@LordGrimmauld LordGrimmauld changed the base branch from staging to staging-next July 5, 2025 13:27
@nixpkgs-ci nixpkgs-ci bot closed this Jul 5, 2025
@nixpkgs-ci nixpkgs-ci bot reopened this Jul 5, 2025
@LordGrimmauld LordGrimmauld changed the title audit: support plugins, adopt nixos/auditd: support plugins Jul 5, 2025
@LordGrimmauld LordGrimmauld changed the base branch from staging-next to master July 13, 2025 18:22
@nixpkgs-ci nixpkgs-ci bot closed this Jul 13, 2025
@nixpkgs-ci nixpkgs-ci bot reopened this Jul 13, 2025
@LordGrimmauld
Copy link
Contributor Author

Update: Today i went to build and run the audit testsuite (https://github.com/linux-audit/audit-testsuite), with plans of adding that to a VM test. Result: Hilariously broken, mostly because we don't even configure audit at all currently (until this PR gets a merge). This is probably not great, working audit (with a green test suite) would be nice.

@LordGrimmauld LordGrimmauld mentioned this pull request Jul 30, 2025
13 tasks
@nixpkgs-ci nixpkgs-ci bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Jul 31, 2025
@nixpkgs-ci nixpkgs-ci bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Aug 3, 2025
Copy link
Contributor

@nikstur nikstur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! There's some things to clean up but overall it's a great improvement and thus merge-worthy.

Comment on lines 173 to 259
security.auditd.plugins = {
af_unix = {
path = lib.getExe' pkgs.audit "audisp-af_unix";
args = [
"0640"
"/var/run/audispd_events"
"string"
];
format = "binary";
};
remote = {
path = lib.getExe' pkgs.audit "audisp-remote";
config = { };
};
filter = {
path = lib.getExe' pkgs.audit "audisp-filter";
args = [
"allowlist"
"/etc/audit/audisp-filter.conf"
(lib.getExe' pkgs.audit "audisp-syslog")
"LOG_USER"
"LOG_INFO"
"interpret"
];
config = { };
};
syslog = {
path = lib.getExe' pkgs.audit "audisp-syslog";
args = [ "LOG_INFO" ];
};
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a good enough solution for now and definitely a significant improvement over the status quo.

}
) (lib.filterAttrs (_: v: v.config != null) cfg.plugins));

security.auditd.plugins = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be aware of overriding parts of this config. The way config is merged based on it's priority is no t immediately obvious. See #285114

There is no action you can take right now but when this module is used, this might come up in the future.

])
);
options = {
# space_left needs to be larger than admin_space_left, yet they default to be the same if left open.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a gut feeling that this is one of those too complex assertions that will become a maintancen burden but since it's already written I won't ask you to undo it.

@LordGrimmauld
Copy link
Contributor Author

Thank you for the review, and happy to have this finally moving forward a bit :)

@nikstur nikstur merged commit 4896f8c into NixOS:master Aug 4, 2025
25 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

opensnitch{,-ui,ebpf}: is very broken

3 participants