Skip to content

Commit 5b68506

Browse files
authored
fix(helm): make DNS egress rule platform-agnostic (#80)
The DNS egress rule targeted kube-dns pods in kube-system via namespaceSelector+podSelector. On OpenShift, DNS pods live in openshift-dns, so the rule never matched and OVN-Kubernetes blocked all DNS queries from the OneCLI pod. Remove the namespace/label restriction and allow port 53 to any destination. DNS is not an SSRF vector, and restricting it by platform- specific labels is fragile. Also remove redundant DNS ports from the serviceCIDR ipBlock rule. Signed-off-by: Tomas Pilar <thomas7pilar@gmail.com>
1 parent 5b32090 commit 5b68506

1 file changed

Lines changed: 5 additions & 18 deletions

File tree

deploy/helm/humr/templates/onecli/networkpolicy.yaml

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
effectively turning the proxy into an SSRF gadget.
99

1010
This policy allows only:
11-
- DNS to kube-system (kube-dns / coredns)
11+
- DNS (port 53, any destination — platform-agnostic)
1212
- In-cluster Postgres and Keycloak (by component label)
1313
- The public internet (0.0.0.0/0 with cluster CIDRs and link-local excepted)
1414

@@ -33,19 +33,10 @@ spec:
3333
policyTypes:
3434
- Egress
3535
egress:
36-
# DNS — kube-dns / coredns pods only (not all of kube-system).
37-
# The `k8s-app: kube-dns` label is the standard used by both kube-dns and
38-
# CoreDNS across k3s, kubeadm, EKS, GKE, AKS.
39-
# NB: namespaceSelector and podSelector are in the SAME peer entry (no `-`
40-
# before podSelector) so they AND. Listing them as separate peers would OR.
41-
- to:
42-
- namespaceSelector:
43-
matchLabels:
44-
kubernetes.io/metadata.name: kube-system
45-
podSelector:
46-
matchLabels:
47-
k8s-app: kube-dns
48-
ports:
36+
# DNS — allow port 53 to any destination. Restricting by
37+
# namespace/label is fragile across platforms (kube-system on vanilla k8s,
38+
# openshift-dns on OCP) and DNS is not an SSRF vector.
39+
- ports:
4940
- protocol: UDP
5041
port: 53
5142
- protocol: TCP
@@ -92,10 +83,6 @@ spec:
9283
- protocol: TCP
9384
port: {{ .Values.keycloak.port }}
9485
{{- end }}
95-
- protocol: UDP
96-
port: 53
97-
- protocol: TCP
98-
port: 53
9986
{{- end }}
10087

10188
# Public internet — everything except private/special-use ranges

0 commit comments

Comments
 (0)