Skip to content

Commit 9c683ca

Browse files
authored
fix(helm): remove privileged:true from dataplane and init containers (#1050)
Drop privileged security context from the dataplane container, sysctl-setup init container, and mount-bpffs init container. Replace with least-privilege capability sets: NET_BIND_SERVICE for the dataplane, NET_ADMIN+SYS_ADMIN for sysctl-setup (needs sysctl writes), and SYS_ADMIN for mount-bpffs (needs mount). All containers now drop ALL capabilities and only add what they need. Fixes #1035
1 parent 6674797 commit 9c683ca

1 file changed

Lines changed: 17 additions & 5 deletions

File tree

charts/novaedge/templates/agent-daemonset.yaml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,13 @@ spec:
6161
echo 1 > /proc/sys/net/ipv4/conf/all/route_localnet
6262
echo "route_localnet enabled for mesh DNAT"
6363
securityContext:
64-
privileged: true
64+
allowPrivilegeEscalation: false
65+
capabilities:
66+
drop:
67+
- ALL
68+
add:
69+
- NET_ADMIN
70+
- SYS_ADMIN
6571
{{- end }}
6672
{{- if .Values.agent.ebpf.enabled }}
6773
- name: mount-bpffs
@@ -76,7 +82,12 @@ spec:
7682
fi
7783
mkdir -p /sys/fs/bpf/novaedge
7884
securityContext:
79-
privileged: true
85+
allowPrivilegeEscalation: false
86+
capabilities:
87+
drop:
88+
- ALL
89+
add:
90+
- SYS_ADMIN
8091
volumeMounts:
8192
- name: bpffs
8293
mountPath: /sys/fs/bpf
@@ -218,11 +229,12 @@ spec:
218229
hostPort: {{ .Values.agent.ports.https | default 443 }}
219230
protocol: TCP
220231
securityContext:
221-
privileged: true
232+
allowPrivilegeEscalation: false
222233
capabilities:
234+
drop:
235+
- ALL
223236
add:
224-
- NET_ADMIN
225-
- NET_RAW
237+
- NET_BIND_SERVICE
226238
readinessProbe:
227239
exec:
228240
command:

0 commit comments

Comments
 (0)