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

Added policy for require-run-as-containeruser for windows pods #1024

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

anuddeeph1
Copy link
Contributor

Description

Containers must be required to run as ContainerUser. This policy ensures that the fields spec.securityContext.windowsOptions.runAsUserName, spec.containers[].securityContext.windowsOptions.runAsUserName, spec.initContainers[].securityContext.windowsOptions.runAsUserName is either unset or set to ContainerUser.

Checklist

  • [] I have read the policy contribution guidelines.
  • [] I have added test manifests and resources covering both positive and negative tests that prove this policy works as intended.
  • [] I have added the artifacthub-pkg.yml file and have verified it is complete and correct.

@chipzoller
Copy link
Member

DCO is required here.

Signed-off-by: Anudeep Nalla <anudeep.nalla@nirmata.com>
@chipzoller
Copy link
Member

Please sign off on your PR.

Signed-off-by: Anudeep Nalla <anudeep.nalla@nirmata.com>
@anuddeeph1
Copy link
Contributor Author

@chipzoller , signed off the PR

chipzoller and others added 3 commits May 30, 2024 18:53
Signed-off-by: Anudeep Nalla <anudeep.nalla@nirmata.com>
Signed-off-by: Anudeep Nalla <anudeep.nalla@nirmata.com>
policies.kyverno.io/subject: Pod
kyverno.io/kyverno-version: 1.6.0
kyverno.io/kubernetes-version: "1.22-1.28"
policies.nirmata.io/remediation-docs: "N/A"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
policies.nirmata.io/remediation-docs: "N/A"

No proprietary annotations, please.

name: require-run-as-containeruser
annotations:
policies.kyverno.io/title: Require Run As ContainerUser
policies.kyverno.io/category: Pod Security Standards (Restricted)
Copy link
Member

Choose a reason for hiding this comment

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

This is not in the official restricted profile. Please use a different category ensuring you also update Artfact Hub metadata.

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: require-run-as-containeruser
Copy link
Member

Choose a reason for hiding this comment

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

I suggest putting "Windows" somewhere in this title so it's clear to users.

metadata:
name: require-run-as-containeruser
annotations:
policies.kyverno.io/title: Require Run As ContainerUser
Copy link
Member

Choose a reason for hiding this comment

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

Same here with regard to "Windows" in the title.

Comment on lines +28 to +29


Copy link
Member

Choose a reason for hiding this comment

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

Eliminate excess new lines.

Comment on lines +27 to +28


Copy link
Member

Choose a reason for hiding this comment

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

Excessive new lines.

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.

None yet

2 participants