-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Launch scripts don't work as non-root #13951
Comments
It's working for most use cases, so there must be some edge case here we haven't accounted for. We grant write access to awx/tools/ansible/roles/dockerfile/templates/Dockerfile.j2 Lines 257 to 259 in b28e14c
You can find a more complete version of this hack, with a detailed explanation, in the default entrypoint used by images produced with ansible-builder: What distribution of Kubernetes are you using? And what's the underlying container runtime? |
If I'm reading that Dockerfile correctly we're setting read and write permissions on /etc/passwd for the root group. But that doesn't help us if we're just a normal user. In our case UID = GID = 1000, means we still don't have permission.
We're using AKS which uses containerd as it's runtime. |
Got it, that makes sense. Typically non-root users are still in the root group.
This is also true in Kubernetes by default. From reading the code, the entrypoint from ansible-builder looks a bit more robust and not as failure prone. We may be able to use parts of that here, but I'm not sure. Are you able to build custom AWX images and try it out? |
I might have to set a few things up, but yeah I can do that. |
@ToxicGLaDOS were you able to solve your issue using above solution? I am in the same boat and want to check if above worked for you? TIA. |
After some digging I think I've found that my initial analysis doesn't tell the whole story. While the error
fails because And launch_awx_task.sh fails to open a socket on line 22
|
@ToxicGLaDOS so where did you exactly change the permissions for Something like below:
|
@vshete93 I didn't actually find a fix in our own Dockerfile like that yet. I've been trying to put together a fix in awx itself. I think the issue is that we interact with a lot of directories that are owned by root and aren't world readable/writeable ( |
Fixes ansible#13951 Users without root access didn't have permission to `/var/run` and `/var/lib/awx`
Fixes ansible#13951 Users without root access don't have permission to `/var/lib/awx/rsyslog`, `/var/run/supervisor`, and `/var/run/awx-rsyslog`
Fixes ansible#13951 Users without root access don't have permission to `/var/lib/awx/rsyslog`, `/var/run/supervisor`, and `/var/run/awx-rsyslog`
Please confirm the following
Bug Summary
In each of the launch scripts (launch_awx_rsyslog.sh, launch_awx_task.sh, launch_awx_web.sh), there's this block:
But the logic doesn't make sense to me. If our UID is greater than 500 then we don't have root privileges so we can't edit
/etc/passwd
. For us this presents as/usr/bin/launch_awx_task.sh: line 4: /etc/passwd: Permission denied
in the container logs when running as UID = 1000. @rooftopcellist Could you explain what this block is there to accomplish? It looks like it was added by you in #9289.AWX version
22.0.0
Select the relevant components
Installation method
kubernetes
Modifications
no
Ansible version
No response
Operating system
No response
Web browser
No response
Steps to reproduce
Deploy AWX with a security context that defines
runAsUser
andrunAsGroup
. Here's a script that deploys awx fresh and shows the issue.After the awx-task pod comes up you can see the error in the awx-task, awx-rsyslog and awx-ee containers
Expected results
AWX runs properly as a non-root user
Actual results
3 (awx-ee, awx-task, awx-rsyslog) of the 4 containers in the pod fail to start with similar errors
/usr/bin/launch_awx_task.sh: line 4: /etc/passwd: Permission denied
. The redis container starts up normally.Additional information
No response
The text was updated successfully, but these errors were encountered: