2026-03-02 09:49:39 +01:00
|
|
|
# NetworkPolicies for the mfa namespace (privacyIDEA)
|
|
|
|
|
#
|
|
|
|
|
# Allowed paths:
|
2026-03-21 09:37:38 +00:00
|
|
|
# INGRESS: Traefik (kube-system) → privacyIDEA :8080 (user-facing portal)
|
|
|
|
|
# INGRESS: KeyCape (sso) → privacyIDEA :8080 (Provider API calls)
|
2026-03-02 09:49:39 +01:00
|
|
|
# EGRESS: privacyIDEA → databases :5432 (PostgreSQL)
|
|
|
|
|
# EGRESS: all pods → kube-dns :53 (UDP+TCP)
|
|
|
|
|
#
|
|
|
|
|
# Everything else is denied.
|
|
|
|
|
|
|
|
|
|
# ── Default deny all ingress and egress ──────────────────────────────────────
|
|
|
|
|
apiVersion: networking.k8s.io/v1
|
|
|
|
|
kind: NetworkPolicy
|
|
|
|
|
metadata:
|
|
|
|
|
name: default-deny-all
|
|
|
|
|
namespace: mfa
|
|
|
|
|
spec:
|
|
|
|
|
podSelector: {}
|
|
|
|
|
policyTypes:
|
|
|
|
|
- Ingress
|
|
|
|
|
- Egress
|
|
|
|
|
---
|
|
|
|
|
# ── Allow ingress from Traefik ───────────────────────────────────────────────
|
2026-03-19 01:22:41 +00:00
|
|
|
# pink.coulomb.social and pink-account.coulomb.social both terminate at Traefik.
|
2026-03-02 09:49:39 +01:00
|
|
|
apiVersion: networking.k8s.io/v1
|
|
|
|
|
kind: NetworkPolicy
|
|
|
|
|
metadata:
|
|
|
|
|
name: allow-ingress-from-traefik
|
|
|
|
|
namespace: mfa
|
|
|
|
|
spec:
|
|
|
|
|
podSelector:
|
|
|
|
|
matchLabels:
|
|
|
|
|
app.kubernetes.io/name: privacyidea
|
|
|
|
|
policyTypes:
|
|
|
|
|
- Ingress
|
|
|
|
|
ingress:
|
|
|
|
|
- from:
|
|
|
|
|
- namespaceSelector:
|
|
|
|
|
matchLabels:
|
|
|
|
|
kubernetes.io/metadata.name: kube-system
|
|
|
|
|
podSelector:
|
|
|
|
|
matchLabels:
|
|
|
|
|
app.kubernetes.io/name: traefik
|
|
|
|
|
ports:
|
2026-03-21 09:37:38 +00:00
|
|
|
- port: 8080
|
2026-03-02 09:49:39 +01:00
|
|
|
protocol: TCP
|
|
|
|
|
---
|
2026-03-20 23:54:18 +00:00
|
|
|
# ── Allow ingress from KeyCape (Provider API calls) ──────────────────────────
|
2026-03-02 09:49:39 +01:00
|
|
|
apiVersion: networking.k8s.io/v1
|
|
|
|
|
kind: NetworkPolicy
|
|
|
|
|
metadata:
|
2026-03-20 23:54:18 +00:00
|
|
|
name: allow-ingress-from-keycape
|
2026-03-02 09:49:39 +01:00
|
|
|
namespace: mfa
|
|
|
|
|
spec:
|
|
|
|
|
podSelector:
|
|
|
|
|
matchLabels:
|
|
|
|
|
app.kubernetes.io/name: privacyidea
|
|
|
|
|
policyTypes:
|
|
|
|
|
- Ingress
|
|
|
|
|
ingress:
|
|
|
|
|
- from:
|
|
|
|
|
- namespaceSelector:
|
|
|
|
|
matchLabels:
|
|
|
|
|
net-kingdom/component: sso
|
|
|
|
|
podSelector:
|
|
|
|
|
matchLabels:
|
2026-03-20 23:54:18 +00:00
|
|
|
app.kubernetes.io/name: keycape
|
2026-03-02 09:49:39 +01:00
|
|
|
ports:
|
2026-03-21 09:37:38 +00:00
|
|
|
- port: 8080
|
2026-03-02 09:49:39 +01:00
|
|
|
protocol: TCP
|
|
|
|
|
---
|
|
|
|
|
# ── Allow egress to PostgreSQL ───────────────────────────────────────────────
|
|
|
|
|
apiVersion: networking.k8s.io/v1
|
|
|
|
|
kind: NetworkPolicy
|
|
|
|
|
metadata:
|
|
|
|
|
name: allow-egress-to-postgres
|
|
|
|
|
namespace: mfa
|
|
|
|
|
spec:
|
|
|
|
|
podSelector:
|
|
|
|
|
matchLabels:
|
|
|
|
|
app.kubernetes.io/name: privacyidea
|
|
|
|
|
policyTypes:
|
|
|
|
|
- Egress
|
|
|
|
|
egress:
|
|
|
|
|
- to:
|
|
|
|
|
- namespaceSelector:
|
|
|
|
|
matchLabels:
|
|
|
|
|
net-kingdom/component: databases
|
|
|
|
|
ports:
|
|
|
|
|
- port: 5432
|
|
|
|
|
protocol: TCP
|
|
|
|
|
---
|
|
|
|
|
# ── Allow egress DNS (all pods) ──────────────────────────────────────────────
|
|
|
|
|
apiVersion: networking.k8s.io/v1
|
|
|
|
|
kind: NetworkPolicy
|
|
|
|
|
metadata:
|
|
|
|
|
name: allow-egress-dns
|
|
|
|
|
namespace: mfa
|
|
|
|
|
spec:
|
|
|
|
|
podSelector: {}
|
|
|
|
|
policyTypes:
|
|
|
|
|
- Egress
|
|
|
|
|
egress:
|
|
|
|
|
- to:
|
|
|
|
|
- namespaceSelector:
|
|
|
|
|
matchLabels:
|
|
|
|
|
kubernetes.io/metadata.name: kube-system
|
|
|
|
|
ports:
|
|
|
|
|
- port: 53
|
|
|
|
|
protocol: UDP
|
|
|
|
|
- port: 53
|
|
|
|
|
protocol: TCP
|