fix(authentik): scope authentik-postgresql NetworkPolicy to internal access
Auto-Deploy on Push / verify-and-notify (push) Canceled after 0s
Auto-Deploy on Push / verify-and-notify (push) Canceled after 0s
Closes issue #37. The Bitnami postgresql subchart's auto-generated NetworkPolicy restricted the port (5432) but not the source - any pod in any namespace could reach it, since additive NetworkPolicy rules can't restrict an existing permissive one, only the chart itself controls it (hence not touched during the original #10 rollout). Disabled via postgresql.primary.networkPolicy.enabled: false and replaced with a scoped policy allowing only authentik-server and authentik-worker (same namespace) on 5432, matching the pattern already used for the matrix namespace's postgres access. No metrics exporter is enabled for this instance, so no monitoring-namespace rule is needed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
c52ff97502
commit
e54ec10fd9
@@ -98,3 +98,8 @@ spec:
|
|||||||
memory: 256Mi
|
memory: 256Mi
|
||||||
limits:
|
limits:
|
||||||
memory: 512Mi
|
memory: 512Mi
|
||||||
|
# Chart's own generated policy allows ANY pod in ANY namespace on 5432
|
||||||
|
# (see issue #37) - disabled in favor of our own scoped policy in
|
||||||
|
# apps/authentik/networkpolicy.yaml.
|
||||||
|
networkPolicy:
|
||||||
|
enabled: false
|
||||||
|
|||||||
@@ -4,9 +4,10 @@
|
|||||||
# for upstream OIDC calls. Egress is intentionally untouched (federation-equivalent
|
# for upstream OIDC calls. Egress is intentionally untouched (federation-equivalent
|
||||||
# outbound calls like SMTP aren't restricted here).
|
# outbound calls like SMTP aren't restricted here).
|
||||||
#
|
#
|
||||||
# Note: authentik-postgresql already has its own NetworkPolicy from the Bitnami
|
# authentik-postgresql: the Bitnami postgresql subchart's own generated NetworkPolicy
|
||||||
# postgresql subchart (port 5432, no source restriction) - left alone, not duplicated,
|
# restricted the port (5432) but not the source - any pod in any namespace could reach
|
||||||
# since it would get reset on the next Helm upgrade anyway.
|
# it (issue #37). Disabled via postgresql.primary.networkPolicy.enabled: false in
|
||||||
|
# authentik.yaml and replaced below with a policy scoped to authentik-server/-worker.
|
||||||
apiVersion: networking.k8s.io/v1
|
apiVersion: networking.k8s.io/v1
|
||||||
kind: NetworkPolicy
|
kind: NetworkPolicy
|
||||||
metadata:
|
metadata:
|
||||||
@@ -47,6 +48,32 @@ spec:
|
|||||||
---
|
---
|
||||||
apiVersion: networking.k8s.io/v1
|
apiVersion: networking.k8s.io/v1
|
||||||
kind: NetworkPolicy
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: allow-ingress-authentik-postgresql
|
||||||
|
namespace: authentik
|
||||||
|
spec:
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: postgresql
|
||||||
|
app.kubernetes.io/component: primary
|
||||||
|
policyTypes:
|
||||||
|
- Ingress
|
||||||
|
ingress:
|
||||||
|
- from:
|
||||||
|
- podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: authentik
|
||||||
|
app.kubernetes.io/component: server
|
||||||
|
- podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: authentik
|
||||||
|
app.kubernetes.io/component: worker
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 5432
|
||||||
|
---
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
metadata:
|
metadata:
|
||||||
name: allow-ingress-acme-solver
|
name: allow-ingress-acme-solver
|
||||||
namespace: authentik
|
namespace: authentik
|
||||||
|
|||||||
Reference in New Issue
Block a user