PeerAuthentication
mTLS-Modus zwischen Sidecars. STRICT,
PERMISSIVE, DISABLE. Geltung: Mesh (in
istio-system), Namespace, oder Workload via
selector. Migration zu STRICT: zuerst
Mesh-weit PERMISSIVE, dann namespace-weise umstellen.
apiVersion: security.istio.io/v1
kind: PeerAuthentication
metadata: {name: default, namespace: prod}
spec:
mtls: {mode: STRICT}
---
# Port-Ausnahme (Container-Port): NLB-Health-Check ohne mTLS
apiVersion: security.istio.io/v1
kind: PeerAuthentication
metadata: {name: legacy, namespace: prod}
spec:
selector: {matchLabels: {app: legacy}}
mtls: {mode: STRICT}
portLevelMtls:
8080: {mode: PERMISSIVE}
AuthorizationPolicy
L7-Zugriffskontrolle. Auswertung CUSTOM →
DENY → ALLOW, AUDIT
entscheidet nichts. Gibt es ALLOW-Policies, muss eine matchen, sonst
Deny. Ohne rules matcht eine Policy nie: ALLOW ohne
rules = deny-all, rules: [{}] = allow-all. Regeln OR,
from/to/when je Regel AND.
apiVersion: security.istio.io/v1
kind: AuthorizationPolicy
metadata: {name: reviews-allow, namespace: prod}
spec:
selector: {matchLabels: {app: reviews}}
action: ALLOW
rules:
- from:
- source:
principals:
- cluster.local/ns/prod/sa/productpage
to:
- operation:
methods: [GET]
paths: ["/reviews/*"]
when:
- key: request.auth.claims[groups]
values: ["reader", "admin"]
RequestAuthentication (JWT)
Validiert JWT, füllt request.auth.* für
AuthorizationPolicy. Wichtig: ohne zusätzliche
DENY-Policy mit notRequestPrincipals=["*"] können
unauthentifizierte Requests weiterhin durch.
apiVersion: security.istio.io/v1
kind: RequestAuthentication
metadata: {name: jwt, namespace: prod}
spec:
selector: {matchLabels: {app: api}}
jwtRules:
- issuer: "https://auth.example.com"
jwksUri: "https://auth.example.com/jwks"
audiences: ["api.example.com"]
forwardOriginalToken: true
Identity
SPIFFE-URI spiffe://<trust>/ns/<ns>/sa/<sa>.
Trust-Domain default cluster.local, im
Multi-Cluster-Mesh in allen Clustern gleich (eindeutig ist
multiCluster.clusterName). Workload-Cert: 24 h
Laufzeit (SECRET_TTL), istio-agent erneuert bei
50 % (SECRET_GRACE_PERIOD_RATIO) per CSR an
istiod.