Skip to content
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

Allow atlantis docker image to run as arbitrary user #345

Closed
jocelynthode opened this issue Nov 8, 2018 · 5 comments
Closed

Allow atlantis docker image to run as arbitrary user #345

jocelynthode opened this issue Nov 8, 2018 · 5 comments
Labels
feature New functionality/enhancement

Comments

@jocelynthode
Copy link
Contributor

Hey,

I was wondering if making atlantis run as an arbitrary user is something the project is interested in. For example on Openshift for security reasons, by default the image will be started with a randomly assigned uid which is never root.

I would be glad to try and create a pull request so that we could use the image with any UID. For example making the atlantis group and its folder having the gid 0 and then making the group have the same permissions as the user. We could then in the docker-entrypoint.sh only run the gosu command if the current uid is 0 otherwise we leave it as it is.

@lkysow
Copy link
Member

lkysow commented Nov 8, 2018

Hi Jocelyn,

Would this be a breaking change for anyone using the current Docker image that have this set in their kube config: https://github.com/runatlantis/atlantis/blob/master/helm/atlantis/templates/statefulset.yaml#L23

@jocelynthode
Copy link
Contributor Author

Hi @lkysow : I think this would depend on the k8s cluster. If the cluster does not enforce a special uid at runtime then the user permissions should still be sufficient.

However if they enforce it like Openshift does by default. They would indeed run into a problem.

My idea with the the change I propose in #346 is that since k8s and Openshift by default run the container with a gid=0 and mounts volume with a gid=0 to use this one for the newly created "atlantis" user. As running with the gid 0 is not a security vulnerability as it does not have special privileges like uid=0 has.

My change would probably even let us remove the "fsGroup: 1000" from the stateful set template.

@jocelynthode
Copy link
Contributor Author

@lkysow Hey I asked already in #346 but I do not know if you get notified in the PR. Is there something else blocking this PR from being merged ?

@lkysow
Copy link
Member

lkysow commented Nov 20, 2018

I need to test if this will break existing k8s deployments.

lkysow added a commit that referenced this issue Nov 22, 2018
In OpenShift containers are run as a random user id. In this case, we
don't need to use gosu.

Fixes #345
@lkysow
Copy link
Member

lkysow commented Nov 29, 2018

Closed by #346

@lkysow lkysow closed this as completed Nov 29, 2018
@lkysow lkysow added the feature New functionality/enhancement label Apr 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New functionality/enhancement
Projects
None yet
Development

No branches or pull requests

2 participants