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

Defined notes and rules for control BSI APP4.4.A1 to APP4.4.A3 #11501

Merged
merged 4 commits into from
Mar 15, 2024

Conversation

sluetze
Copy link
Contributor

@sluetze sluetze commented Jan 30, 2024

Description:

  • This are requirements 1 to 3 from the bsi APP.4.4 control
  • this also adds a new MANUAL rule, which advices on how to check if only one Application is running per namespace. This is a little different to the already existing rule general_namespaces_in_use

Rationale:

As we have multiple customers asking for a BSI profile to be included in the compliance-operator, we are contributing a profile. To provide a better review process, the individual controle are implemented as separate PRs.

Note:

while we promised to keep the PRs small and reviewable and intended to do one PR per requirement, we will bundle some easy requirements together to not push to many PRs at once.

Copy link

openshift-ci bot commented Jan 30, 2024

Hi @sluetze. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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

@openshift-ci openshift-ci bot added the needs-ok-to-test Used by openshift-ci bot. label Jan 30, 2024
Copy link

github-actions bot commented Jan 30, 2024

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

ocp4 (from CTF) Environment (using Fedora as testing environment)
Open in Gitpod

Fedora Testing Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

@sluetze
Copy link
Contributor Author

sluetze commented Jan 30, 2024

I am not a 100% sure why the tests fails.

as it looks to me the rule is not correctly added to the ocp4 product, but to rhel. This is caused by https://github.com/ComplianceAsCode/content-test-filtering/blob/552403f58c1e72c4261cc049612d46f3f4387fdd/ctf/DiffStruct.py#L103-L114 which sets rhel8 as a default prodtype, if none is defined. Since with #11378 prodtype was removed, this default might be used a lot.

I might be wrong with my analysis, since I am not experienced with the codebase. Due to this I also have no good fix.

Edit: while the prodtype thing seems to be a bug (i opened ComplianceAsCode/content-test-filtering#48 for this), this is not relevant for the failing test see, where i added prodtype back and still got failed tests: https://github.com/sig-bsi-grundschutz/content/actions/runs/7711416833/job/21016736323?pr=53

@BhargaviGudi
Copy link
Collaborator

Verification passed with 4.16.0-0.nightly-2024-02-26-013420 + compliance-operator.v1.4.0 + PR #115

  1. Install CO v1.4.0
$ oc get pb
NAME              CONTENTIMAGE                                                                                                                               CONTENTFILE         STATUS
ocp4              registry.redhat.io/compliance/openshift-compliance-content-rhel8@sha256:83399624f8f5ec77d9ff75b1f397abfa040070ba8b78f7103d8546616dff4c34   ssg-ocp4-ds.xml     VALID
rhcos4            registry.redhat.io/compliance/openshift-compliance-content-rhel8@sha256:83399624f8f5ec77d9ff75b1f397abfa040070ba8b78f7103d8546616dff4c34   ssg-rhcos4-ds.xml   VALID
upstream-ocp4     openscap-ocp4-ds:latest                                                                                                                    ssg-ocp4-ds.xml     VALID
upstream-rhcos4   openscap-ocp4-ds:latest                                                                                                                    ssg-rhcos4-ds.xml   VALID
  1. Create ssb
$ oc compliance bind -N test profile/upstream-ocp4-bsi profile/upstream-ocp4-bsi-node
Creating ScanSettingBinding test
$ oc get suite
NAME   PHASE   RESULT
test   DONE    NON-COMPLIANT
$ oc get scan
NAME                            PHASE   RESULT
upstream-ocp4-bsi               DONE    NON-COMPLIANT
upstream-ocp4-bsi-node-master   DONE    COMPLIANT
upstream-ocp4-bsi-node-worker   DONE    COMPLIANT
  1. Instruction for rule upstream-ocp4-general-namespace-separation
$  oc get rule upstream-ocp4-general-namespace-separation -o=jsonpath={.instructions}
Run the following command and review the pods and how they are deployed in
namespaces. $ oc get pod -o=custom-columns=NAME:.metadata.name,NAMESPACE:.metadata.namespace,APP:.metadata.labels.app\.kubernetes\.io/name --all-namespaces | grep -v "openshift-"
You can use labels or other data as custom field which helps you to identify parts of an application.
Ensure that there are only components of one application in each namespace.[bgudi@bgudi-thinkpadt14sgen2i content]$ 
$ oc get pod -o=custom-columns=NAME:.metadata.name,NAMESPACE:.metadata.namespace,APP:.metadata.labels.app\.kubernetes\.io/name --all-namespaces | grep -v "openshift-"
NAME                                                                      NAMESPACE                                          APP

@sluetze
Copy link
Contributor Author

sluetze commented Mar 1, 2024

/retest

Copy link

openshift-ci bot commented Mar 1, 2024

@sluetze: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

@xiaojiey
Copy link
Collaborator

xiaojiey commented Mar 4, 2024

/ok-to-test

@openshift-ci openshift-ci bot added ok-to-test Used by openshift-ci bot. and removed needs-ok-to-test Used by openshift-ci bot. labels Mar 4, 2024
@yuumasato yuumasato self-assigned this Mar 4, 2024
@sluetze
Copy link
Contributor Author

sluetze commented Mar 4, 2024

/retest

@sluetze
Copy link
Contributor Author

sluetze commented Mar 6, 2024

rebased and force pushed to get the checks running

Copy link

github-actions bot commented Mar 6, 2024

🤖 A k8s content image for this PR is available at:
ghcr.io/complianceascode/k8scontent:11501
This image was built from commit: efe66f2

Click here to see how to deploy it

If you alread have Compliance Operator deployed:
utils/build_ds_container.py -i ghcr.io/complianceascode/k8scontent:11501

Otherwise deploy the content and operator together by checking out ComplianceAsCode/compliance-operator and:
CONTENT_IMAGE=ghcr.io/complianceascode/k8scontent:11501 make deploy-local

Copy link

codeclimate bot commented Mar 6, 2024

Code Climate has analyzed commit efe66f2 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.8% (0.0% change).

View more on Code Climate.

Copy link
Member

@yuumasato yuumasato left a comment

Choose a reason for hiding this comment

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

@sluetze This is looking great to me.

Do you expect some other people to review this?

@yuumasato
Copy link
Member

The Automatus failures occur on cs8, cs9 and sle15 because these products don't have the new rule in the data stream. These are fine though.

@sluetze
Copy link
Contributor Author

sluetze commented Mar 14, 2024

The Automatus failures occur on cs8, cs9 and sle15 because these products don't have the new rule in the data stream. These are fine though.

@sluetze This is looking great to me.

Do you expect some other people to review this?

thanks for your help. No I do not expect more reviews.
I will discuss this with the team if we will do so in the MRs here in the future to have more transparency.

@yuumasato yuumasato added this to the 0.1.73 milestone Mar 15, 2024
@yuumasato yuumasato merged commit a6d36e4 into ComplianceAsCode:master Mar 15, 2024
41 of 44 checks passed
@yuumasato yuumasato added the BSI PRs or issues for the BSI profile. label Mar 15, 2024
@sluetze sluetze deleted the app-4-4-A1to3 branch March 18, 2024 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BSI PRs or issues for the BSI profile. ok-to-test Used by openshift-ci bot. OpenShift OpenShift product related.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants