]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
nspawn: set read-only access mode on two /run/host/ files 30791/head
authorLennart Poettering <lennart@poettering.net>
Fri, 5 Jan 2024 15:42:46 +0000 (16:42 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 5 Jan 2024 16:31:08 +0000 (17:31 +0100)
The diectory is mounted read-only anyway, hence this doesn't do much,
but let's lock this down on every level we can.

src/nspawn/nspawn.c

index 9e53c51f1ac2e295b3ee17ef14fdc08e7c54b974..3ace3520b9c126fab90ba6de9e177cb985701989 100644 (file)
@@ -3946,11 +3946,11 @@ static int outer_child(
 
         /* The same stuff as the $container env var, but nicely readable for the entire payload */
         p = prefix_roota(directory, "/run/host/container-manager");
-        (void) write_string_file(p, arg_container_service_name, WRITE_STRING_FILE_CREATE);
+        (void) write_string_file(p, arg_container_service_name, WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_MODE_0444);
 
         /* The same stuff as the $container_uuid env var */
         p = prefix_roota(directory, "/run/host/container-uuid");
-        (void) write_string_filef(p, WRITE_STRING_FILE_CREATE, SD_ID128_UUID_FORMAT_STR, SD_ID128_FORMAT_VAL(arg_uuid));
+        (void) write_string_filef(p, WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_MODE_0444, SD_ID128_UUID_FORMAT_STR, SD_ID128_FORMAT_VAL(arg_uuid));
 
         if (!arg_use_cgns) {
                 r = mount_cgroups(