Skip to content
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

OCPBUGS-10508: Add quotes around SCC audit procedure #10940

Merged
merged 1 commit into from
Aug 11, 2023

Conversation

rhmdnd
Copy link
Collaborator

@rhmdnd rhmdnd commented Aug 1, 2023

The json query we're using to help users detect SCCs they need to
monitor is rather complicated and should be quoted. Otherwise, it will
fail to run, which is frustrating for users if they're copy/pasting the
command out of the CRD (which is common).

@github-actions
Copy link

github-actions bot commented Aug 1, 2023

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

Fedora Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

@rhmdnd
Copy link
Collaborator Author

rhmdnd commented Aug 1, 2023

cc: @xiaojiey

@marcusburghardt marcusburghardt added the OpenShift OpenShift product related. label Aug 2, 2023
@marcusburghardt marcusburghardt added this to the 0.1.70 milestone Aug 2, 2023
Copy link
Contributor

@Vincent056 Vincent056 left a comment

Choose a reason for hiding this comment

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

I think it looks good except the single quote Xiaojie mentioned

Copy link
Contributor

@Vincent056 Vincent056 left a comment

Choose a reason for hiding this comment

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

/lgtm

@yuumasato
Copy link
Member

testing-farm:centos-stream-8-x86_64 failed on these rules:

:: [ 18:07:08 ] :: [   FAIL   ] :: Rules not passing after remediation:
xccdf_org.ssgproject.content_rule_configure_gnutls_tls_crypto_policy - fail
xccdf_org.ssgproject.content_rule_harden_sshd_ciphers_openssh_conf_crypto_policy - fail
xccdf_org.ssgproject.content_rule_harden_sshd_ciphers_opensshserver_conf_crypto_policy - fail
xccdf_org.ssgproject.content_rule_harden_sshd_macs_openssh_conf_crypto_policy - fail
xccdf_org.ssgproject.content_rule_harden_sshd_macs_opensshserver_conf_crypto_policy - fail 

Which is unrelated to this PR.

I have rerun the test, but it may require a rebase to pass CI.

The json query we're using to help users detect SCCs they need to
monitor is rather complicated and should be quoted. Otherwise, it will
fail to run, which is frustrating for users if they're copy/pasting the
command out of the CRD (which is common).
@codeclimate
Copy link

codeclimate bot commented Aug 10, 2023

Code Climate has analyzed commit 235e77d 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.3% (0.0% change).

View more on Code Climate.

@yuumasato
Copy link
Member

testing-farm:centos-stream-8-x86_64 failed on these rules:

So this test is not required temporarily.
#10978

@BhargaviGudi
Copy link
Collaborator

/hold for testing

@openshift-ci openshift-ci bot added the do-not-merge/hold Used by openshift-ci-robot bot. label Aug 11, 2023
@BhargaviGudi
Copy link
Collaborator

BhargaviGudi commented Aug 11, 2023

Verification passed with 4.10.0-0.nightly-2023-08-03-212145 + compliance-operator.v1.2.0 and 4.14.0-0.nightly-2023-08-10-072041 + compliance-operator.v1.2.0

1. Install CO
2.  Check for rule ocp4-scc-limit-container-allowed-capabilities instructions
$ oc get rule upstream-ocp4-scc-limit-container-allowed-capabilities -o=jsonpath={.instructions}
This rule checks the SCCs with allowedCapabilities set to non-null
and fails if there are more such SCCs than those allowed in the variable
named ocp4-var-sccs-with-allowed-capabilities-regex. To debug the rule,
check the variable value, e.g:
$ oc get variable ocp4-var-sccs-with-allowed-capabilities-regex  -ojsonpath='{.value}' 
Then use following command to list the SCCs that would fail the test:
$ oc get scc -o json | jq '[.items[] | select(.metadata.name | test("^privileged$|^hostnetwork-v2$|^restricted-v2$|^nonroot-v2$"; "") | not) | select(.allowedCapabilities != null) | .metadata.name]'
Please replace the regular expression in the test command with the value read from the variable
ocp4-var-sccs-with-allowed-capabilities-regex. You can read the variable
value with:
$ oc get variable ocp4-var-sccs-with-allowed-capabilities-regex -ojsonpath='{.value}' -n openshift-compliance
3. 
$ oc get variable ocp4-var-sccs-with-allowed-capabilities-regex  -ojsonpath='{.value}' 
^privileged$|^hostnetwork-v2$|^restricted-v2$|^nonroot-v2
$ oc get scc -o json | jq '[.items[] | select(.metadata.name | test("^privileged$|^hostnetwork-v2$|^restricted-v2$|^nonroot-v2$"; "") | not) | select(.allowedCapabilities != null) | .metadata.name]'
[]

@BhargaviGudi
Copy link
Collaborator

/unhold

@openshift-ci openshift-ci bot removed the do-not-merge/hold Used by openshift-ci-robot bot. label Aug 11, 2023
@BhargaviGudi
Copy link
Collaborator

/qe-approved

@yuumasato
Copy link
Member

It seems that tests testing-farm:centos-stream-9-x86_64 and testing-farm:fedora-38-x86_64 are not reporting back, but they passed in a previous run.

@yuumasato yuumasato merged commit 3b8ceef into ComplianceAsCode:master Aug 11, 2023
30 of 34 checks passed
@Mab879 Mab879 added the Update Rule Issues or pull requests related to Rules updates. label Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OpenShift OpenShift product related. Update Rule Issues or pull requests related to Rules updates.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants