Files
bakery-ia/infrastructure/platform/security/network-policies/allow-notification-to-mailu.yaml

60 lines
1.7 KiB
YAML
Raw Normal View History

2026-01-26 07:33:38 +01:00
# Network Policy to allow notification service to send emails via Mailu
2026-01-26 07:57:18 +01:00
# This policy allows egress from notification-service to mailu-front on SMTP port 25
2026-01-26 07:33:38 +01:00
#
2026-01-26 07:57:18 +01:00
# NOTE: Mailu is configured with TLS_FLAVOR: "notls" and subnet: "10.1.0.0/16"
# This allows unauthenticated relay from trusted pod network on port 25
# mailu-front (nginx) handles SMTP and proxies to postfix internally
2026-01-26 07:33:38 +01:00
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-notification-to-mailu-smtp
namespace: bakery-ia
labels:
app: notification-service
component: network-policy
tier: security
spec:
podSelector:
matchLabels:
app: notification-service
policyTypes:
- Egress
egress:
2026-01-26 07:57:18 +01:00
# Allow SMTP traffic to mailu-front (port 25, no TLS)
2026-01-26 07:33:38 +01:00
- to:
- podSelector:
matchLabels:
app.kubernetes.io/instance: mailu
2026-01-26 07:57:18 +01:00
app.kubernetes.io/component: front
2026-01-26 07:33:38 +01:00
ports:
- port: 25
protocol: TCP
---
2026-01-26 07:57:18 +01:00
# Allow ingress TO mailu-front FROM any pod in bakery-ia namespace
2026-01-26 07:33:38 +01:00
# This is needed because mailu-allow-internal only allows traffic from mailu pods
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-mailu-smtp-from-apps
namespace: bakery-ia
labels:
app: mailu
component: network-policy
tier: security
spec:
podSelector:
matchLabels:
app.kubernetes.io/instance: mailu
2026-01-26 07:57:18 +01:00
app.kubernetes.io/component: front
2026-01-26 07:33:38 +01:00
policyTypes:
- Ingress
ingress:
# Allow SMTP from any pod in bakery-ia namespace
- from:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: bakery-ia
ports:
- port: 25
protocol: TCP