Skip to content

Commit

Permalink
Update init containers to be PSS compliant
Browse files Browse the repository at this point in the history
Description:
- Enforce initContainers to be compliant when PSS is set to restricted
- As part of #1883
  • Loading branch information
nimalank7 committed Oct 2, 2024
1 parent 56dddfa commit 89b02e0
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 8 deletions.
2 changes: 2 additions & 0 deletions charts/db-backup/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ securityContext:
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 1001
seccompProfile:
type: RuntimeDefault

serviceAccount:
create: true
Expand Down
9 changes: 6 additions & 3 deletions charts/generic-govuk-app/templates/assets-upload-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,13 @@ spec:
- name: assets-to-upload
mountPath: /assets-to-upload
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
allowPrivilegeEscalation: {{ .Values.securityContext.allowPrivilegeEscalation | default "false" }}
runAsNonRoot: {{ .Values.securityContext.runAsNonRoot | default "true" }}
readOnlyRootFilesystem: {{ .Values.securityContext.readOnlyRootFilesystem | default "true" }}
seccompProfile:
type: RuntimeDefault
capabilities:
drop: ["ALL"]
drop: {{ .Values.securityContext.capabilities.drop }}
containers:
- name: upload-assets
image: 172025368201.dkr.ecr.eu-west-1.amazonaws.com/github/alphagov/govuk/toolbox:latest
Expand Down
13 changes: 11 additions & 2 deletions charts/generic-govuk-app/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ spec:
volumeMounts:
- name: assets
mountPath: /assets
securityContext:
allowPrivilegeEscalation: {{ .Values.securityContext.allowPrivilegeEscalation | default "false" }}
runAsNonRoot: {{ .Values.securityContext.runAsNonRoot | default "true" }}
readOnlyRootFilesystem: {{ .Values.securityContext.readOnlyRootFilesystem | default "true" }}
seccompProfile:
type: RuntimeDefault
capabilities:
drop: {{ .Values.securityContext.capabilities.drop }}

{{- end }}
containers:
- name: app
Expand Down Expand Up @@ -127,9 +136,9 @@ spec:
{{- end }}
securityContext:
allowPrivilegeEscalation: {{ .Values.securityContext.allowPrivilegeEscalation }}
readOnlyRootFilesystem: true
readOnlyRootFilesystem: {{ .Values.securityContext.readOnlyRootFileSystem }}
capabilities:
drop: ["ALL"]
drop: {{ .Values.securityContext.capabilities.drop }}
volumeMounts:
- name: app-tmp
mountPath: /tmp
Expand Down
3 changes: 3 additions & 0 deletions charts/generic-govuk-app/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ securityContext:
allowPrivilegeEscalation: false
runAsUser: 1001
runAsGroup: 1001
readOnlyRootFilesystem: true
capabilities:
drop: ["ALL"]

sentry:
enabled: true
Expand Down
9 changes: 7 additions & 2 deletions charts/govuk-jobs/templates/govuk-mirror-sync-cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,13 @@ spec:
cpu: 2
memory: 15000Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
allowPrivilegeEscalation: {{ .Values.securityContext.allowPrivilegeEscalation | default "false" }}
runAsNonRoot: {{ .Values.securityContext.runAsNonRoot | default "true" }}
readOnlyRootFilesystem: {{ .Values.securityContext.readOnlyRootFilesystem | default "true" }}
seccompProfile:
type: RuntimeDefault
capabilities:
drop: {{ .Values.securityContext.capabilities.drop }}
volumeMounts:
- name: app-mirror-sync
mountPath: /data
Expand Down
2 changes: 1 addition & 1 deletion charts/govuk-jobs/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ podSecurityContext:
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: [ALL]
drop: ["ALL"]
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 1001
Expand Down

0 comments on commit 89b02e0

Please sign in to comment.