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
security: Run the crash collector as ceph user #11219
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, this is something the Ceph image would fix as well in its DockerFile, but that approach LGTM. Also, all the container specs could potentially use this as a default and we could stop using "run-as" flags altogether. Something to keep in mind for a future refactor maybe.
Last question, is this fixing a bug, or is it "just" to run non-root? Final point, I think the log rotate sidecar as the same problem.
pkg/operator/ceph/controller/spec.go
Outdated
| func CephSecurityContext() *v1.SecurityContext { | ||
| // The ceph user has user id 167 | ||
| context := PodSecurityContext() | ||
| context.RunAsUser = pointer.Int64(167) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: IIRC there is a constant somewhere like CephUserID.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After a quick search I didn't find one, but I'll look again, thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't find it, so defined one
Yes there is a security issue in their backlog for this, I sent an email yesterday to Travis to mitigate the CVE directly in Rook
yes a CVE was discovered recently in Ceph, I don't know if I can link it here ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, this is something the Ceph image would fix as well in its DockerFile, but that approach LGTM. Also, all the container specs could potentially use this as a default and we could stop using "run-as" flags altogether. Something to keep in mind for a future refactor maybe.
I was thinking about removing the run-as flags and using the security context like this in a separate PR. It does seem like a better approach if we can just use the K8s context and no need for the ceph flags.
Last question, is this fixing a bug, or is it "just" to run non-root? Final point, I think the log rotate sidecar as the same problem.
Thanks, I'll look at the log rotate sidecar too.
pkg/operator/ceph/controller/spec.go
Outdated
| func CephSecurityContext() *v1.SecurityContext { | ||
| // The ceph user has user id 167 | ||
| context := PodSecurityContext() | ||
| context.RunAsUser = pointer.Int64(167) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After a quick search I didn't find one, but I'll look again, thanks
After thoughts, this won't be super trivial though, I had an attempt here #9175 but never had time to finish it.
|
The crash collector does not have the command line arguments to run as ceph user id 167, so we set the security context to run as the ceph user in the main crash collector container. Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
eac2932
to
df6d7af
Compare
The log rotate sidecar will take a bit more investigation, will work on it in a follow-up issue with #11235. |
Yes, I think my old PR should have what's necessary to fix it, feel free to ping me when you tackle it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last thing, did you verify that the crash files can be uploaded by the ceph-crash script when they appear? Normally the crash logs should be owned by ceph so this should not be a problem. Better safe than sorry though.
Verified both in minikube and openshift. If I look at the crash directory, the crash moved into the However, the logging in the crash collector pod makes it look like the operator failed. But I see this same log whether the crash collector is running as |
Yes, this is very confusing but harmless. Essentially, the ceph-crash tries a bunch of users, and some fail but eventually one succeeds. That's why you see the crash being present in Ceph. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 👏 👏 👏 👏 👏 👏 👏 👏 👏
security: Run the crash collector as ceph user (backport #11219)
security: Run the crash collector as ceph user (backport #11219)
Description of your changes:
The crash collector does not have the command line arguments to run as ceph user id 167, so we set the security context to run as the ceph user in the main crash collector container.
Checklist:
skip-cion the PR.