Skip to content

Commit

Permalink
Set SCC's RunAsUser as MustRunAsRange
Browse files Browse the repository at this point in the history
Upstream Helm Chart is removing explicit `runAsUser` value from the
Deployment and DaemonSet resources. This practically means the UID
will be inherited from image's Dockerfile.

Users on vanilla Kubernetes clusters will not observe a change in
behavior, unless they have exotic configurations.

However, OpenShift does have additional security measures. It suggests
using randomized UIDs/GIDs for workloads. To enable this, the custom
Security Context Constraint resources are being updated.
The `MustRunAsRange` policy is utilized with pre-allocated values
(no explicit range min/max), which effectively allows OpenShift to
pick its own ranges.
  • Loading branch information
sigv committed Mar 26, 2024
1 parent 9a168a5 commit 4b7ead3
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 9 deletions.
2 changes: 0 additions & 2 deletions helm-charts/nginx-ingress/templates/controller-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ spec:
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: {{ .Values.controller.readOnlyRootFilesystem }}
runAsUser: 101 #nginx
runAsNonRoot: true
capabilities:
drop:
Expand Down Expand Up @@ -153,7 +152,6 @@ spec:
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsUser: 101 #nginx
runAsNonRoot: true
capabilities:
drop:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ spec:
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: {{ .Values.controller.readOnlyRootFilesystem }}
runAsUser: 101 #nginx
runAsNonRoot: true
capabilities:
drop:
Expand Down Expand Up @@ -160,7 +159,6 @@ spec:
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsUser: 101 #nginx
runAsNonRoot: true
capabilities:
drop:
Expand Down
1 change: 0 additions & 1 deletion helm-charts/nginx-ingress/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ controller:
securityContext: {} # Remove curly brackets before adding values
# allowPrivilegeEscalation: true
# readOnlyRootFilesystem: true
# runAsUser: 101 #nginx
# runAsNonRoot: true
# capabilities:
# drop:
Expand Down
3 changes: 1 addition & 2 deletions resources/scc-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ metadata:
name: nginx-ingress-admin
allowPrivilegedContainer: false
runAsUser:
type: MustRunAs
uid: 101
type: MustRunAsRange
seLinuxContext:
type: MustRunAs
fsGroup:
Expand Down
3 changes: 1 addition & 2 deletions resources/scc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ metadata:
name: nginx-ingress-admin
allowPrivilegedContainer: false
runAsUser:
type: MustRunAs
uid: 101
type: MustRunAsRange
seLinuxContext:
type: MustRunAs
fsGroup:
Expand Down

0 comments on commit 4b7ead3

Please sign in to comment.