git.iko.soy/typeable/nixpkgs
on master help sign in
audit service: Explicitly call auditctl to disable everything

Otherwise, journald might be starting auditing. Some reading: - https://fedorahosted.org/fesco/ticket/1311 - https://github.com/systemd/systemd/issues/959 - https://github.com/openSUSE/systemd/commit/64f83d3087402c6f8730c1bc4b8fac59b84d4666

commit5eff0b990cb2f2a9492b31f825679608d5f09d19 authorTuomas Tynkkynen <tuomas@tuxera.com> dateSun 28 Aug 2016, 18:57 (10 years ago) parent20ab753
1 file changed+11−3
nixos/modules/security/audit.nix+11−3
nixos/modules/security/audit.nix+11−3
@@ -4,6 +4,7 @@ with lib;
44
55let
66 cfg = config.security.audit;
7+ enabled = cfg.enable == "lock" || cfg.enable;
78
89 failureModes = {
910 silent = 0;
@@ -11,6 +12,13 @@ let
1112 panic = 2;
1213 };
1314
15+ disableScript = pkgs.writeScript "audit-disable" ''
16+ #!${pkgs.stdenv.shell} -eu
17+ # Explicitly disable everything, as otherwise journald might start it.
18+ auditctl -D
19+ auditctl -e 0 -a task,never
20+ '';
21+
1422 # TODO: it seems like people like their rules to be somewhat secret, yet they will not be if
1523 # put in the store like this. At the same time, it doesn't feel like a huge deal and working
1624 # around that is a pain so I'm leaving it like this for now.
@@ -91,7 +99,7 @@ in {
9199 };
92100 };
93101
94− config = mkIf (cfg.enable == "lock" || cfg.enable) {
102+ config = {
95103 systemd.services.audit = {
96104 description = "Kernel Auditing";
97105 wantedBy = [ "basic.target" ];
@@ -103,8 +111,8 @@ in {
103111 serviceConfig = {
104112 Type = "oneshot";
105113 RemainAfterExit = true;
106− ExecStart = "@${startScript} audit-start";
107− ExecStop = "@${stopScript} audit-stop";
114+ ExecStart = "@${if enabled then startScript else disableScript} audit-start";
115+ ExecStop = "@${stopScript} audit-stop";
108116 };
109117 };
110118 };