-
Notifications
You must be signed in to change notification settings - Fork 723
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
Kibana: Set default hardened security context #8086
Kibana: Set default hardened security context #8086
Conversation
Signed-off-by: Michael Montgomery <[email protected]>
Signed-off-by: Michael Montgomery <[email protected]>
Signed-off-by: Michael Montgomery <[email protected]>
Signed-off-by: Michael Montgomery <[email protected]>
buildkite test this -f p=gke -m s=7.17.8,s=8.15.2,s=8.16.0-SNAPSHOT |
buildkite test this -f s=8.16.0-SNAPSHOT,E2E_TAGS=kb -m p=eks,p=aks,p=ocp (I stopped the build before the end). Result: issue on test {
"Time": "2024-10-09T09:20:54.911004408Z",
"Action": "output",
"Package": "github.com/elastic/cloud-on-k8s/v2/test/e2e/kb",
"Test": "TestKBStackMonitoring/Kibana_Pods_should_eventually_be_ready",
"Output": "=== RUN TestKBStackMonitoring/Kibana_Pods_should_eventually_be_ready"
} > k get po test-kb-mon-a-jcrc-kb-7f456d5f6-5fqpm
NAME READY STATUS RESTARTS AGE
test-kb-mon-a-jcrc-kb-7f456d5f6-5fqpm 1/3 CreateContainerConfigError 0 30m # > k get po test-kb-mon-a-jcrc-kb-7f456d5f6-5fqpm -o yaml | yq '.status.containerStatuses[] | select(.started == false)'
image: docker.elastic.co/beats/filebeat:8.16.0-SNAPSHOT
imageID: ""
lastState: {}
name: filebeat
ready: false
restartCount: 0
started: false
state:
waiting:
message: 'container has runAsNonRoot and image has non-numeric user (filebeat), cannot verify user is non-root (pod: "test-kb-mon-a-jcrc-kb-7f456d5f6-5fqpm_e2e-3ijnz-mercury(75bccf29-bf65-4b6c-8409-cbb333a25076)", container: filebeat)'
reason: CreateContainerConfigError
image: docker.elastic.co/beats/metricbeat:8.16.0-SNAPSHOT
imageID: ""
lastState: {}
name: metricbeat
ready: false
restartCount: 0
started: false
state:
waiting:
message: 'container has runAsNonRoot and image has non-numeric user (metricbeat), cannot verify user is non-root (pod: "test-kb-mon-a-jcrc-kb-7f456d5f6-5fqpm_e2e-3ijnz-mercury(75bccf29-bf65-4b6c-8409-cbb333a25076)", container: metricbeat)'
reason: CreateContainerConfigError I don't yet understand the link between the change in this PR and this error. |
Thanks @thbkrkr I will investigate tomorrow and get to the bottom of it. |
I've duplicated this issue:
Investigating... |
I suspect the recent wolfi changes broke this: elastic/beats@b06f7ce#diff-fee1e8c36ba46c30289f0ce62904e6cf695d7f1ac327d92588b0a73b188e2f0f This was predicted here Verifying, and I'll work with Beats team to get fixed. |
buildkite test this -f s=8.16.0-SNAPSHOT,E2E_TAGS=kb -m p=ocp |
buildkite test this -f s=8.16.0-SNAPSHOT,E2E_TAGS=kb -m p=ocp |
1 similar comment
buildkite test this -f s=8.16.0-SNAPSHOT,E2E_TAGS=kb -m p=ocp |
I think you need to version gate this to 7.x or greater. We still need to support 6.x and Kibana does not work with the restricitive security context in 6.x because it tries to write to the root file system.
|
Also in more recent versions. I am testing 7.13 here it seems while Kibana comes up with the security context. The reporting feature will be broken:
So this requires probably an emptyDir volume mounted in Oddly the status/api says reporting is health, not sure if this is trust worthy though
|
This is also still the case for 7.0. So I think you have to run an upgrade test all the way up to the 7.x version you tested in CI to figure out as of which version Kibana stops writing into random places in the container. |
From my testing @pebrc 7.5.0 is the first version I see that seems to work fully with the restricted sec context, and a |
I've tested every minor version from 7.0 -> 7.17.0 and these are my findings: From 7.6.0 -> 7.9.x we see:
I will reach out about what this means, and whether it's a good thing to enable in this version range. Seems to stop mentioning this in 7.10. At 7.15 I see this:
I'm unsure what effects this may have. Will reach out. I don't see this in 7.16.x/7.17.x, I see this:
|
Signed-off-by: Michael Montgomery <[email protected]>
Update logic issue with default builder. Signed-off-by: Michael Montgomery <[email protected]>
Signed-off-by: Michael Montgomery <[email protected]>
We're told that this has no runtime impact. The only impact it would have is if the same pod on the same pod was restarted, the startup times would be slightly slower. |
We're been instructed that these messages can be ignored. |
Signed-off-by: Michael Montgomery <[email protected]>
Signed-off-by: Michael Montgomery <[email protected]>
@pebrc there's a final piece to this from working with the Kibana team. We can't set the root read-only without additionally having a 'plugins' emptDir setup. From what I see we don't test any plugin installations in either Elasticsearch or Kibana, so our e2e tests didn't catch this. I'm going to see what it would take to test a simple plugin installation in our e2e tests. |
Signed-off-by: Michael Montgomery <[email protected]>
Co-authored-by: Peter Brachwitz <[email protected]>
This likely isn't going to happen in this PR, as there's really no plugin that we'd want to enable that is released for every version of kibana we want to support. In testing manually the plugin installation, I've run into a bit of an issue I'm working through and will update shortly. |
Signed-off-by: Michael Montgomery <[email protected]>
Signed-off-by: Michael Montgomery <[email protected]>
Signed-off-by: Michael Montgomery <[email protected]>
@pebrc Ok, tested the most recent changes manually, since e2e approach wasn't going to be supportable over many versions of kibana+plugin. Tested using Kibana version 8.11.4
Pods come online without issues. I also tested this on 7.10.2, and all went without issues. |
Adjust comments. Signed-off-by: Michael Montgomery <[email protected]>
Closes: #7787
What is this change?
This sets the security context for Kibana to be more secure/hardened by default.
Testing/Todo