diff options
author | Ismo Puustinen <ismo.puustinen@intel.com> | 2015-12-31 13:54:44 +0100 |
---|---|---|
committer | Ismo Puustinen <ismo.puustinen@intel.com> | 2016-01-12 11:14:50 +0100 |
commit | 755d4b67a471ed1a3472b8536cb51315d4e4e3c1 (patch) | |
tree | 8a0d604514b069463816768a326fb4a6f4f947d7 /src/basic/capability-util.h | |
parent | capabilities: keep bounding set in non-inverted format. (diff) | |
download | systemd-755d4b67a471ed1a3472b8536cb51315d4e4e3c1.tar.xz systemd-755d4b67a471ed1a3472b8536cb51315d4e4e3c1.zip |
capabilities: added support for ambient capabilities.
This patch adds support for ambient capabilities in service files. The
idea with ambient capabilities is that the execed processes can run with
non-root user and get some inherited capabilities, without having any
need to add the capabilities to the executable file.
You need at least Linux 4.3 to use ambient capabilities. SecureBit
keep-caps is automatically added when you use ambient capabilities and
wish to change the user.
An example system service file might look like this:
[Unit]
Description=Service for testing caps
[Service]
ExecStart=/usr/bin/sleep 10000
User=nobody
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_RAW
After starting the service it has these capabilities:
CapInh: 0000000000003000
CapPrm: 0000000000003000
CapEff: 0000000000003000
CapBnd: 0000003fffffffff
CapAmb: 0000000000003000
Diffstat (limited to 'src/basic/capability-util.h')
-rw-r--r-- | src/basic/capability-util.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/basic/capability-util.h b/src/basic/capability-util.h index f6a48b7916..be41475441 100644 --- a/src/basic/capability-util.h +++ b/src/basic/capability-util.h @@ -36,6 +36,9 @@ int have_effective_cap(int value); int capability_bounding_set_drop(uint64_t keep, bool right_now); int capability_bounding_set_drop_usermode(uint64_t keep); +int capability_ambient_set_apply(uint64_t set, bool also_inherit); +int capability_update_inherited_set(cap_t caps, uint64_t ambient_set); + int drop_privileges(uid_t uid, gid_t gid, uint64_t keep_capabilities); int drop_capability(cap_value_t cv); |