-
Notifications
You must be signed in to change notification settings - Fork 600
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: should we make HOME writable in v1.0? #1872
Comments
My thoughts that it was a security concern, that Docker Machine would export all of the home directory to the VM*. Both the privacy part, and the risk of doing damage to the host when doing something wrong in the VM or privileged containers... * Actually it only worked in VirtualBox and not in qemu/kvm, but that is another story (missing the 9p support). So I made it not mount the home directory by default in Podman Machine, even though it was available as an option if the user accepted the risks involved. The users complained, since it was "not Docker", and the decision was reverted* by Red Hat for v4.1.0. * It is now For Lima, the privacy concerns are still there. But the read-only mount made it harder to do damage to the host... There are also some performance implications, with encouraging users to work on a remote file system by default. So I also think "no" (i.e. as-is/opt-in) But also know it will confuse some. |
I never considered Lima instances to be a "secure sandbox" to run untrusted code, so I never though of mounting directories read-only as a security concern. I assumed we did this to minimize the risk that we would accidentally overwrite some host data. With Lima (just like Microsoft with WSL) we are trying to make the boundary between the host and the VM disappear as much as possible. When you run containers, we try to make it look like they run on the host and not in the VM. Not being able to write to the mounted directories feels like it contradicts this goal; it re-introduces friction when the purpose of the tool is to remove friction. Personally I've always been using an I know that many users expect this as well, which is why Rancher Desktop mounts all directories as writable as well. But I guess it is slightly different when the VM is purely a container host: the mounted directories are not automatically exposed to containers; the user still has to mount them once more, and that is the boundary to decide if the mount should be writable or not. If you mount directories read-only into the VM, then you don't have the option of making them writable inside specific containers. I prefer the directories mountable, but I have no strong opinion because you can override the default. So I'm also ok with leaving it read-only, if that's what you prefer. |
I think this is the main difference, if the (and only "the") VM is an extension of the host - or if it is just a (of many) VM... And it is true that when you run the container engine directly on your Linux host, it can also see your home directory. |
@AkihiroSuda : if we do change the default for 1.0, that still means that it is possible to do the opposite of the above. To create a user preference file, if you want to keep the current behaviour of mounting the home directory as read-only... Maybe expose some similar boolean, so you don't have to fiddle with the mounts ?
mounts:
- location: "~"
mountPoint: null
writable: null <--- use new default
sshfs:
cache: null
followSymlinks: null
sftpDriver: null
9p:
securityModel: null
protocolVersion: null
msize: null
cache: null
- location: "/tmp/lima"
writable: true
mountType: null
mountWritable: true <--- new config Then you could put the Possible a good idea either way, no matter if the Lima built-in defaults to |
Changed my mind: After consideration, it should probably be read-write by default - with an option to go back to read-only (or unmounted). If There were some similarly surprised Apptainer users, and having to tell them to use $ apptainer.lima build alpine.sif docker://alpine
INFO: Starting build...
Getting image source signatures
Copying blob 96526aa774ef done
Copying config e175fa54c5 done
Writing manifest to image destination
Storing signatures
2023/10/02 16:41:33 info unpack layer: sha256:96526aa774ef0126ad0fe9e9a95764c5fc37f409ab9e97021e7b4775d82bf6fa
INFO: Creating SIF file...
FATAL: While performing build: while creating SIF: while creating container: open /home/anders/lima/alpine.sif: read-only file system From https://apptainer.org/docs/user/main/quick_start.html Just that it will be unevitable, to tell them to do And similarly to use
|
Exposing your home directory to vms is unexpected and insecure. Uses assumes that vms are isolated from the host and are safe place to run anything. The best way would be to have a config file with these defaults so user can adapt the default to their need. With such config you can create a lima distribution with different defaults that match the use case. Foe example as a tool to run containers you may want to make the lima vm transparent and integrated into the host. As a tool for managing vms (like virsh for linux), lima vms can be completely isolated by default. |
Different users have different expectations. Users of Docker or WSL don't even know they are using a VM, and expect all of $HOME or I call it the "Wizard of Oz" mode. I agree it would make sense to have it configurable, but then we need to remove it from the copy/paste "mounts" configuration in the templates? images:
- default
mounts:
- default |
Even the user name (and uid) has been questioned by users that are expecting a VM, i.e. they don't want it synched Especially former users of Vagrant are expecting the default user from the cloud-init, and only $PWD mounted (at most) |
I think this could be another use-case of the We could have a param:
HOME_RW: false
TMP_LIMA_RW: true
mounts:
- location: ~
writable: {{.Param.HOME_RW}}
- location: /tmp/lima
writable: {{.Param.TMP_LIMA_RW}} and then instead of cuting-and-pasting the default settings each template would include basedOn: template://default-mounts Then users can set limactl create --name my-vm --param HOME_RW=true template://ubuntu I think I will work on a PoC for a (nestable) |
Isn't |
Probably. It was just an example how you can use the I'm in favour of adding a I continue to slightly favour this setting to be |
Closing as unplanned for now, but we may revisit this again in v2.0+ |
Could you create a separate issue? |
v1.0 will change the default mount driver from reverse-sshfs to virtiofs (for vz) and 9p (for qemu),
so mounting will be more stable:
v1.0 is also a good milestone to have breaking changes, although we should try to avoid having breaking changes.
In v1.0, should we make the host home mount (
/Users/foo
) writable or not?My current position is no, as I still want to minimize having breaking changes, and the mount can be easily configured to be writable with
limactl start --mount-writable
.But I'm happy to hear opinions.
The text was updated successfully, but these errors were encountered: