units: make use of !! ExecStart= prefix in systemd-networkd.service
Let's make use of !! to run networkd with ambient capabilities on systems supporting them.
This commit is contained in:
+11
-7
@@ -70,13 +70,17 @@ int main(int argc, char *argv[]) {
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Could not create runtime directory 'lldp': %m");
|
||||
|
||||
r = drop_privileges(uid, gid,
|
||||
(1ULL << CAP_NET_ADMIN) |
|
||||
(1ULL << CAP_NET_BIND_SERVICE) |
|
||||
(1ULL << CAP_NET_BROADCAST) |
|
||||
(1ULL << CAP_NET_RAW));
|
||||
if (r < 0)
|
||||
goto out;
|
||||
/* Drop privileges, but only if we have been started as root. If we are not running as root we assume all
|
||||
* privileges are already dropped. */
|
||||
if (geteuid() == 0) {
|
||||
r = drop_privileges(uid, gid,
|
||||
(1ULL << CAP_NET_ADMIN) |
|
||||
(1ULL << CAP_NET_BIND_SERVICE) |
|
||||
(1ULL << CAP_NET_BROADCAST) |
|
||||
(1ULL << CAP_NET_RAW));
|
||||
if (r < 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGTERM, SIGINT, -1) >= 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user