Skip to content

Conversation

@rhmdnd
Copy link
Collaborator

@rhmdnd rhmdnd commented Jul 12, 2023

Remove all the original rules and mappings we had for CIS version 1.1
and instead rely on the control files for CIS OpenShift 1.4.0 that we
recently implemented.

@rhmdnd rhmdnd requested review from Vincent056 and jhrozek July 12, 2023 20:06
@github-actions
Copy link

Start a new ephemeral environment with changes proposed in this pull request:

Fedora Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

@marcusburghardt marcusburghardt added the OpenShift OpenShift product related. label Jul 13, 2023
@rhmdnd rhmdnd added the CIS CIS Benchmark related. label Jul 13, 2023
@rhmdnd rhmdnd force-pushed the use_cis_ocp_1_4 branch from cff89e7 to c411437 Compare July 13, 2023 19:35
@rhmdnd
Copy link
Collaborator Author

rhmdnd commented Jul 13, 2023

/test

@openshift-ci
Copy link

openshift-ci bot commented Jul 13, 2023

@rhmdnd: The /test command needs one or more targets.
The following commands are available to trigger required jobs:

  • /test e2e-aws-ocp4-cis
  • /test e2e-aws-ocp4-cis-node
  • /test e2e-aws-ocp4-e8
  • /test e2e-aws-ocp4-high
  • /test e2e-aws-ocp4-high-node
  • /test e2e-aws-ocp4-moderate
  • /test e2e-aws-ocp4-moderate-node
  • /test e2e-aws-ocp4-pci-dss
  • /test e2e-aws-ocp4-pci-dss-node
  • /test e2e-aws-ocp4-stig
  • /test e2e-aws-ocp4-stig-node
  • /test e2e-aws-rhcos4-e8
  • /test e2e-aws-rhcos4-high
  • /test e2e-aws-rhcos4-moderate
  • /test e2e-aws-rhcos4-stig
  • /test images

Use /test all to run the following jobs that were automatically triggered:

  • pull-ci-ComplianceAsCode-content-master-images
Details

In response to this:

/test

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/test-infra repository.

@rhmdnd
Copy link
Collaborator Author

rhmdnd commented Jul 13, 2023

/test e2e-aws-ocp4-cis
/test e2e-aws-ocp4-cis-node

@rhmdnd
Copy link
Collaborator Author

rhmdnd commented Jul 13, 2023

/test e2e-aws-ocp4-cis
/test e2e-aws-ocp4-cis-node

@rhmdnd rhmdnd force-pushed the use_cis_ocp_1_4 branch from c411437 to 9429f84 Compare July 13, 2023 20:03
@rhmdnd
Copy link
Collaborator Author

rhmdnd commented Jul 13, 2023

/test e2e-aws-ocp4-cis
/test e2e-aws-ocp4-cis-node

@rhmdnd
Copy link
Collaborator Author

rhmdnd commented Jul 13, 2023

The OpenShift tests should work a bit better once #10841 lands

@rhmdnd rhmdnd force-pushed the use_cis_ocp_1_4 branch 2 times, most recently from 57e8108 to df639c0 Compare July 14, 2023 13:26
@rhmdnd
Copy link
Collaborator Author

rhmdnd commented Jul 14, 2023

Rebased to pick up the YAML fix in section 5.

#10843

@rhmdnd
Copy link
Collaborator Author

rhmdnd commented Jul 14, 2023

/test e2e-aws-ocp4-cis
/test e2e-aws-ocp4-cis-node

@jhrozek
Copy link
Collaborator

jhrozek commented Jul 17, 2023

@rhmdnd can you rebase?

@rhmdnd rhmdnd force-pushed the use_cis_ocp_1_4 branch from df639c0 to 8e8da49 Compare July 17, 2023 15:34
@rhmdnd
Copy link
Collaborator Author

rhmdnd commented Jul 17, 2023

/test e2e-aws-ocp4-cis
/test e2e-aws-ocp4-cis-node

@rhmdnd
Copy link
Collaborator Author

