git.iko.soy/typeable/nixpkgs
on master help sign in
grsecurity: add option to disable chroot caps restriction

The chroot caps restriction disallows chroot'ed processes from running any command that requires `CAP_SYS_ADMIN`, breaking `nixos-rebuild`. See e.g., https://github.com/NixOS/nixpkgs/issues/15293 This significantly weakens chroot protections, but to break nixos-rebuild out of the box is too severe.

commitd4d7bfe07bf97efb228ea949a1f09644e924b82d authorJoachim Fasting <joachifm@fastmail.fm> dateSun 8 May 2016, 08:32 (11 years ago) parent8ca190c
2 files changed+15
nixos/modules/security/grsecurity.nix+13 pkgs/build-support/grsecurity/default.nix+2
nixos/modules/security/grsecurity.nix+13
@@ -126,6 +126,19 @@ in
126126 '';
127127 };
128128
129+ denyChrootCaps = mkOption {
130+ type = types.bool;
131+ default = false;
132+ description = ''
133+ Whether to lower capabilities of all processes within a chroot,
134+ preventing commands that require <literal>CAP_SYS_ADMIN</literal>.
135+
136+ This protection is disabled by default because it breaks
137+ <literal>nixos-rebuild</literal>. Whenever possible, it is
138+ highly recommended to enable this protection.
139+ '';
140+ };
141+
129142 denyUSB = mkOption {
130143 type = types.bool;
131144 default = false;
pkgs/build-support/grsecurity/default.nix+2
@@ -8,6 +8,7 @@ let
88 config = {
99 mode = "auto";
1010 sysctl = false;
11+ denyChrootCaps = false;
1112 denyChrootChmod = false;
1213 denyUSB = false;
1314 restrictProc = false;
@@ -112,6 +113,7 @@ let
112113 }
113114
114115 GRKERNSEC_SYSCTL ${boolToKernOpt cfg.config.sysctl}
116+ GRKERNSEC_CHROOT_CAPS ${boolToKernOpt cfg.config.denyChrootCaps}
115117 GRKERNSEC_CHROOT_CHMOD ${boolToKernOpt cfg.config.denyChrootChmod}
116118 GRKERNSEC_DENYUSB ${boolToKernOpt cfg.config.denyUSB}
117119 GRKERNSEC_NO_RBAC ${boolToKernOpt cfg.config.disableRBAC}