-
Notifications
You must be signed in to change notification settings - Fork 15
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
Invoking scuba with pwd at or above /home/$USER (on the host) will chmod it to 0700 #219
Comments
There is some history to this code: |
My first thought was to simply remove the
When trying to identify a solution, I realized this problem also exists if
Going another step, if a user invoked So I guess, before
How do we determine if the path comes from the host? It's not as simple as asking "is this a bind mount", as noted above. I think we need to ask "is this directory, or any directory above it a bind mount?" |
Another weird corner case:
When scubainit creates Maybe we should just disallow running scuba in |
This works if scubaroot = /home/$USER: is_bind_mount() detects the bind mount because we're trying to mount the /jreinhart subdirectory of the /home/ mount: scubainit: ERROR - Error creating home dir: "/home/jreinhart" is on a bind-mount: /dev/mapper/magnum--vg-home[/jreinhart] But it fails for scubaroot = /home: is_bind_mount() sees root="/" and returns false. I think there is simply no way to reliably detect a bind mount! So now we might be to the point of either passing the list of bind-mount volumes from scuba to scubainit, or by checking for this situation in scuba instead.
scubainit
has code to create the user's home dir (in the container), originally thescubauser
:https://github.com/JonathonReinhart/scuba/blob/v2.11.0/scubainit/scubainit.c#L390-L409
It will unconditionally
chmod(path, 0700)
andchown(path, uid, gid)
.Usually, this is not a problem because either:
scuba
is invoked from outside/home/$USER
(on the host)scuba
is invoked from a subdirectory of/home/$USER
(on the host)But there is an unlikely corner-case:
scuba
is invoked directory in the/home/$USER
/home/$USER
is the pwd, so it is bind mounted exactly in the container (at the same path).chmod(path, 0700)
runs, it actually affects the directory on the host./home
...Note: We say
/home/$USER
rather than "the home directory" because$HOME
could point somewhere else entirely, and this problem only applies to/home/$USER
because that's whatscubainit
is currently hard-coded to use. (#216 is not yet implemented.)The text was updated successfully, but these errors were encountered: