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

In Podman or Docker: Permission denied on SELinux machines #14787

Closed
rrichardson opened this issue Jan 21, 2021 · 8 comments
Closed

In Podman or Docker: Permission denied on SELinux machines #14787

rrichardson opened this issue Jan 21, 2021 · 8 comments

Comments

@rrichardson
Copy link

rrichardson commented Jan 21, 2021

Permissions issues when running in Podman or Containerd (DockerCE)

Description: When starting envoy in podman or docker (as a UID other than 0)

chown: changing ownership of '/dev/stdout': Permission denied
chown: changing ownership of '/dev/stderr': Permission denied

Presumably it's complaining about this line : https://github.com/envoyproxy/envoy/blob/main/ci/docker-entrypoint.sh#L26

Even if you run as root, SELinux takes exception to a container changing ownership of stdout and stderr.

I haven't found a more elegant workaround than adding this flag in podman:

--security-opt label=disable 

That's a bit of a blunt hammer. There is probably a more precise approach.

I think on non-root podman with cgroupsv2, the chown /dev/std* approach is probably not needed at all, because podman will give the container its very own FDs that pretend to be in, out and err. Maybe in this script we should check the ownership before attempting to change them?

Repro steps:

  1. On a recent Linux machine with SELinux enabled (I was working on FCOS 33)
    run:
podman run \
  --name=envoy \
  --hostname=envoy \
  -e ENVOY_UID=1000 \
  -e ENVOY_GID=1000 \
  --user root \
  --security-opt label=disable \
  -p [2600:aba:9d6:baba:f0c0:52ee::]:6443:6443 \
  -v /var/lib/envoy/config/:/config \
  -v /var/lib/envoy/cluster:/cluster \
  docker.io/envoyproxy/envoy:v1.17-latest
@rrichardson rrichardson added bug triage Issue requires triage labels Jan 21, 2021
@phlax
Copy link
Member

phlax commented Jan 22, 2021

Maybe in this script we should check the ownership before attempting to change them?

this seems reasonable, do you want to PR this ?

@phlax
Copy link
Member

phlax commented Jan 22, 2021

the other possible improvment here is to check that the user is root and/or is able to chown

@mattklein123 mattklein123 added area/build and removed bug triage Issue requires triage labels Jan 31, 2021
@github-actions
Copy link

github-actions bot commented Mar 3, 2021

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale stalebot believes this issue/PR has not been touched recently label Mar 3, 2021
@phlax
Copy link
Member

phlax commented Mar 3, 2021

@rrichardson this should be resolved in #15115 can you confirm

@github-actions github-actions bot removed the stale stalebot believes this issue/PR has not been touched recently label Mar 3, 2021
@rrichardson
Copy link
Author

rrichardson commented Mar 3, 2021 via email

@rrichardson
Copy link
Author

@phlax - Using the latest envoyproxy/envoy-dev image, I have verified that the non-root podman execution works correctly.
My invocation looked like:

podman run -it --name envoy --rm -v /var/envoy:/config envoyproxy/envoy-dev:latest -c /config/config.yaml

Running as a non-privileged user (that owns the /var/envoy directory, it was able to run, write to stdout/stderr and load the config.

@phlax
Copy link
Member

phlax commented Mar 6, 2021

brilliant - shall we close this ticket ?

@AkhilRaja
Copy link

@rrichardson @phlax I still get this issue when I deploy this to cloud run on Google cloud. Any workarounds for me ? Stuck on this for a long time now :( Thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants