mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 04:35:41 +03:00
nixos/security: init lsm option
This commit is contained in:
parent
10214747f5
commit
b8402295a4
2 changed files with 29 additions and 0 deletions
|
@ -366,6 +366,7 @@
|
||||||
./security/auditd.nix
|
./security/auditd.nix
|
||||||
./security/ca.nix
|
./security/ca.nix
|
||||||
./security/chromium-suid-sandbox.nix
|
./security/chromium-suid-sandbox.nix
|
||||||
|
./security/default.nix
|
||||||
./security/dhparams.nix
|
./security/dhparams.nix
|
||||||
./security/doas.nix
|
./security/doas.nix
|
||||||
./security/duosec.nix
|
./security/duosec.nix
|
||||||
|
|
28
nixos/modules/security/default.nix
Normal file
28
nixos/modules/security/default.nix
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
{ config, lib, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.security;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
security.lsm = lib.mkOption {
|
||||||
|
type = lib.types.uniq (lib.types.listOf lib.types.str);
|
||||||
|
default = [ ];
|
||||||
|
description = ''
|
||||||
|
A list of the LSMs to initialize in order.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf (lib.lists.length cfg.lsm > 0) {
|
||||||
|
assertions = [
|
||||||
|
{
|
||||||
|
assertion = builtins.length (lib.filter (lib.hasPrefix "security=") config.boot.kernelParams) == 0;
|
||||||
|
message = "security parameter in boot.kernelParams cannot be used when security.lsm is used";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
boot.kernelParams = [
|
||||||
|
"lsm=${lib.concatStringsSep "," cfg.lsm}"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue