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

SELinux policy prevents pods from watching the journal #1151

Closed
bcressey opened this issue Oct 7, 2020 · 3 comments · Fixed by #1236
Closed

SELinux policy prevents pods from watching the journal #1151

bcressey opened this issue Oct 7, 2020 · 3 comments · Fixed by #1236
Assignees
Labels
type/bug Something isn't working

Comments

@bcressey
Copy link
Contributor

bcressey commented Oct 7, 2020

Image I'm using:
aws-k8s-1.17 v1.0.1

What I expected to happen:
To be able to collect journal logs from a pod.

What actually happened:

[1528285.589266] audit: type=1400 audit(1601383563.515:8): avc: denied { watch } for pid=668607 comm="event_loop" path="/var/log/journal/ec23ab7a8286d713d41887457658cfc6" dev="nvme1n1p1" ino=261640 scontext=system_u:system_r:container_t:s0 tcontext=system_u:object_r:state_t:s0 tclass=dir permissive=0

$ cat /proc/668607/cmdline
/usr/local/bin/ruby-Eascii-8bit:ascii-8bit/fluentd/vendor/bundle/ruby/2.6.0/bin/fluentd-c/fluentd/etc/fluent.conf-p/fluentd/plugins--gemfile/fluentd/Gemfile--under-supervisor

How to reproduce the problem:
Deploy the agent for Cloudwatch Container Insights:
/~https://github.com/aws-samples/amazon-cloudwatch-container-insights

@samuelkarp samuelkarp added the type/bug Something isn't working label Nov 13, 2020
@Niksko
Copy link

Niksko commented Nov 24, 2020

Using control_t lets the container watch, but presumably that's not ideal? Is there another type that's better suited or that we could create?

@bcressey
Copy link
Contributor Author

bcressey commented Dec 1, 2020

Using control_t lets the container watch, but presumably that's not ideal? Is there another type that's better suited or that we could create?

control_t is reasonable, though it's not least privilege since it also allows use of the host's API socket.

The primary reason watches are restricted is to prevent fanotify from being used to block the host's access to its own files by denying the permission check. It should be OK to relax the policy so it only blocks these watch_with_perm actions.

The other benefit of restricting watches is to prevent pods from depending on the existence of specific directories or files in the host OS, which could change in an incompatible way across an upgrade. But this isn't as important and doesn't actually make sense in cases like this where we want pods to be able to collect host logs.

@bcressey bcressey self-assigned this Dec 1, 2020
@samuelkarp samuelkarp added the status/needs-triage Pending triage or re-evaluation label Dec 11, 2020
@gregdek gregdek added priority/p0 and removed priority/p1 status/needs-triage Pending triage or re-evaluation labels Dec 11, 2020
@skoperst

This comment was marked as abuse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants