discover-image: imply that hidden images are read-only

Marking a whole directory tree OS image as read-only is difficult
privilege-wise, because so far we rely on the FS_IMMUTABLE_FL which is
not accessible to unpriv clients.

One fundamental place where we currently rely on marking images
read-only is for keeping pristine copies of the originally downloaded
image around, which we place in "hidden" image directories. This is
probably the most relevant usecase for the read-only flag. And moreover,
the only usecase for the hidden images are these read-only pristine
copies.

Hence, let's make this work reasonably in the unpriv case, and simply
imply the read-only flag for hidden images. This is strictly speaking a
change in behaviour, but effectively it shouldn't be, because for nspawn
containers that are executed we insist on names that are hostname
compatible, and hidden names aren't (because they start with a dot).
This commit is contained in:
Lennart Poettering
2025-10-24 17:51:00 +02:00
parent 502f7a2b80
commit ee327e086e
10 changed files with 55 additions and 15 deletions
+1 -1
View File
@@ -3077,7 +3077,7 @@ static int determine_names(void) {
return log_oom();
if (!arg_ephemeral)
arg_read_only = arg_read_only || i->read_only;
arg_read_only = arg_read_only || image_is_read_only(i);
} else {
r = safe_getcwd(&arg_directory);
if (r < 0)