/dev should not be readonly with --readonly flag#35344
Conversation
|
ping @tonistiigi @justincormack @kolyshkin PTAL |
|
There are not plenty of places where there is a writeable tmpfs, currently there is only one that is not yet removeable ( |
|
/dev/shm? |
|
What is the goal of --readonly. I see it as preventing a process from making changes to the image. Not to where it can not write on any temporary file system. |
Man page and help indicate that the "root" file system is readonly not all file systems inside of the image. |
|
|
|
I guess I don't understand the goal of --read-only flag then. The way I would describe it, is the flag gives a security feature where a container can not modify the image used for it, and just restarting the container would remove any content created by processes running inside the container, except for content volume mounted into the container. If your definition is that --read-only means that the processes can not write to anywhere inside of the container except for volumes mounted into the container, then you are failing at that by overriding "/proc", "/dev/pts", "/dev/mqueue": IE Processes would be able to write to /dev/pts, and /dev/mqueue, as well as able to write to /proc. By either definition --read-only is broken. From a security point of view, the security goal is that by default a hacked container can not write a I actually believe all containers in production should run with --read-only rootfs, with /run /var/tmp, /tmp with tmpfs mounted and writing to /dev/*, Buf if users need to do lots of toggling of flags to make tmpfs work, then --read-only will hardly ever being used, which means we miss an opportunity to make containers more secure. |
|
ping @n4ss as well (for entitlements) |
|
You cant actually write stuff to However, having discovered that you can create a file using |
/dev is mounted on a tmpfs inside of a container. Processes inside of containers some times need to create devices nodes, or to setup a socket that listens on /dev/log Allowing these containers to run with the --readonly flag makes sense. Making a tmpfs readonly does not add any security to the container, since there is plenty of places where the container can write tmpfs content. I have no idea why /dev was excluded. Signed-off-by: Daniel J Walsh <[email protected]>
8037eeb to
5f3bd24
Compare
|
@thaJeztah Tests pass who else do I need to get approval from to get this merged? |
|
ping @justincormack @kolyshkin PTAL |
|
LGTM I admit I also do not entirely understand why
Can seccomp be used to disallow |
|
Also, |
|
Oops, looks like it's not Unless there's something we need to run from |
|
@justincormack would it makes sense to do the following as part a
I get the feeling that the only real read-only is going to come from IMA+EVM.. I agree with @kolyshkin, let's make sure |
|
well, I did think |
|
I think we can change `noexec`` in another pr, it is unrelated. |
|
I agree we can do the other changes in a follow-up @n4ss @kolyshkin could one of you make a pull request or open an issue to track that effort? |
…root Since moby/moby#35344 we clarified that this behaviour was a mistake, and the read only flag should just apply to the actual rootfs, so it corresponds to the OCI read-only option. Other mounts may be able to be adjusted by re-specifying them or other means but this is unrelated. Signed-off-by: Justin Cormack <[email protected]>
…root Since moby/moby#35344 we clarified that this behaviour was a mistake, and the read only flag should just apply to the actual rootfs, so it corresponds to the OCI read-only option. Other mounts may be able to be adjusted by re-specifying them or other means but this is unrelated. Signed-off-by: Justin Cormack <[email protected]>
It does not make any sense to vary this based on whether the rootfs is read only. We removed all the other mount dependencies on read-only eg see moby#35344. Signed-off-by: Justin Cormack <[email protected]>
/dev is mounted on a tmpfs inside of a container. Processes inside of containers
some times need to create devices nodes, or to setup a socket that listens on /dev/log
Allowing these containers to run with the --readonly flag makes sense. Making a tmpfs
readonly does not add any security to the container, since there is plenty of places
where the container can write tmpfs content.
I have no idea why /dev was excluded.
fixes #35041
Signed-off-by: Daniel J Walsh [email protected]
- What I did
- How I did it
- How to verify it
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)