File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
modules/security/wrappers Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 11{ config , lib , pkgs , ... } :
22let
33
4- inherit ( config . security ) wrapperDir wrappers ;
4+ inherit ( config . security ) wrapperDir ;
5+
6+ wrappers = lib . filterAttrs ( name : value : value . enable ) config . security . wrappers ;
57
68 parentWrapperDir = dirOf wrapperDir ;
79
4143 // { description = "file mode string" ; } ;
4244
4345 wrapperType = lib . types . submodule ( { name , config , ... } : {
46+ options . enable = lib . mkOption
47+ { type = lib . types . bool ;
48+ default = true ;
49+ description = "Whether to enable the wrapper." ;
50+ } ;
4451 options . source = lib . mkOption
4552 { type = lib . types . path ;
4653 description = "The absolute path to the program to be wrapped." ;
Original file line number Diff line number Diff line change @@ -29,6 +29,14 @@ import ./make-test-python.nix (
2929 security . apparmor . enable = true ;
3030
3131 security . wrappers = {
32+ disabled = {
33+ enable = false ;
34+ owner = "root" ;
35+ group = "root" ;
36+ setuid = true ;
37+ source = "${ busybox pkgs } /bin/busybox" ;
38+ program = "disabled_busybox" ;
39+ } ;
3240 suidRoot = {
3341 owner = "root" ;
3442 group = "root" ;
@@ -112,6 +120,9 @@ import ./make-test-python.nix (
112120 # actually makes the apparmor policy for ping, but there's no convenient
113121 # test for that one.
114122 machine.succeed("ping -c 1 127.0.0.1")
123+
124+ # Test that the disabled wrapper is not present.
125+ machine.fail("test -e /run/wrappers/bin/disabled_busybox")
115126 '' ;
116127 }
117128)
You can’t perform that action at this time.
0 commit comments