-
Notifications
You must be signed in to change notification settings - Fork 326
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
chore: adding cel for psp-seccomp policy #540
Merged
JaydipGabani
merged 31 commits into
open-policy-agent:master
from
JaydipGabani:psp-seccomp
Oct 28, 2024
Merged
Changes from 8 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
90223c5
chore: adding cel for psp-seccomp policy
JaydipGabani e74ac1d
using anyObject variable
JaydipGabani 158fa77
moving rego under engine
JaydipGabani 2b39fbd
tracking SC to annotations, adding v2 for seccomp with option to not …
JaydipGabani 04a5b72
fixing bugs
JaydipGabani ccc7044
fixing bugs
JaydipGabani ea66a2a
Merge branch 'master' into psp-seccomp
JaydipGabani d5d787c
removing naming_translations and streamlining name mapping
JaydipGabani 0083b09
Merge branch 'master' into psp-seccomp
JaydipGabani 0a990b9
adding seccompv2 in kustomize
JaydipGabani 308fe29
Merge branch 'psp-seccomp' of github.com:JaydipGabani/gatekeeper-libr…
JaydipGabani df5aaba
fixing rego bugs
JaydipGabani 467cd42
adding seccompv2
JaydipGabani 26570a0
Merge branch 'master' into psp-seccomp
JaydipGabani dcbfa57
fixing unused variables
JaydipGabani 48f2cd3
Merge branch 'psp-seccomp' of github.com:JaydipGabani/gatekeeper-libr…
JaydipGabani ec12a95
adding new line
JaydipGabani 4306ad7
Merge branch 'master' into psp-seccomp
JaydipGabani dc6ee09
Merge branch 'master' into psp-seccomp
JaydipGabani f06bad5
Merge branch 'master' into psp-seccomp
JaydipGabani 3b5e429
updating seccompv2 description
JaydipGabani 123c6b5
Merge branch 'psp-seccomp' of github.com:JaydipGabani/gatekeeper-libr…
JaydipGabani 1bfcd91
removing unused example
JaydipGabani 76e4624
Merge branch 'master' into psp-seccomp
JaydipGabani 0ea1c1c
Merge branch 'master' into psp-seccomp
JaydipGabani 3ed88dc
updating seccompv2 to remove string building for localhost profiles
JaydipGabani fbd2560
updating rego variable name
JaydipGabani d11f81d
Merge branch 'master' into psp-seccomp
JaydipGabani 42c932d
adding examples for localhost profile
JaydipGabani 0b65a32
fixing CEL code
JaydipGabani 14f4ac1
addressing nit, updating description for seccompv2
JaydipGabani File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
artifacthub/library/pod-security-policy/seccomp/1.1.0/artifacthub-pkg.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
version: 1.1.0 | ||
name: k8spspseccomp | ||
displayName: Seccomp | ||
createdAt: "2024-06-03T13:44:11Z" | ||
description: Controls the seccomp profile used by containers. Corresponds to the `seccomp.security.alpha.kubernetes.io/allowedProfileNames` annotation on a PodSecurityPolicy. For more information, see https://kubernetes.io/docs/concepts/policy/pod-security-policy/#seccomp | ||
digest: 07f8b85938fc7c703fdfc5e163ba6f0cc87b559a1eea819d5c5aded6f7e7cc95 | ||
license: Apache-2.0 | ||
homeURL: https://open-policy-agent.github.io/gatekeeper-library/website/seccomp | ||
keywords: | ||
- gatekeeper | ||
- open-policy-agent | ||
- policies | ||
readme: |- | ||
# Seccomp | ||
Controls the seccomp profile used by containers. Corresponds to the `seccomp.security.alpha.kubernetes.io/allowedProfileNames` annotation on a PodSecurityPolicy. For more information, see https://kubernetes.io/docs/concepts/policy/pod-security-policy/#seccomp | ||
install: |- | ||
### Usage | ||
```shell | ||
kubectl apply -f https://raw.githubusercontent.com/open-policy-agent/gatekeeper-library/master/artifacthub/library/pod-security-policy/seccomp/1.1.0/template.yaml | ||
``` | ||
provider: | ||
name: Gatekeeper Library |
2 changes: 2 additions & 0 deletions
2
artifacthub/library/pod-security-policy/seccomp/1.1.0/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
resources: | ||
- template.yaml |
12 changes: 12 additions & 0 deletions
12
artifacthub/library/pod-security-policy/seccomp/1.1.0/samples/psp-seccomp/constraint.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: constraints.gatekeeper.sh/v1beta1 | ||
kind: K8sPSPSeccomp | ||
metadata: | ||
name: psp-seccomp | ||
spec: | ||
match: | ||
kinds: | ||
- apiGroups: [""] | ||
kinds: ["Pod"] | ||
parameters: | ||
allowedProfiles: | ||
- runtime/default |
12 changes: 12 additions & 0 deletions
12
...b/library/pod-security-policy/seccomp/1.1.0/samples/psp-seccomp/disallowed_ephemeral.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: nginx-seccomp-disallowed | ||
annotations: | ||
container.seccomp.security.alpha.kubernetes.io/nginx: unconfined | ||
labels: | ||
app: nginx-seccomp | ||
spec: | ||
ephemeralContainers: | ||
- name: nginx | ||
image: nginx |
12 changes: 12 additions & 0 deletions
12
...acthub/library/pod-security-policy/seccomp/1.1.0/samples/psp-seccomp/example_allowed.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: nginx-seccomp-allowed | ||
annotations: | ||
container.seccomp.security.alpha.kubernetes.io/nginx: runtime/default | ||
labels: | ||
app: nginx-seccomp | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginx |
12 changes: 12 additions & 0 deletions
12
...cthub/library/pod-security-policy/seccomp/1.1.0/samples/psp-seccomp/example_allowed2.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: nginx-seccomp-allowed2 | ||
annotations: | ||
seccomp.security.alpha.kubernetes.io/pod: runtime/default | ||
labels: | ||
app: nginx-seccomp | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginx |
12 changes: 12 additions & 0 deletions
12
...hub/library/pod-security-policy/seccomp/1.1.0/samples/psp-seccomp/example_disallowed.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: nginx-seccomp-disallowed | ||
annotations: | ||
container.seccomp.security.alpha.kubernetes.io/nginx: unconfined | ||
labels: | ||
app: nginx-seccomp | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginx |
12 changes: 12 additions & 0 deletions
12
...ub/library/pod-security-policy/seccomp/1.1.0/samples/psp-seccomp/example_disallowed2.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: nginx-seccomp-disallowed2 | ||
annotations: | ||
seccomp.security.alpha.kubernetes.io/pod: unconfined | ||
labels: | ||
app: nginx-seccomp | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginx |
32 changes: 32 additions & 0 deletions
32
artifacthub/library/pod-security-policy/seccomp/1.1.0/suite.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
kind: Suite | ||
apiVersion: test.gatekeeper.sh/v1alpha1 | ||
metadata: | ||
name: seccomp | ||
tests: | ||
- name: default-seccomp-required | ||
template: template.yaml | ||
constraint: samples/psp-seccomp/constraint.yaml | ||
cases: | ||
- name: example-disallowed-global | ||
object: samples/psp-seccomp/example_disallowed2.yaml | ||
assertions: | ||
- violations: 1 | ||
message: "Seccomp profile 'unconfined' is not allowed for container 'nginx'. Found at: annotation seccomp.security.alpha.kubernetes.io/pod" | ||
- name: example-disallowed-container | ||
object: samples/psp-seccomp/example_disallowed.yaml | ||
assertions: | ||
- violations: 1 | ||
message: "Seccomp profile 'unconfined' is not allowed for container 'nginx'. Found at: annotation container.seccomp.security.alpha.kubernetes.io/nginx" | ||
- name: example-allowed-container | ||
object: samples/psp-seccomp/example_allowed.yaml | ||
assertions: | ||
- violations: no | ||
- name: example-allowed-global | ||
object: samples/psp-seccomp/example_allowed2.yaml | ||
assertions: | ||
- violations: no | ||
- name: disallowed-ephemeral | ||
object: samples/psp-seccomp/disallowed_ephemeral.yaml | ||
assertions: | ||
- violations: 1 | ||
message: "Seccomp profile 'unconfined' is not allowed for container 'nginx'. Found at: annotation container.seccomp.security.alpha.kubernetes.io/nginx" |
415 changes: 415 additions & 0 deletions
415
artifacthub/library/pod-security-policy/seccomp/1.1.0/template.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
artifacthub/library/pod-security-policy/seccompv2/1.0.0/artifacthub-pkg.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
version: 1.0.0 | ||
name: k8spspseccompv2 | ||
displayName: Seccomp V2 | ||
createdAt: "2024-06-13T18:28:19Z" | ||
description: Controls the seccomp profile used by containers. Corresponds to the `seccomp.security.alpha.kubernetes.io/allowedProfileNames` annotation on a PodSecurityPolicy. For more information, see https://kubernetes.io/docs/concepts/policy/pod-security-policy/#seccompv2 | ||
digest: 0c5ff5e28c13a668a84d28566508fd92ef30e364d6d7a884130578d637a1d088 | ||
license: Apache-2.0 | ||
homeURL: https://open-policy-agent.github.io/gatekeeper-library/website/seccompv2 | ||
keywords: | ||
- gatekeeper | ||
- open-policy-agent | ||
- policies | ||
readme: |- | ||
# Seccomp V2 | ||
Controls the seccomp profile used by containers. Corresponds to the `seccomp.security.alpha.kubernetes.io/allowedProfileNames` annotation on a PodSecurityPolicy. For more information, see https://kubernetes.io/docs/concepts/policy/pod-security-policy/#seccompv2 | ||
install: |- | ||
### Usage | ||
```shell | ||
kubectl apply -f https://raw.githubusercontent.com/open-policy-agent/gatekeeper-library/master/artifacthub/library/pod-security-policy/seccompv2/1.0.0/template.yaml | ||
``` | ||
provider: | ||
name: Gatekeeper Library |
2 changes: 2 additions & 0 deletions
2
artifacthub/library/pod-security-policy/seccompv2/1.0.0/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
resources: | ||
- template.yaml |
12 changes: 12 additions & 0 deletions
12
artifacthub/library/pod-security-policy/seccompv2/1.0.0/samples/psp-seccomp/constraint.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: constraints.gatekeeper.sh/v1beta1 | ||
kind: K8sPSPSeccompV2 | ||
metadata: | ||
name: psp-seccomp | ||
spec: | ||
match: | ||
kinds: | ||
- apiGroups: [""] | ||
kinds: ["Pod"] | ||
parameters: | ||
allowedProfiles: | ||
- docker/default |
12 changes: 12 additions & 0 deletions
12
...library/pod-security-policy/seccompv2/1.0.0/samples/psp-seccomp/disallowed_ephemeral.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: nginx-seccomp-disallowed | ||
annotations: | ||
seccomp.security.alpha.kubernetes.io/pod: runtime/default | ||
labels: | ||
app: nginx-seccomp | ||
spec: | ||
ephemeralContainers: | ||
- name: nginx | ||
image: nginx |
13 changes: 13 additions & 0 deletions
13
...thub/library/pod-security-policy/seccompv2/1.0.0/samples/psp-seccomp/example_allowed.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: nginx-seccomp-allowed | ||
labels: | ||
app: nginx-seccomp | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginx | ||
securityContext: | ||
seccompProfile: | ||
type: RuntimeDefault |
12 changes: 12 additions & 0 deletions
12
...hub/library/pod-security-policy/seccompv2/1.0.0/samples/psp-seccomp/example_allowed2.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: nginx-seccomp-allowed2 | ||
annotations: | ||
seccomp.security.alpha.kubernetes.io/pod: runtime/default | ||
labels: | ||
app: nginx-seccomp | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginx |
13 changes: 13 additions & 0 deletions
13
...b/library/pod-security-policy/seccompv2/1.0.0/samples/psp-seccomp/example_disallowed.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: nginx-seccomp-disallowed | ||
labels: | ||
app: nginx-seccomp | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginx | ||
securityContext: | ||
seccompProfile: | ||
type: Unconfined |
13 changes: 13 additions & 0 deletions
13
.../library/pod-security-policy/seccompv2/1.0.0/samples/psp-seccomp/example_disallowed2.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: nginx-seccomp-disallowed2 | ||
labels: | ||
app: nginx-seccomp | ||
spec: | ||
securityContext: | ||
seccompProfile: | ||
type: Unconfined | ||
containers: | ||
- name: nginx | ||
image: nginx |
12 changes: 12 additions & 0 deletions
12
.../library/pod-security-policy/seccompv2/1.0.0/samples/psp-seccomp/example_disallowed3.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: nginx-seccomp-allowed2 | ||
annotations: | ||
seccomp.security.alpha.kubernetes.io/pod: runtime/default | ||
labels: | ||
app: nginx-seccomp | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginx |
28 changes: 28 additions & 0 deletions
28
artifacthub/library/pod-security-policy/seccompv2/1.0.0/suite.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
kind: Suite | ||
apiVersion: test.gatekeeper.sh/v1alpha1 | ||
metadata: | ||
name: seccomp | ||
tests: | ||
- name: default-seccomp-required | ||
template: template.yaml | ||
constraint: samples/psp-seccomp/constraint.yaml | ||
cases: | ||
- name: example-disallowed-global | ||
object: samples/psp-seccomp/example_disallowed2.yaml | ||
assertions: | ||
- violations: 1 | ||
message: "Seccomp profile 'unconfined' is not allowed for container 'nginx'. Found at: pod securityContext." | ||
- name: example-disallowed-container | ||
object: samples/psp-seccomp/example_disallowed.yaml | ||
assertions: | ||
- violations: 1 | ||
message: "Seccomp profile 'unconfined' is not allowed for container 'nginx'. Found at: container securityContext." | ||
- name: example-allowed-container | ||
object: samples/psp-seccomp/example_allowed.yaml | ||
assertions: | ||
- violations: no | ||
- name: disallowed-ephemeral | ||
object: samples/psp-seccomp/disallowed_ephemeral.yaml | ||
assertions: | ||
- violations: 1 | ||
message: "Seccomp profile 'not configured' is not allowed for container 'nginx'. Found at: no explicit profile found" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should update the description too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated description.