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

chore: adding cel for psp-seccomp policy #540

Merged
merged 31 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all 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 Jun 3, 2024
e74ac1d
using anyObject variable
JaydipGabani Jun 3, 2024
158fa77
moving rego under engine
JaydipGabani Jun 3, 2024
2b39fbd
tracking SC to annotations, adding v2 for seccomp with option to not …
JaydipGabani Jun 18, 2024
04a5b72
fixing bugs
JaydipGabani Jun 18, 2024
ccc7044
fixing bugs
JaydipGabani Jun 18, 2024
ea66a2a
Merge branch 'master' into psp-seccomp
JaydipGabani Jun 18, 2024
d5d787c
removing naming_translations and streamlining name mapping
JaydipGabani Jun 20, 2024
0083b09
Merge branch 'master' into psp-seccomp
JaydipGabani Jun 27, 2024
0a990b9
adding seccompv2 in kustomize
JaydipGabani Jun 27, 2024
308fe29
Merge branch 'psp-seccomp' of github.com:JaydipGabani/gatekeeper-libr…
JaydipGabani Jun 27, 2024
df5aaba
fixing rego bugs
JaydipGabani Jun 27, 2024
467cd42
adding seccompv2
JaydipGabani Jul 30, 2024
26570a0
Merge branch 'master' into psp-seccomp
JaydipGabani Jul 30, 2024
dcbfa57
fixing unused variables
JaydipGabani Jul 30, 2024
48f2cd3
Merge branch 'psp-seccomp' of github.com:JaydipGabani/gatekeeper-libr…
JaydipGabani Jul 30, 2024
ec12a95
adding new line
JaydipGabani Aug 1, 2024
4306ad7
Merge branch 'master' into psp-seccomp
JaydipGabani Aug 5, 2024
dc6ee09
Merge branch 'master' into psp-seccomp
JaydipGabani Aug 19, 2024
f06bad5
Merge branch 'master' into psp-seccomp
JaydipGabani Aug 21, 2024
3b5e429
updating seccompv2 description
JaydipGabani Sep 4, 2024
123c6b5
Merge branch 'psp-seccomp' of github.com:JaydipGabani/gatekeeper-libr…
JaydipGabani Sep 4, 2024
1bfcd91
removing unused example
JaydipGabani Sep 5, 2024
76e4624
Merge branch 'master' into psp-seccomp
JaydipGabani Sep 12, 2024
0ea1c1c
Merge branch 'master' into psp-seccomp
JaydipGabani Sep 20, 2024
3ed88dc
updating seccompv2 to remove string building for localhost profiles
JaydipGabani Sep 23, 2024
fbd2560
updating rego variable name
JaydipGabani Sep 23, 2024
d11f81d
Merge branch 'master' into psp-seccomp
JaydipGabani Oct 1, 2024
42c932d
adding examples for localhost profile
JaydipGabani Oct 1, 2024
0b65a32
fixing CEL code
JaydipGabani Oct 24, 2024
14f4ac1
addressing nit, updating description for seccompv2
JaydipGabani Oct 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: 483941dab0df9cb51189b131e309bf927928b69b46ed51986d2f51e30fe758af
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
resources:
- template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: constraints.gatekeeper.sh/v1beta1
kind: K8sPSPSeccomp
metadata:
name: psp-seccomp
spec:
match:
kinds:
- apiGroups: [""]
kinds: ["Pod"]
parameters:
exemptImages:
- nginx-exempt
allowedProfiles:
- runtime/default
- localhost/profile.json
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
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
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
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-exempt
securityContext:
seccompProfile:
type: Unconfined
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Pod
metadata:
name: nginx-seccomp-allowed-localhost
labels:
app: nginx-seccomp
spec:
containers:
- name: nginx
image: nginx
securityContext:
seccompProfile:
type: Localhost
localhostProfile: profile.json
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
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Pod
metadata:
name: nginx-seccomp-disallowed-localhost
labels:
app: nginx-seccomp
spec:
containers:
- name: nginx
image: nginx
securityContext:
seccompProfile:
type: Localhost
localhostProfile: profile.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
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"
- name: example-allowed-container-exempt-image
object: samples/psp-seccomp/example_allowed_exempt_image.yaml
assertions:
- violations: no
- name: example-allowed-container-localhost-profile
object: samples/psp-seccomp/example_allowed_localhost.yaml
assertions:
- violations: no
- name: example-disallowed-container-localhost-profile
object: samples/psp-seccomp/example_disallowed_localhost.yaml
assertions:
- violations: 1
message: "Seccomp profile 'localhost/profile.log' is not allowed for container 'nginx'. Found at: container securityContext."
Loading
Loading