-
Notifications
You must be signed in to change notification settings - Fork 706
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
Add ocp4 pci dss references #12309
Add ocp4 pci dss references #12309
Conversation
🤖 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: |
I deployed this change into a cluster, then attempted to verify each rule in the PCI-DSS profiles has the expected reference, but only a handful of them did. Here are the steps I used to reproduce:
$ oc get profiles ocp4-pci-dss-node-4-0 -o yaml > 4-0-node-rules.txt
$ head 4-0-node-rules.txt
ocp4-directory-access-var-log-kube-audit
ocp4-directory-access-var-log-oauth-audit
ocp4-directory-access-var-log-ocp-audit
ocp4-directory-permissions-var-log-kube-audit
ocp4-directory-permissions-var-log-oauth-audit
ocp4-directory-permissions-var-log-ocp-audit
ocp4-etcd-unique-ca
ocp4-file-groupowner-cni-conf
ocp4-file-groupowner-controller-manager-kubeconfig
ocp4-file-groupowner-etcd-data-dir
Is this expected? |
Interesting, the rules without The auto-referencing works on the rules selected in the Control file, these are rules added by extension. Let me see if I can make it work... |
9d7e6d8
to
2c447bd
Compare
@rhmdnd All the CIS rules added as part of |
@Mab879 @jan-cerny in c63cb65 I have extended nesting of controls to support The reason I change from extending CIS profile to importing all CIS controls, is to take advantage of the auto-referencing of rules in the control file. |
2c447bd
to
2438f12
Compare
@@ -18,8 +18,6 @@ description: |- | |||
|
|||
filter_rules: '"ocp4-node" not in platforms and "ocp4-master-node" not in platforms and "ocp4-node-on-sdn" not in platforms and "ocp4-node-on-ovn" not in platforms' | |||
|
|||
# Req-2.2 | |||
extends: cis |
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.
Is it safe to assume this is the old way of doing things, and what you did on 2438f12#diff-67844ce694c84c54b76dac7610bc6443a329477c4a685417d3aaa1eae7b6e29cR391 is how we should be doing it moving forward?
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.
I guess so, if one wants to take advantage of auto-referencing in control files.
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.
/lgtm
Works for me in my cluster with the latest profiles, thanks!
@Mab879 @jan-cerny Test added for the import of controls with |
/hold for test |
The audit_profile_set rule is an OCP rule, and is not necessary in this control file. Also, this rules is already selected in the pcidss_4_ocp4 control file, and breaks the auto referencing feature
Let's auto ref the PCI-DSS v4.0 rules
New platforms for node were added and these profiles were not updated to exclude these new node platforms.
Allow a control to extend all controls of a policy with 'all' key.
Change Control.add_references() to iterate over the selected rules, not the listed rules. There can be differences on the rules in 'selected' and 'rules'. When the Control is resolved, the final list of selected rules is in 'selected'. This is particularly more evident when we are importing other controls.
When a profile extends another one, the rules on the extended profile are not auto referenced. This patch importa the CIS into PCI-DSS, allowing the CIS rules to have PCI-DSS added automatically.
Test import of all controls of a specific level.
5d69b16
to
4d8484e
Compare
Rebased to address codeclimate issues. |
Code Climate has analyzed commit 4d8484e 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.5% (0.1% change). View more on Code Climate. |
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.
I have built the ocp4 product and reviewed the resolved control file at build/ocp4/controls/pcidss_4_ocp4.yml
. The control includes rules form the CIS controls. It seems to work correctly.
@yuumasato I am not sure if there is anything wrong.
|
/hold for test |
sorry, a stupid typo error. The PR works well.
|
Description:
ocp4
rule frompcidss_4.yml
.Rule
audit_profile_set
is an OCP4, and it was breaking auto referencing inpcidss_4_ocp4.yml
pcidss_4_ocp4.yml
.cis_ocp_1_4_0:all:level_2
Rationale:
Review Hints:
gh co 594
$ CONTENT_IMAGE=ghcr.io/complianceascode/k8scontent:12309 make deploy-local