|
| 1 | +# Default-deny EGRESS for the operator, with explicit allows. This is the network-layer |
| 2 | +# half of the remoteControl.endpoint SSRF defense (issue #299); the app layer is the |
| 3 | +# --remote-control-allowed-endpoint-hosts / --prometheus-allowed-endpoint-hosts flags. |
| 4 | +# The Helm chart ships the same policy behind `networkPolicy.enable` (dist/chart) with |
| 5 | +# per-CR port values; this is the parity resource for the kustomize base. |
| 6 | +# |
| 7 | +# OPT-IN: the whole config/network-policy bundle is disabled by default (uncomment |
| 8 | +# `- ../network-policy` in config/default/kustomization.yaml to enable). It needs a CNI |
| 9 | +# that ENFORCES NetworkPolicy (Calico/Cilium) — Kind's default kindnet does NOT enforce it, |
| 10 | +# so this is inert on the e2e cluster. |
| 11 | +# |
| 12 | +# ⚠ SSRF NOTE: the gNB/Prometheus rules below allow those PORTS to ANY destination, which |
| 13 | +# does NOT stop the operator from dialing an arbitrary host on that port. To actually close |
| 14 | +# the probing surface, DELETE the port-only gNB rule and instead scope the port to your |
| 15 | +# sanctioned gNB subnet with a `to: [ipBlock: {cidr: ...}]` block (see the commented example). |
| 16 | +apiVersion: networking.k8s.io/v1 |
| 17 | +kind: NetworkPolicy |
| 18 | +metadata: |
| 19 | + labels: |
| 20 | + app.kubernetes.io/name: ntn-operators |
| 21 | + app.kubernetes.io/managed-by: kustomize |
| 22 | + name: allow-egress-traffic |
| 23 | + namespace: system |
| 24 | +spec: |
| 25 | + podSelector: |
| 26 | + matchLabels: |
| 27 | + control-plane: controller-manager |
| 28 | + app.kubernetes.io/name: ntn-operators |
| 29 | + policyTypes: |
| 30 | + - Egress |
| 31 | + egress: |
| 32 | + # HTTPS 443: Kubernetes API server + CelesTrak + Space-Track (GP-data fetch). |
| 33 | + - ports: |
| 34 | + - port: 443 |
| 35 | + protocol: TCP |
| 36 | + # DNS resolution. |
| 37 | + - ports: |
| 38 | + - port: 53 |
| 39 | + protocol: TCP |
| 40 | + - port: 53 |
| 41 | + protocol: UDP |
| 42 | + # In-cluster Prometheus queried by NTNSlice.spec.metricsSource.prometheus (default 9090). |
| 43 | + # Remove if no NTNSlice uses a prometheus metricsSource. |
| 44 | + - ports: |
| 45 | + - port: 9090 |
| 46 | + protocol: TCP |
| 47 | + # gNB remote_control WebSocket targeted by NTNCellConfig.spec.provider.remoteControl.endpoint |
| 48 | + # (default 8001). Remove if no NTNCellConfig configures a runtime push. See the SSRF note |
| 49 | + # above: to bound WHERE the push may connect, replace this port-only rule with a scoped one: |
| 50 | + # - to: |
| 51 | + # - ipBlock: |
| 52 | + # cidr: 10.20.0.0/16 # your sanctioned gNB subnet |
| 53 | + # ports: |
| 54 | + # - port: 8001 |
| 55 | + # protocol: TCP |
| 56 | + - ports: |
| 57 | + - port: 8001 |
| 58 | + protocol: TCP |
| 59 | + # NOTE: the ground-station monitoring probe (GroundStationLifecycle.spec.monitoring.endpoint) |
| 60 | + # is another CR-controlled egress. If you use it on a non-443 port, add that port here (and |
| 61 | + # prefer a CIDR-scoped block, same as the gNB rule). |
0 commit comments