chiark / gitweb /
core: drop CAP_MKNOD when PrivateDevices= is set
authorLennart Poettering <lennart@poettering.net>
Tue, 18 Mar 2014 16:58:19 +0000 (17:58 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 18 Mar 2014 16:58:19 +0000 (17:58 +0100)
man/systemd.exec.xml
src/core/unit.c

index f1bcf9b7bd645f2931fe96699db04ce833c4d947..90d36f9b576e3dcf5b4020b412f8951936569c75 100644 (file)
                                 <filename>/dev/sda</filename>. This is
                                 useful to securely turn off physical
                                 device access by the executed
                                 <filename>/dev/sda</filename>. This is
                                 useful to securely turn off physical
                                 device access by the executed
-                                process. Defaults to
-                                false.</para></listitem>
+                                process. Defaults to false. Note that
+                                enabling this option implies that
+                                <constant>CAP_MKNOD</constant> is
+                                removed from the capability bounding
+                                set for the unit.</para></listitem>
                         </varlistentry>
 
                         <varlistentry>
                         </varlistentry>
 
                         <varlistentry>
index 4fb0d9caaa845fb32e36157f4f94735e61ba89fb..20b139d31be6446aeb2090332a952337d6843988 100644 (file)
@@ -2830,6 +2830,9 @@ int unit_exec_context_patch_defaults(Unit *u, ExecContext *c) {
              !set_isempty(c->address_families)))
                 c->no_new_privileges = true;
 
              !set_isempty(c->address_families)))
                 c->no_new_privileges = true;
 
+        if (c->private_devices)
+                c->capability_bounding_set_drop |= (uint64_t) 1ULL << (uint64_t) CAP_MKNOD;
+
         return 0;
 }
 
         return 0;
 }