Skip to content

Commit

Permalink
harden securityContext definitions on container level
Browse files Browse the repository at this point in the history
Signed-off-by: Raul Garcia Sanchez <[email protected]>
  • Loading branch information
rgarcia89 committed Jan 3, 2024
1 parent 7f748f8 commit 9f1397e
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 0 deletions.
6 changes: 6 additions & 0 deletions templates/core/core-dpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ spec:
- name: core
image: {{ .Values.core.image.repository }}:{{ .Values.core.image.tag }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
securityContext:
privileged: false
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
{{- if .Values.core.startupProbe.enabled }}
startupProbe:
httpGet:
Expand Down
6 changes: 6 additions & 0 deletions templates/exporter/exporter-dpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ spec:
- name: exporter
image: {{ .Values.exporter.image.repository }}:{{ .Values.exporter.image.tag }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
securityContext:
privileged: false
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
livenessProbe:
httpGet:
path: /
Expand Down
6 changes: 6 additions & 0 deletions templates/jobservice/jobservice-dpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ spec:
- name: jobservice
image: {{ .Values.jobservice.image.repository }}:{{ .Values.jobservice.image.tag }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
securityContext:
privileged: false
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
livenessProbe:
httpGet:
path: /api/v1/stats
Expand Down
6 changes: 6 additions & 0 deletions templates/nginx/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ spec:
- name: nginx
image: "{{ .Values.nginx.image.repository }}:{{ .Values.nginx.image.tag }}"
imagePullPolicy: "{{ .Values.imagePullPolicy }}"
securityContext:
privileged: false
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
{{- $_ := set . "scheme" "HTTP" -}}
{{- $_ := set . "port" "8080" -}}
{{- if .Values.expose.tls.enabled }}
Expand Down
6 changes: 6 additions & 0 deletions templates/portal/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ spec:
- name: portal
image: {{ .Values.portal.image.repository }}:{{ .Values.portal.image.tag }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
securityContext:
privileged: false
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
{{- if .Values.portal.resources }}
resources:
{{ toYaml .Values.portal.resources | indent 10 }}
Expand Down
12 changes: 12 additions & 0 deletions templates/registry/registry-dpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ spec:
- name: registry
image: {{ .Values.registry.registry.image.repository }}:{{ .Values.registry.registry.image.tag }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
securityContext:
privileged: false
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
livenessProbe:
httpGet:
path: /
Expand Down Expand Up @@ -204,6 +210,12 @@ spec:
- name: registryctl
image: {{ .Values.registry.controller.image.repository }}:{{ .Values.registry.controller.image.tag }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
securityContext:
privileged: false
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
livenessProbe:
httpGet:
path: /api/health
Expand Down
3 changes: 3 additions & 0 deletions templates/trivy/trivy-sts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ spec:
securityContext:
privileged: false
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
env:
{{- if has "trivy" .Values.proxy.components }}
- name: HTTP_PROXY
Expand Down

0 comments on commit 9f1397e

Please sign in to comment.