Skip to content

WIP [v7.x] Make BRO compliant with security best practices #768

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

Open
wants to merge 1 commit into
base: release/v7.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 11 additions & 0 deletions charts/rancher-backup/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ spec:
prometheus.io/scrape: "true"
{{ end }}
spec:
{{- if .Values.securityContext.runAsNonRoot }}
securityContext:
fsGroup: 1000
{{- end }}
serviceAccountName: {{ include "backupRestore.serviceAccountName" . }}
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
Expand All @@ -36,6 +40,13 @@ spec:
- name: {{ .Chart.Name }}
image: {{ template "system_default_registry" . }}{{ .Values.image.repository }}:{{ .Values.image.tag }}
imagePullPolicy: {{ default "Always" .Values.imagePullPolicy }}
securityContext:
allowPrivilegeEscalation: false
{{- if .Values.securityContext.runAsNonRoot }}
runAsNonRoot: true
runAsUser: 1000
runAsGroup: 1000
{{- end }}
ports:
- containerPort: 8080
args:
Expand Down
6 changes: 6 additions & 0 deletions charts/rancher-backup/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,9 @@ monitoring:
additionalLabels: {}
metricRelabelings: []
relabelings: []

securityContext:
## When persisting backup files to a PVC of type HostPath, set securityContext.runAsNonRoot to false.
## Only processes running as 'root' can write to HostPath PVCs so Backups will fail in that scenario if not running as 'root'.
## However, this goes against Kubernetes security best practices and should be avoided whenever possible.
runAsNonRoot: true
Loading