···53535454 backlogLimit = lib.mkOption {
5555 type = lib.types.int;
5656- default = 64; # Apparently the kernel default
5656+ # Significantly increase from the kernel default of 64 because a
5757+ # normal systems generates way more logs.
5858+ default = 1024;
5759 description = ''
5860 The maximum number of outstanding audit buffers allowed; exceeding this is
5961 considered a failure and handled in a manner specified by failureMode.
···8183 };
82848385 config = lib.mkIf (cfg.enable == "lock" || cfg.enable) {
8686+ boot.kernelParams = [
8787+ # A lot of audit events happen before the systemd service starts. Thus
8888+ # enable it via the kernel commandline to have the audit subsystem ready
8989+ # as soon as the kernel starts.
9090+ "audit=1"
9191+ # Also set the backlog limit because the kernel default is too small to
9292+ # capture all of them before the service starts.
9393+ "audit_backlog_limit=${toString cfg.backlogLimit}"
9494+ ];
9595+9696+ environment.systemPackages = [ pkgs.audit ];
9797+8498 systemd.services.audit-rules = {
8599 description = "Load Audit Rules";
86100 wantedBy = [ "sysinit.target" ];
+1-3
nixos/modules/security/auditd.nix
···202202 }
203203 ];
204204205205- # Starting auditd should also enable loading the audit rules..
205205+ # Starting the userspace daemon should also enable audit in the kernel
206206 security.audit.enable = lib.mkDefault true;
207207-208208- environment.systemPackages = [ pkgs.audit ];
209207210208 # setting this to anything other than /etc/audit/plugins.d will break, so we pin it here
211209 security.auditd.settings.plugin_dir = "/etc/audit/plugins.d";