Skip to content

feat(kubernetes): add Istio ambient mode ext-authz service#27

Open
jzills wants to merge 4 commits into
developfrom
feat/kubernetes-istio-ext-authz
Open

feat(kubernetes): add Istio ambient mode ext-authz service#27
jzills wants to merge 4 commits into
developfrom
feat/kubernetes-istio-ext-authz

Conversation

@jzills

@jzills jzills commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds services/HmacManager.Kubernetes/ — a containerized ASP.NET Core minimal API that acts as a centralized HMAC verification service for Kubernetes clusters running Istio in ambient mode
  • The Istio waypoint proxy calls POST /check before forwarding any inbound request; the service delegates to IHmacManager.VerifyAsync via the existing IHmacAuthenticationContextProvider
  • Includes Kubernetes deployment manifests and Istio configuration so teams can wire this up without writing custom integration code

Changes

  • services/HmacManager.Kubernetes/Program.cs — minimal API host with AddHmacManager DI registration and single /check endpoint
  • services/HmacManager.Kubernetes/ExtAuthzHandler.cs — reconstructs the original HttpRequestMessage from Envoy-forwarded headers (using x-forwarded-proto for scheme), then calls VerifyAsync; returns 200 on success or 403 on failure/unknown policy
  • services/HmacManager.Kubernetes/appsettings.json — sample policy config using the existing IConfigurationSection-based binding format
  • services/HmacManager.Kubernetes/Dockerfile — multi-stage build targeting net8.0
  • services/HmacManager.Kubernetes/deploy/mesh-config-patch.yaml — registers the service as an Envoy extensionProvider with withRequestBody enabled (required for full body-hash verification)
  • services/HmacManager.Kubernetes/deploy/authorization-policy.yamlAuthorizationPolicy targeting the namespace waypoint with action: CUSTOM
  • services/HmacManager.Kubernetes/deploy/deployment.yaml + service.yaml — standard K8s manifests; service runs in hmac-system namespace to avoid a circular ext-authz loop

Test plan

  • dotnet build services/HmacManager.Kubernetes/HmacManager.Kubernetes.csproj passes on both net8.0 and net10.0
  • Integration: run the service via dotnet run and send a request signed by HmacDelegatingHandler to POST /check; confirm 200 for valid HMAC, 403 for missing/invalid auth header
  • End-to-end: deploy to a kind/k3d cluster with Istio ambient mode, enroll a workload under the waypoint, and verify that signed requests are forwarded while unsigned ones are rejected at the waypoint

jzills added 4 commits June 15, 2026 11:58
Adds services/HmacManager.Kubernetes — a containerized ASP.NET Core
minimal API that implements the Envoy HTTP ext-authz protocol. The
Istio waypoint proxy calls POST /check before forwarding any inbound
request; verification is delegated to IHmacManager.VerifyAsync via
the existing IHmacAuthenticationContextProvider.

Includes Kubernetes deployment manifests and Istio configuration:
- deploy/mesh-config-patch.yaml registers the service as an
  extensionProvider with withRequestBody enabled (body hash is
  required for full HMAC integrity)
- deploy/authorization-policy.yaml targets the namespace waypoint
  with action: CUSTOM, covering all inbound requests
Use SDK 10.0 in the build stage so the multi-TFM project (net8.0;net10.0)
restores and builds correctly; publish explicitly for net8.0 so the
aspnet:8.0 runtime image is still used.

Replace the fixed MapPost("/check") route with a MapMethods catch-all
for all HTTP verbs on /{**path}. Envoy HTTP ext-authz forwards the
original request's method and path to the ext-authz service verbatim,
so the service must match any method/path rather than only POST /check.
The /sign Development route remains a specific route and takes precedence
over the catch-all.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant