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

security requirements of the container-native operators #1967

Merged

Conversation

shimritproj
Copy link
Contributor

@shimritproj shimritproj commented Apr 8, 2024

Issue Link
https://issues.redhat.com/browse/CNFCERT-882?filter=-1

This PR includes 4 operator test cases.

  • testOperatorPodsRunAsUserID(): This test verifies that no pods managed by operators run with the root user ID (UID) of 0, which could introduce security vulnerabilities.

  • testOperatorPodsRunAsNonRoot(): This test ensures that pods managed by operators adhere to security best practices by running as non-root users.

  • testOperatorPodsAutomountTokens(): This test evaluates the configuration of automount service tokens in pods managed by operators.

  • testOperatorContainersReadOnlyFilesystem(): This test verifies whether containers within pods managed by operators have a read-only root filesystem, enhancing security by preventing unauthorized modifications.

We get pods of all operators and then test the above conditions.

In addition, the 'rbac' folder moved into the 'common' folder because it is used by functions in many places in the code, and we want to avoid duplicating code.

build-depends: https://github.com/dci-labs/dallas-pipelines/pull/1159

@dcibot
Copy link
Collaborator

dcibot commented Apr 8, 2024

cnf-certification-test/operator/suite.go Outdated Show resolved Hide resolved
cnf-certification-test/operator/suite.go Outdated Show resolved Hide resolved
cnf-certification-test/identifiers/identifiers.go Outdated Show resolved Hide resolved
cnf-certification-test/identifiers/doclinks.go Outdated Show resolved Hide resolved
pkg/provider/containers.go Show resolved Hide resolved
pkg/provider/pods.go Show resolved Hide resolved
@ramperher
Copy link
Collaborator

@shimritproj could you add this new test to the CATALOG.md? Thanks

@shimritproj shimritproj force-pushed the securityOperators branch 6 times, most recently from b9b2eb3 to 1deda2b Compare May 1, 2024 13:13
@dcibot
Copy link
Collaborator

dcibot commented May 5, 2024

@ramperher
Copy link
Collaborator

ramperher commented May 7, 2024

from change #1967:

Don't know if it's expected, but the four new tests added in this change are all skipped in this DCI job. Are they behaving properly?

@shimritproj shimritproj force-pushed the securityOperators branch from a976e0f to 584eca9 Compare May 7, 2024 09:39
@dcibot
Copy link
Collaborator

dcibot commented May 7, 2024

cnf-certification-test/operator/suite.go Outdated Show resolved Hide resolved
cnf-certification-test/operator/suite.go Outdated Show resolved Hide resolved
@shimritproj
Copy link
Contributor Author

from change #1967:

Don't know if it's expected, but the four new tests added in this change are all skipped in this DCI job. Are they behaving properly?

I am aware of the issue and actively working on it. This is why I indicated that the PR is still a work in progress and not yet ready for review. @ramperher

Copy link
Contributor

@bnshr bnshr left a comment

Choose a reason for hiding this comment

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

Make changes in all logs wherever applicable.

cnf-certification-test/operator/suite.go Outdated Show resolved Hide resolved
cnf-certification-test/operator/suite.go Outdated Show resolved Hide resolved
@dcibot
Copy link
Collaborator

dcibot commented Jul 1, 2024

@sebrandon1
Copy link
Member

/dci-rerun

@shimritproj shimritproj force-pushed the securityOperators branch 2 times, most recently from c5b705e to 438c545 Compare July 3, 2024 09:01
…ve operators

checks:
USER id should not be 0

readOnlyRootFilesystem = true

runAsNonRoot = true

automount service account token = false{}
@dcibot
Copy link
Collaborator

dcibot commented Jul 3, 2024

@dcibot
Copy link
Collaborator

dcibot commented Jul 3, 2024

Copy link
Collaborator

@ramperher ramperher left a comment

Choose a reason for hiding this comment

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

Reviewed the issue with DCI job, it's because of the workload we're deploying, tests look fine.

@sebrandon1
Copy link
Member

@ramperher Does this mean that if we rekick the DCI job the error is handled now as an expected failure?

@dcibot
Copy link
Collaborator

dcibot commented Jul 8, 2024

@ramperher
Copy link
Collaborator

@ramperher Does this mean that if we rekick the DCI job the error is handled now as an expected failure?

Exactly, we're running an operator that is not under our control, so I assume the tests that were failing before must be considered as exceptions.

@sebrandon1
Copy link
Member

/dci-rerun

@dcibot
Copy link
Collaborator

dcibot commented Jul 8, 2024

@sebrandon1 sebrandon1 merged commit 7c0ddf6 into redhat-best-practices-for-k8s:main Jul 8, 2024
25 checks passed
@dcibot
Copy link
Collaborator

dcibot commented Jul 8, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants