Skip to content

Commit 23db884

Browse files
committed
Feat(#199): hardening cleaner, making desktop a little better
1 parent 6891d26 commit 23db884

File tree

3 files changed

+28
-17
lines changed

3 files changed

+28
-17
lines changed

helm/wrongsecrets-ctf-party/templates/cleanup/cron-job.yaml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,22 @@ spec:
2020
helm.sh/chart: {{ include "wrongsecrets-ctf-party.chart" . }}
2121
spec:
2222
serviceAccountName: 'wrongsecrets-cleaner'
23-
{{- with .Values.wrongsecretsCleanup.securityContext }}
2423
securityContext:
25-
{{- toYaml . | nindent 12 }}
26-
{{- end }}
24+
runAsUser: 1000
25+
runAsGroup: 3000
26+
fsGroup: 2000
2727
containers:
2828
- image: '{{ .Values.wrongsecretsCleanup.repository }}:{{ .Values.wrongsecretsCleanup.tag | default (printf "v%s" .Chart.Version) }}'
2929
imagePullPolicy: {{ .Values.imagePullPolicy | quote }}
30+
securityContext:
31+
allowPrivilegeEscalation: false
32+
readOnlyRootFilesystem: true
33+
runAsNonRoot: true
34+
capabilities:
35+
drop:
36+
- ALL
37+
seccompProfile:
38+
type: RuntimeDefault
3039
name: 'cleanup-job'
3140
env:
3241
- name: NAMESPACE

helm/wrongsecrets-ctf-party/values.yaml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ virtualdesktop:
221221
runtimeClassName: {}
222222
affinity: {}
223223
# -- 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)
224+
224225
envFrom: []
225226
tolerations: []
226227

@@ -242,15 +243,6 @@ wrongsecretsCleanup:
242243
memory: 256Mi
243244
limits:
244245
memory: 256Mi
245-
securityContext:
246-
allowPrivilegeEscalation: false
247-
readOnlyRootFilesystem: true
248-
runAsNonRoot: true
249-
capabilities:
250-
drop:
251-
- ALL
252-
seccompProfile:
253-
type: RuntimeDefault
254246
# -- Optional Configure kubernetes scheduling affinity for the wrongsecretsCleanup Job(see: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity)
255247
affinity: {}
256248
# -- 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: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const createNameSpaceForTeam = async (team) => {
3535
labels: {
3636
name: `t-${team}`,
3737
'pod-security.kubernetes.io/audit': 'restricted',
38-
'pod-security.kubernetes.io/enforce': 'baseline',
38+
// 'pod-security.kubernetes.io/enforce': 'baseline',
3939
},
4040
};
4141
k8sCoreApi.createNamespace(namedNameSpace).catch((error) => {
@@ -1097,15 +1097,25 @@ const createDesktopDeploymentForTeam = async ({ team, passcodeHash }) => {
10971097
'ephemeral-storage': '8Gi',
10981098
},
10991099
},
1100-
// resources: get('virtualdesktop.resources'),
1100+
// // resources: get('virtualdesktop.resources'),
11011101
securityContext: {
11021102
allowPrivilegeEscalation: true,
11031103
readOnlyRootFilesystem: false,
11041104
runAsNonRoot: false,
1105-
capabilities: { drop: ['ALL'], add:['CAP_SETGID','CAP_SETUID','CAP_CHOWN'] },
1106-
seccompProfile: { type: 'Unconfined' },
1105+
// capabilities: { drop: ['ALL'], add:['CAP_SETGID','CAP_SETUID','CAP_CHOWN'] },
1106+
seccompProfile: { type: 'RuntimeDefault' },
11071107
},
1108-
env: [...get('virtualdesktop.env', [])],
1108+
env: [
1109+
{
1110+
name: 'PUID',
1111+
value: '1000',
1112+
},
1113+
{
1114+
name: 'PGID',
1115+
value: '1000',
1116+
},
1117+
...get('virtualdesktop.env', [])
1118+
],
11091119
envFrom: get('virtualdesktop.envFrom'),
11101120
ports: [
11111121
{

0 commit comments

Comments
 (0)