Skip to content

Commit f900b22

Browse files
authored
Merge pull request #317 from thc1006/feat/operator-egress-networkpolicy
feat(network-policy): opt-in operator egress NetworkPolicy for the kustomize base (#299)
2 parents a3401f7 + bec8412 commit f900b22

3 files changed

Lines changed: 74 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Security
1111

12+
- **The kustomize base now ships an opt-in default-deny egress NetworkPolicy for the operator (#299).**
13+
The Helm chart already restricts operator egress via `networkPolicy.enable`, but the kustomize base
14+
(`config/network-policy/`) only had the metrics *ingress* rule, so a non-Helm deployment had no
15+
egress control. `config/network-policy/allow-egress-traffic.yaml` adds the network-layer half of the
16+
`remoteControl.endpoint` SSRF defense: default-deny egress with explicit allows for DNS, HTTPS 443
17+
(API server / CelesTrak / Space-Track), and the per-CR Prometheus (9090) and gNB (8001) ports. It is
18+
part of the already opt-in `config/network-policy` bundle (disabled by default; needs a
19+
NetworkPolicy-enforcing CNI), so existing deployments are unchanged. The file documents that the
20+
port-only gNB rule must be replaced with a CIDR-scoped `to:` block to actually bound where the
21+
operator may dial — the app-layer `--remote-control-allowed-endpoint-hosts` allow-list is the
22+
complementary control.
23+
1224
- **Closed a residual Secret existence/type oracle in the `remoteControl.tls` credential path.** #219
1325
unified the CR-facing *message* for a `remoteControl.tls` resolution failure but not the *reason*: a
1426
missing/unreadable Secret classified as `ProviderPushFailed` (1 min requeue) while a present-but-bad
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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).
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
resources:
22
- allow-metrics-traffic.yaml
3+
- allow-egress-traffic.yaml

0 commit comments

Comments
 (0)