Skip to content

Commit

Permalink
Harden the deployment and the profilebundle
Browse files Browse the repository at this point in the history
Drops caps and makes both run as non-root explicitly to suppress
warnings from PSA.
  • Loading branch information
jhrozek authored and rhmdnd committed Oct 12, 2023
1 parent bfdf204 commit 6206b85
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,11 @@ spec:
memory: 20Mi
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
volumeMounts:
- mountPath: /var/run/secrets/serving-cert
name: serving-cert
Expand Down
3 changes: 3 additions & 0 deletions config/manager/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ spec:
securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
runAsNonRoot: true
capabilities:
drop: ["ALL"]
resources:
requests:
memory: "20Mi"
Expand Down
6 changes: 6 additions & 0 deletions pkg/controller/profilebundle/profilebundle_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ func (r *ReconcileProfileBundle) newWorkloadForBundle(pb *compliancev1alpha1.Pro
SecurityContext: &corev1.SecurityContext{
AllowPrivilegeEscalation: &falseP,
ReadOnlyRootFilesystem: &trueP,
RunAsNonRoot: &trueP,
Capabilities: &corev1.Capabilities{
Drop: []corev1.Capability{"ALL"},
},
Expand Down Expand Up @@ -466,6 +467,7 @@ func (r *ReconcileProfileBundle) newWorkloadForBundle(pb *compliancev1alpha1.Pro
SecurityContext: &corev1.SecurityContext{
AllowPrivilegeEscalation: &falseP,
ReadOnlyRootFilesystem: &trueP,
RunAsNonRoot: &trueP,
Capabilities: &corev1.Capabilities{
Drop: []corev1.Capability{"ALL"},
},
Expand Down Expand Up @@ -502,6 +504,10 @@ func (r *ReconcileProfileBundle) newWorkloadForBundle(pb *compliancev1alpha1.Pro
SecurityContext: &corev1.SecurityContext{
AllowPrivilegeEscalation: &falseP,
ReadOnlyRootFilesystem: &trueP,
RunAsNonRoot: &trueP,
Capabilities: &corev1.Capabilities{
Drop: []corev1.Capability{"ALL"},
},
},
Command: []string{
"/bin/sh", "-c",
Expand Down

0 comments on commit 6206b85

Please sign in to comment.