rhmdnd commented Jul 17, 2023

The CIS tests are failing because we don't have any filtering in place for the node versus platform rules. Working on that now.

@rhmdnd rhmdnd force-pushed the use_cis_ocp_1_4 branch from 8e8da49 to 3f8b67d Compare July 17, 2023 18:07
@rhmdnd
Copy link
Collaborator Author

rhmdnd commented Jul 17, 2023

/test e2e-aws-ocp4-cis
/test e2e-aws-ocp4-cis-node

@rhmdnd rhmdnd force-pushed the use_cis_ocp_1_4 branch from 3f8b67d to 4ca433c Compare July 17, 2023 19:46
@rhmdnd
Copy link
Collaborator Author

rhmdnd commented Jul 17, 2023

/test e2e-aws-ocp4-cis
/test e2e-aws-ocp4-cis-node

@rhmdnd
Copy link
Collaborator Author

rhmdnd commented Jul 17, 2023

Filtering worked for the CIS profile. Adding in filtering for the node profile now.

@rhmdnd rhmdnd force-pushed the use_cis_ocp_1_4 branch from 4ca433c to f7eeac7 Compare July 17, 2023 21:32
@rhmdnd
Copy link
Collaborator Author

rhmdnd commented Jul 17, 2023

/test e2e-aws-ocp4-cis
/test e2e-aws-ocp4-cis-node

@rhmdnd
Copy link
Collaborator Author

rhmdnd commented Jul 17, 2023

cc: @xiaojiey for awareness that these changes are coming to the CIS profile for the next Compliance Operator release.

@rhmdnd
Copy link
Collaborator Author

rhmdnd commented Jul 17, 2023

OCP4 CIS testing passed. cc @jhrozek @Vincent056 @yuumasato

@xiaojiey
Copy link
Collaborator

xiaojiey commented Jul 18, 2023

cc: @xiaojiey for awareness that these changes are coming to the CIS profile for the next Compliance Operator release.

Got it. Thanks for the notification. Does it mean cis 1.4.0 is available?

@openshift-ci
Copy link

openshift-ci bot commented Jul 18, 2023

@xiaojiey: The label(s) `/label qe-

cannot be applied. These labels are supported:platform/aws, platform/azure, platform/baremetal, platform/google, platform/libvirt, platform/openstack, ga, tide/merge-method-merge, tide/merge-method-rebase, tide/merge-method-squash, px-approved, docs-approved, qe-approved, downstream-change-needed, rebase/manual, approved, backport-risk-assessed, bugzilla/valid-bug, cherry-pick-approved, jira/valid-bug, staff-eng-approved. Is this label configured under labels -> additional_labelsorlabels -> restricted_labelsinplugin.yaml`?

Details

In response to this:

/label qe-

cc: @xiaojiey for awareness that these changes are coming to the CIS profile for the next Compliance Operator release.

Got it. Thanks for the notification. Does it mean cis 1.4.0 is available?

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/test-infra repository.

@jhrozek
Copy link
Collaborator

jhrozek commented Jul 18, 2023

cc: @xiaojiey for awareness that these changes are coming to the CIS profile for the next Compliance Operator release.

Got it. Thanks for the notification. Does it mean cis 1.4.0 is available?

Mostly. We've ported the existing rules and did some changes, but not all. We need to make a second pass to sync the upstream benchmark that we worked on with CIS to the rules, but I don't think there will be many changes. Some parts of CIS are not implementable with CIS yet (some permission issues) outside 4.14+.

But for now this is mostly a different way of building the profile and the references should point to the right controls and sections in upstream CIS.

@jhrozek
Copy link
Collaborator

jhrozek commented Jul 18, 2023

It appears that we have either missed some rules or maybe these rules were deprecated:

