-
-
Notifications
You must be signed in to change notification settings - Fork 121
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
WIP: Enable non-root users to use the geodesic shell #710
Conversation
Hi @sboardwell. Thank you for contributing. This is an issue that plagues me so much that I do not create files from the container on to my After reviewing the PR code, merging the changes in the testing in shell ✗ . [none] / ⨠ whoami
geodesic
✗ . [none] / ⨠ id
uid=1000(geodesic) gid=1000(geodesic) groups=1000(geodesic),27(sudo),999(docker)
✗ . [none] / ⨠ ls -la | grep localhost
drwxr-xr-x 111 geodesic geodesic 4096 Jun 18 16:06 localhost
✗ . [none] / ⨠ touch /localhost/files
✗ . [none] / ⨠ rm /localhost/files
✗ . [none] / ⨠ sudo apt update
Hit:1 http://security.debian.org/debian-security buster/updates InRelease
Hit:2 https://packages.cloud.google.com/apt cloud-sdk InRelease
Get:3 https://dl.cloudsmith.io/public/cloudposse/packages/deb/debian buster InRelease [4938 B]
Hit:4 http://deb.debian.org/debian buster InRelease
Hit:5 http://deb.debian.org/debian buster-updates InRelease
Fetched 4938 B in 1s (5689 B/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
14 packages can be upgraded. Run 'apt list --upgradable' to see them.
✗ . [none] / ⨠ sudo apt install aws-vault
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
aws-vault
0 upgraded, 1 newly installed, 0 to remove and 14 not upgraded.
Need to get 7023 kB of archives.
After this operation, 15.3 MB of additional disk space will be used.
Get:1 https://dl.cloudsmith.io/public/cloudposse/packages/deb/debian buster/main amd64 aws-vault amd64 6.3.1-1 [7023 kB]
Fetched 7023 kB in 3s (2704 kB/s)
Selecting previously unselected package aws-vault.
(Reading database ... 54459 files and directories currently installed.)
Preparing to unpack .../aws-vault_6.3.1-1_amd64.deb ...
Unpacking aws-vault (6.3.1-1) ...
Setting up aws-vault (6.3.1-1) ...
✗ . [none] / ⨠ which aws-vault
/usr/bin/aws-vault I tried running Anyone using this method would have to prefix their run commands with @Nuru how do you feel about these changes ? Could you give it a second review ? I'm also partial to adding a |
Hi @nitrocode thanks for the feedback and testing. I would, personally, be okay with prefixing my own commands with Not having root detection tends to lead to people running entire scripts as sudo which can lead to similar problems (node caches owned by root, etc). Easy either way I guess, although I prefer the transparency and conscious decision making when using |
I see your point now with the I thought you were talking all the |
Yes, it's probably better to be explicit. Here's another issue I came across. We use # as root in Dockerfile
$ update-alternatives --set terraform /usr/share/terraform/{version}/bin/terraform
# as geodesic in container
$ ls -la /usr/share/terraform/1/bin/
ls: cannot open directory '/usr/share/terraform/1/bin/': Permission denied Installs it as root without any read permissions. We'll have to find a way around that. Perhaps by setting an alternative non-root user directory. |
Check my other PR in the packages repo wrt the read-only root permissions . I thought it was only in the download area. |
@sboardwell @nitrocode I think we should not risk all the issues that come from running as non-root inside Geodesic. In particular, once of the great advantages of Geodesic is that it works the same for everyone, so we do not get these "works in my environment" problems, and having some people running as root and some running as non-root seems like it will kill that off. I took a fresh look at this today and think we can solve the underlying issue of file ownership using BindFS without otherwise altering Geodesic. That seems a better path to me. Are you willing to give that a try? |
@Nuru - please try. If it works, all the better. |
Co-authored-by: Nuru <[email protected]>
Closing this in favor of #771 |
Work In Progress
This is part of a larger push to help create a
geodesic
non-root user with which to run the geodesic./conf
directory would need to be looked atsudo
package.what
_root_detection
function to enable a conditionalsudo
prefix for non-root users/etc/profile.dprompt:kube-ps1.sh
is readable by non-root usersPOC - Testing purposes only
Place the following
Dockerfile.non-root-example
in the PR's root directory.The Dockerfile adds the geodesic user. See
NOTE:
sections for explanations and context.Dockerfile.non-root-example
Minimal steps to test: