core: drop CAP_MKNOD when PrivateDevices= is set

This commit is contained in:
Lennart Poettering
2014-03-18 17:58:19 +01:00
parent 45aee6d67a
commit f1660f96f5
2 changed files with 8 additions and 2 deletions
+5 -2
View File
@@ -908,8 +908,11 @@
<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>
+3
View 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;
if (c->private_devices)
c->capability_bounding_set_drop |= (uint64_t) 1ULL << (uint64_t) CAP_MKNOD;
return 0;
}