- file_permissions_kube_controller_manager (was in node, 1.1.3, now there is a typo that says file_permissions_kube_apiserver)
- file_owner_kubelet (was in node 4.1.6)
- file_permissions_scheduler (was in node 1.1.5)
- general_configure_imagepolicywebhook (was 5.5.1)
- kubelet_enable_protect_kernel_sysctl (was in node 4.2.6)
- kubelet_enable_protect_kernel_defaults (was in node 4.2.6)
- api_server_admission_control_plugin_securitycontextdeny (was 1.2.13)
- api_server_api_priority_flowschema_catch_all (was 1.2.10)
- api_server_auth_mode_node (was 1.2.8)
- api_server_no_adm_ctrl_plugins_disabled (was 1.2.14)
- controller_rotate_kubelet_server_certs (was 1.3.6)
- general_configure_imagepolicywebhook (was 5.5.1)
- kubelet_configure_tls_key (was 4.2.10)
- var_openshift_audit_profile = WriteRequestBodies (wtf diff, can't find it now)

I'll check them out and send PRs for the obvious cases. We can discuss the rest.

@jhrozek
Copy link
Collaborator

jhrozek commented Jul 18, 2023

I think we can skip these rules:

- general_configure_imagepolicywebhook - I don't see this rule being used in CIS at all except a footnote in 5.5.1
- kubelet_enable_protect_kernel_sysctl (was in node 4.2.6) - unused, is the default in newer OCP versions anyway
- kubelet_enable_protect_kernel_defaults (was in node 4.2.6) - ditto
- api_server_admission_control_plugin_securitycontextdeny - explicitly removed in 1.4

@jhrozek
Copy link
Collaborator

jhrozek commented Jul 18, 2023

These were also removed:

api_server_api_priority_flowschema_catch_all - can't find it in 1.4
api_server_auth_mode_node - CIS now only checks for the mode not being AlwaysAllow
api_server_no_adm_ctrl_plugins_disabled - deprecated in favor of api_server_admission_control_plugin_scc

@jhrozek
Copy link
Collaborator

jhrozek commented Jul 18, 2023

In this patch, please explicitly set the audit policy to WriteRequestBodies like we do e.g. in the STIG profile: https://github.com/ComplianceAsCode/content/blob/master/products/ocp4/profiles/stig.profile#L28

@jhrozek
Copy link
Collaborator

jhrozek commented Jul 18, 2023

I will send some minor patches in a separate PR.

Copy link
Collaborator

@jhrozek jhrozek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The audit policy needs to be set.

@rhmdnd rhmdnd force-pushed the use_cis_ocp_1_4 branch 2 times, most recently from 7041bac to 57cb3e0 Compare July 18, 2023 13:11
@rhmdnd
Copy link
Collaborator Author

rhmdnd commented Jul 18, 2023

The audit policy needs to be set.

It was set in a previous patch, but it wasn't commented under Variable like we usually do, so I updated that to be more clear.

f7eeac7 (see line 34)

@rhmdnd
Copy link
Collaborator Author

rhmdnd commented Jul 18, 2023

/test e2e-aws-ocp4-cis
/test e2e-aws-ocp4-cis-node

Remove all the original rules and mappings we had for CIS version 1.1
and instead rely on the control files for CIS OpenShift 1.4.0 that we
recently implemented.
@rhmdnd rhmdnd force-pushed the use_cis_ocp_1_4 branch from 57cb3e0 to 632d332 Compare July 18, 2023 18:50
@rhmdnd
Copy link
Collaborator Author

rhmdnd commented Jul 18, 2023

/test e2e-aws-ocp4-cis
/test e2e-aws-ocp4-cis-node

@qlty-cloud-legacy
Copy link

Code Climate has analyzed commit 632d332 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 53.2% (0.0% change).

View more on Code Climate.

Copy link
Collaborator

@jhrozek jhrozek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@jhrozek jhrozek merged commit f91d7d1 into ComplianceAsCode:master Jul 19, 2023
@yuumasato yuumasato added this to the 0.1.70 milestone Jul 19, 2023
@Mab879 Mab879 added the Update Profile Issues or pull requests related to Profiles updates. label Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CIS CIS Benchmark related. OpenShift OpenShift product related. Update Profile Issues or pull requests related to Profiles updates.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants