From ebaff599ba0e76ab3c505c4039df979d3799a17c Mon Sep 17 00:00:00 2001 From: Christian Albrecht Date: Sun, 9 Jul 2017 18:59:09 +0200 Subject: nixos/auditd: init at 2.7.6 (#27261) #11864 Support Linux audit subsystem Add the auditd.service as NixOS module to be able to generate profiles from /var/log/audit/audit.log with apparmor-utils. auditd needs the folder /var/log/audit to be present on start so this is generated in ExecPreStart. auditd starts with -s nochange so that effective audit processing is managed by the audit.service. --- nixos/modules/security/auditd.nix | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 nixos/modules/security/auditd.nix (limited to 'nixos/modules/security/auditd.nix') diff --git a/nixos/modules/security/auditd.nix b/nixos/modules/security/auditd.nix new file mode 100644 index 000000000000..319dce9a6c55 --- /dev/null +++ b/nixos/modules/security/auditd.nix @@ -0,0 +1,26 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + options.security.auditd.enable = mkEnableOption "the Linux Audit daemon"; + + config = mkIf config.security.auditd.enable { + systemd.services.auditd = { + description = "Linux Audit daemon"; + wantedBy = [ "basic.target" ]; + + unitConfig = { + ConditionVirtualization = "!container"; + ConditionSecurity = [ "audit" ]; + }; + + path = [ pkgs.audit ]; + + serviceConfig = { + ExecStartPre="${pkgs.coreutils}/bin/mkdir -p /var/log/audit"; + ExecStart = "${pkgs.audit}/bin/auditd -l -n -s nochange"; + }; + }; + }; +} -- cgit 1.4.1