-
Notifications
You must be signed in to change notification settings - Fork 696
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
To fix CMP-2548 #12008
To fix CMP-2548 #12008
Conversation
Hi @rutvik23. Thanks for your PR. I'm waiting for a ComplianceAsCode member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
🤖 A k8s content image for this PR is available at: Click here to see how to deploy itIf you alread have Compliance Operator deployed: Otherwise deploy the content and operator together by checking out ComplianceAsCode/compliance-operator and: |
/ok-to-test |
/test 4.13-e2e-aws-ocp4-moderate |
applications/openshift/controller/controller_rotate_kubelet_server_certs/rule.yml
Outdated
Show resolved
Hide resolved
applications/openshift/controller/controller_rotate_kubelet_server_certs/rule.yml
Outdated
Show resolved
Hide resolved
/hold for test |
Verification passed with 4.16.0-0.nightly-2024-05-23-173505 + https://github.com/ComplianceAsCode/compliance-operator code + PR #12008 code
|
/unhold |
/hold for test |
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.
Let's unselect the rule so that no profile uses this rule anymore.
grep -r controller_rotate_kubelet_server_certs controls/ products/
controls/srg_ctr/SRG-APP-000516-CTR-001325.yml: - controller_rotate_kubelet_server_certs
controls/nist_ocp4.yml: - controller_rotate_kubelet_server_certs
controls/nist_ocp4.yml: - controller_rotate_kubelet_server_certs
controls/nist_ocp4.yml: - controller_rotate_kubelet_server_certs
controls/nist_ocp4.yml: - controller_rotate_kubelet_server_certs
products/ocp4/profiles/stig-v1r1.profile: - controller_rotate_kubelet_server_certs
And let's add a general warning noting that this rule is deprecated.
Example warning in the rule:https://github.com/ComplianceAsCode/content/blob/master/linux_os/guide/auditing/auditd_configure_rules/audit_rules_etc_passwd_openat/rule.yml#L37
Inspiration for warning text: https://github.com/ComplianceAsCode/content/blob/master/shared/macros/10-warning.jinja#L30
applications/openshift/controller/controller_rotate_kubelet_server_certs/rule.yml
Outdated
Show resolved
Hide resolved
applications/openshift/controller/controller_rotate_kubelet_server_certs/rule.yml
Outdated
Show resolved
Hide resolved
Verification passed with 4.16.0-0.nightly-2024-06-14-130320 + https://github.com/ComplianceAsCode/compliance-operator code + PR #12008 code
|
/unhold |
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.
From what I understand, what makes this rule fails is that feature-gates
doesn't list RotateKubeletServerCertificate=true
any more. At some point OCP stopped listing it and this rule became not applicable.
And for the rule to result in NOT APPLICABLE
the platform
needs to be updated.
For example:
platform: not ocp4-on-hypershift-hosted and (ocp4.10 or ocp4.11)
I tried checking which versions have RotateKubeletServerCertificate
listed in feature-gates
but my clusters installs are failing... I can try getting the list of versions tomorrow.
applications/openshift/controller/controller_rotate_kubelet_server_certs/rule.yml
Outdated
Show resolved
Hide resolved
applications/openshift/controller/controller_rotate_kubelet_server_certs/rule.yml
Outdated
Show resolved
Hide resolved
applications/openshift/controller/controller_rotate_kubelet_server_certs/tests/ocp4/e2e.yml
Show resolved
Hide resolved
applications/openshift/controller/controller_rotate_kubelet_server_certs/rule.yml
Show resolved
Hide resolved
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.
Hi, @rutvik23 sorry for the back and forth.
The RotateKubeletServerCertificate=true
featture gate is available on 4.12, 4.13:
$ oc version
Client Version: 4.14.1
Kustomize Version: v5.0.1
Server Version: 4.12.0-0.nightly-2024-06-20-082732
Kubernetes Version: v1.25.16+306a47e
$ oc get configmaps config -n openshift-kube-controller-manager -ojson | jq -r '.data["config.yaml"]' | jq -r '.extendedArguments["feature-gates"]'
[
"APIPriorityAndFairness=true",
"RotateKubeletServerCertificate=true",
"DownwardAPIHugePages=true",
"CSIMigrationAzureFile=false",
"CSIMigrationvSphere=false"
]
So I think the rule should be available and working for these versions.
keep the rule selected in the profiles. The following changes should be undone:
controls/nist_ocp4.yml
controls/srg_ctr/SRG-APP-000516-CTR-001325.yml
products/ocp4/profiles/stig-v1r1.profile
To make the rules not applicable on 4.13 and 4.14:
platform: not ocp4-on-hypershift-hosted and (ocp4.12 or ocp4.13)
Then override the e2e test results for 4.12 and 4.13. Copy the e2e.yml
and name it 4.12.yml
and 4.13.yml
.
For inspiration: https://github.com/ComplianceAsCode/content/blob/master/applications/openshift/worker/file_permissions_proxy_kubeconfig/tests/ocp4/4.12.yml
applications/openshift/controller/controller_rotate_kubelet_server_certs/rule.yml
Show resolved
Hide resolved
/hold for test |
/test 4.12-e2e-aws-ocp4-high |
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.
@rutvik23 Sorry, looks like the e2e assertions need to be changed here too:
https://github.com/ComplianceAsCode/content/blob/master/tests/assertions/ocp4/ocp4-stig-4.16.yml
https://github.com/ComplianceAsCode/content/blob/master/tests/assertions/ocp4/ocp4-stig-4.15.yml
https://github.com/ComplianceAsCode/content/blob/master/tests/assertions/ocp4/ocp4-stig-4.14.yml
https://github.com/ComplianceAsCode/content/blob/master/tests/assertions/ocp4/ocp4-moderate-4.16.yml
https://github.com/ComplianceAsCode/content/blob/master/tests/assertions/ocp4/ocp4-moderate-4.15.yml
https://github.com/ComplianceAsCode/content/blob/master/tests/assertions/ocp4/ocp4-moderate-4.14.yml
https://github.com/ComplianceAsCode/content/blob/master/tests/assertions/ocp4/ocp4-high-4.16.yml
https://github.com/ComplianceAsCode/content/blob/master/tests/assertions/ocp4/ocp4-high-4.15.yml
https://github.com/ComplianceAsCode/content/blob/master/tests/assertions/ocp4/ocp4-high-4.14.yml
default_result: NOT-APPLICABLE
Code Climate has analyzed commit 3beb2f6 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 59.4% (0.0% change). View more on Code Climate. |
/retest |
/test 4.12-e2e-aws-ocp4-high |
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.
Thank you @rutvik23
Skipping the ansible hardening tests. |
@xiaojiey Apologies. I just noticed the hold for merge label. |
Description:
This rule
controller_rotate_kubelet_server_certs
is no longer valid as it still checking for feature-gate parameter which does not exist in any supported versions of OpenShift 4.$ ./oc get ccr | grep cert | grep -i fail
Reproducible in Compliance Operator v1.4.0 & OpenShift v4.14.z
Rationale:
kubelet_enable_cert_rotation
,kubelet_enable_server_cert_rotation
already satisfy this check.Review Hints: