Skip to content

Commit 06d9966

Browse files
committed
Feat(#199): initial test setup for restrictes PSS/PSA with K8s 1.25
1 parent f2dbe50 commit 06d9966

File tree

2 files changed

+38
-3
lines changed

2 files changed

+38
-3
lines changed

helm/wrongsecrets-ctf-party/values.yaml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ balancer:
5555
limits:
5656
memory: 1024Mi
5757
cpu: 1000m
58+
securityContext:
59+
allowPrivilegeEscalation: false
60+
readOnlyRootFilesystem: true
61+
runAsNonRoot: true
62+
capabilities:
63+
drop:
64+
- ALL
65+
seccompProfile:
66+
type: RuntimeDefault
5867
# -- Optional Configure kubernetes scheduling affinity for the created JuiceShops (see: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity)
5968
affinity: {}
6069
# -- Optional Configure kubernetes toleration for the created JuiceShops (see: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/)
@@ -129,6 +138,11 @@ wrongsecrets:
129138
allowPrivilegeEscalation: false
130139
readOnlyRootFilesystem: true
131140
runAsNonRoot: true
141+
capabilities:
142+
drop:
143+
- ALL
144+
seccompProfile:
145+
type: RuntimeDefault
132146
# -- Optional environment variables to set for each JuiceShop instance (see: https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/)
133147
env:
134148
- name: K8S_ENV
@@ -196,6 +210,11 @@ virtualdesktop:
196210
allowPrivilegeEscalation: false
197211
readOnlyRootFilesystem: true
198212
runAsNonRoot: true
213+
capabilities:
214+
drop:
215+
- ALL
216+
seccompProfile:
217+
type: RuntimeDefault
199218
runtimeClassName: {}
200219
affinity: {}
201220
# -- Optional mount environment variables from configMaps or secrets (see: https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/#configure-all-key-value-pairs-in-a-secret-as-container-environment-variables)
@@ -220,7 +239,15 @@ wrongsecretsCleanup:
220239
memory: 256Mi
221240
limits:
222241
memory: 256Mi
223-
securityContext: {}
242+
securityContext:
243+
allowPrivilegeEscalation: false
244+
readOnlyRootFilesystem: true
245+
runAsNonRoot: true
246+
capabilities:
247+
drop:
248+
- ALL
249+
seccompProfile:
250+
type: RuntimeDefault
224251
# -- Optional Configure kubernetes scheduling affinity for the wrongsecretsCleanup Job(see: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity)
225252
affinity: {}
226253
# -- Optional Configure kubernetes toleration for the wrongsecretsCleanup Job (see: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/)

wrongsecrets-balancer/src/kubernetes.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const createNameSpaceForTeam = async (team) => {
3434
},
3535
labels: {
3636
name: `t-${team}`,
37+
'pod-security.kubernetes.io/enforce': 'restricted',
3738
},
3839
};
3940
k8sCoreApi.createNamespace(namedNameSpace).catch((error) => {
@@ -131,6 +132,8 @@ const createK8sDeploymentForTeam = async ({ team, passcodeHash }) => {
131132
allowPrivilegeEscalation: false,
132133
readOnlyRootFilesystem: true,
133134
runAsNonRoot: true,
135+
capabilities: {drop: [ALL]},
136+
seccompProfile: {type: RuntimeDefault},
134137
},
135138
env: [
136139
{
@@ -385,6 +388,8 @@ const createAWSDeploymentForTeam = async ({ team, passcodeHash }) => {
385388
allowPrivilegeEscalation: false,
386389
readOnlyRootFilesystem: true,
387390
runAsNonRoot: true,
391+
capabilities: {drop: [ALL]},
392+
seccompProfile: {type: RuntimeDefault},
388393
},
389394
env: [
390395
{
@@ -1088,8 +1093,11 @@ const createDesktopDeploymentForTeam = async ({ team, passcodeHash }) => {
10881093
},
10891094
// resources: get('virtualdesktop.resources'),
10901095
securityContext: {
1091-
// allowPrivilegeEscalation: false,
1092-
// readOnlyRootFilesystem: true,
1096+
allowPrivilegeEscalation: false,
1097+
readOnlyRootFilesystem: true,
1098+
runAsNonRoot: true,
1099+
capabilities: {drop: [ALL]},
1100+
seccompProfile: {type: RuntimeDefault},
10931101
},
10941102
env: [...get('virtualdesktop.env', [])],
10951103
envFrom: get('virtualdesktop.envFrom'),

0 commit comments

Comments
 (0)