Skip to content

Commit bedb645

Browse files
committed
Add readOnlyRootFilesystem=true to containers missing it
readOnlyRootFilesystem prevents containers from writing to the root filesystem, reducing attack surface and improving security posture by limiting potential malicious file modifications and ensuring immutable container runtime. allowPrivilegeEscalation=false prevents containers from gaining additional privileges beyond those initially granted, further hardening the security posture by blocking privilege escalation attacks. Signed-off-by: Carlos Goncalves <[email protected]>
1 parent abcc305 commit bedb645

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

bindata/linuxptp/ptp-daemon.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ spec:
3636
- name: cloud-event-proxy
3737
image: {{ .SideCar }}
3838
imagePullPolicy: IfNotPresent
39+
securityContext:
40+
readOnlyRootFilesystem: true
41+
allowPrivilegeEscalation: false
3942
args:
4043
- "--metrics-addr=127.0.0.1:9091"
4144
- "--store-path=/store"
@@ -69,6 +72,9 @@ spec:
6972
- name: kube-rbac-proxy
7073
image: {{.KubeRbacProxy}}
7174
imagePullPolicy: IfNotPresent
75+
securityContext:
76+
readOnlyRootFilesystem: true
77+
allowPrivilegeEscalation: false
7278
args:
7379
- --logtostderr
7480
- --secure-listen-address=:8443
@@ -92,6 +98,7 @@ spec:
9298
- name: linuxptp-daemon-container
9399
securityContext:
94100
privileged: true
101+
readOnlyRootFilesystem: true
95102
image: {{.Image}}
96103
imagePullPolicy: IfNotPresent
97104
command: [ "/bin/bash", "-c", "--" ]

config/default/manager_auth_proxy_patch.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ spec:
1111
containers:
1212
- name: kube-rbac-proxy
1313
image: quay.io/openshift/origin-kube-rbac-proxy:4.15
14+
securityContext:
15+
readOnlyRootFilesystem: true
16+
allowPrivilegeEscalation: false
1417
args:
1518
- "--secure-listen-address=0.0.0.0:8443"
1619
- "--upstream=http://127.0.0.1:8080/"
@@ -21,6 +24,9 @@ spec:
2124
- containerPort: 8443
2225
name: https
2326
- name: manager
27+
securityContext:
28+
readOnlyRootFilesystem: true
29+
allowPrivilegeEscalation: false
2430
args:
2531
- "--health-probe-bind-address=:8081"
2632
- "--metrics-bind-address=127.0.0.1:8080"

config/default/manager_webhook_patch.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ spec:
1010
spec:
1111
containers:
1212
- name: ptp-operator
13+
securityContext:
14+
readOnlyRootFilesystem: true
15+
allowPrivilegeEscalation: false
1316
ports:
1417
- containerPort: 9443
1518
name: webhook-server

config/manager/manager.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ spec:
4545
image: controller
4646
command:
4747
- ptp-operator
48+
securityContext:
49+
readOnlyRootFilesystem: true
50+
allowPrivilegeEscalation: false
4851
args:
4952
- --enable-leader-election
5053
- --logtostderr

0 commit comments

Comments
 (0)