]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: drop ambient capabilities in user manager
authorŁukasz Stelmach <l.stelmach@samsung.com>
Tue, 12 Jul 2022 11:57:32 +0000 (13:57 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 15 Jul 2022 13:35:22 +0000 (15:35 +0200)
Ambient capabilities should not be passed implicitly to user
services. Dropping them does not affect the permitted and effective sets
which are important for the manager itself to operate.

src/core/main.c

index 72d86d3efd06cbbe507fc7bbac06562030dc4a7a..55f5481eb2321b109d44fea2b5688cb08608b0b5 100644 (file)
@@ -2825,6 +2825,11 @@ int main(int argc, char *argv[]) {
                 /* clear the kernel timestamp, because we are not PID 1 */
                 kernel_timestamp = DUAL_TIMESTAMP_NULL;
 
+                /* Clear ambient capabilities, so services do not inherit them implicitly. Dropping them does
+                 * not affect the permitted and effective sets which are important for the manager itself to
+                 * operate. */
+                capability_ambient_set_apply(0, /* also_inherit= */ false);
+
                 if (mac_selinux_init() < 0) {
                         error_message = "Failed to initialize SELinux support";
                         goto finish;