Skip to content

Commit 09e351e

Browse files
Merge branch 'feat/lsm-option' into expidus
2 parents 9c39e90 + 4a6ce49 commit 09e351e

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

nixos/modules/module-list.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@
367367
./security/auditd.nix
368368
./security/ca.nix
369369
./security/chromium-suid-sandbox.nix
370+
./security/default.nix
370371
./security/dhparams.nix
371372
./security/doas.nix
372373
./security/duosec.nix

nixos/modules/security/apparmor.nix

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,7 @@ in
200200
sed '1,/\[qualifiers\]/d' $footer >> $out
201201
'';
202202

203-
boot.kernelParams = [
204-
"apparmor=1"
205-
"security=apparmor"
206-
];
203+
security.lsm = [ "apparmor" ];
207204

208205
systemd.services.apparmor = {
209206
after = [

nixos/modules/security/default.nix

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{ config, lib, ... }:
2+
let
3+
cfg = config.security;
4+
in
5+
{
6+
options = {
7+
security.lsm = lib.mkOption {
8+
type = lib.types.listOf lib.types.str;
9+
default = [ ];
10+
description = ''
11+
A list of the LSMs to initialize.
12+
'';
13+
};
14+
};
15+
16+
config = lib.mkIf (lib.lists.length cfg.lsm > 0) {
17+
boot.kernelParams = [
18+
"lsm=${lib.concatStringsSep "," cfg.lsm}"
19+
];
20+
};
21+
}

0 commit comments

Comments
 (0)