Adding USER id to avoid run as root in OpenShift#45376
Adding USER id to avoid run as root in OpenShift#45376josgonza-rh wants to merge 1 commit intoelastic:masterfrom
root in OpenShift#45376Conversation
This change is needed because: "If the image does not specify a USER, it inherits the USER from the parent image" [1] [1](https://docs.openshift.com/container-platform/3.11/creating_images/guidelines.html)
|
Pinging @elastic/es-core-infra |
|
Thanks for the PR @josgonza-rh . The reason why we haven't been setting it (some historical info here, originating from this issue) is that AFAIU as per the guidelines you linked:
i.e. Could you share more light into how the arbitrary UID gets applied and the need to specify USER? Judging by the |
|
Hi @dliappis, It is the same for OKD and OpenShift .. and it is all explained in the OpenShift Guidelines mentioned before. The key is (in the same point you extract the info Support Arbitrary User IDs):
That means that if your image inherints from other, in this case from In our case it won't work even if you change the SCC just because you're forcing your The only important thing is to set the At the end of the point Support Arbitrary User IDs:
|
|
Many thanks for the explanation @josgonza-rh . Your reasoning makes sense. Regarding:
I guess you are referring to this property specified in the Elastic Cloud on Kubernetes project? At any rate one issue with this PR is that we'll need to change things in the current Entrypoint script. As you can see here, here and here there are certain actions taken if user is root. Some of them could be simplified by assuming Would it be ok to ask you to actually close this PR and open an issue instead (you can ping me there) copying over the argumentation you just presented, so that we can discuss any potential for breaking changes and come up with a PR that addresses the OpenShift/OKD fix plus any necessary changes in the Entrypoint and docs? Thanks again for raising this. |
|
Hi @dliappis, About
Right: About
You can resolve of this problems following the OpenShift Guidelines, concretely the solution described in the point mentioned above: Support Arbitrary User IDs
If you still don't feel confidence with the steps described in the OpenShift Guidelines you can close this PR or open the issue by yourself without problem. |
|
@josgonza-rh Thanks the followup.
It's not a matter of lack of confidence; in fact we have used quite a bunch of the steps you mentioned in the Dockerfile and a few places in the entrypoint. We'll need to modify the entrypoint to work properly with the If you don't have the time to address those in this PR (all of this can be quite laborious) I think it's best that I open an issue summarizing all the discussion here and work on a PR -- that will of course acknowledge your contribution -- that will have everything needed. Is Minishift a good environment to use for testing image changes for compatibility with OpenShift? |
|
@dliappis OK, I'm agree with you (this PR is not valid as it needs more changes and open an issue fits perfect for this case). It's true that I don't have so much time to address the complete issue but of course I can help you to face it. Of course Minishift is a good environment to test all that kind of stuffs (and learn how OpenShift works). The Minishift's GitHub Site has a lot of info and links that will help you. |
|
@josgonza-rh Many thanks for your help. We truly appreciate it. I will ping you directly on the new issue and kindly ask for your help reviewing the PR if you have the time. |
|
@dliappis sure ;) |
This change is needed because: "If the image does not specify a USER, it inherits the USER from the parent image" [1]
[1] OpenShift Guidelines