Building a Distributed Identity Proxy
This guide shows how to build a distributed Nauthilus system with public edge instances and a private authority instance. It is written for operators who want a systematic path from the mental model to a secure deployment.
Why Use This Architecture?
A standalone Nauthilus instance is still the simplest and best default. It can run the IdP, the authentication pipeline, local LDAP/Lua backends, MFA, WebAuthn, OIDC, SAML, policy, and observability in one process.
A distributed identity proxy is useful when the public IdP tier and the trusted identity backend tier should be separated:
- You need edge instances in a DMZ or regional frontend network.
- LDAP bind credentials, Lua backend credentials, MFA secrets, recovery-code hashes, and backend cache state must stay away from the edge.
- Multiple edge instances need to share browser flow state and continue logins after failover or load-balancer movement.
- Authority-side backend references must be short-lived, opaque, and validated on every follow-up MFA/WebAuthn operation.
- You want one hardened internal gRPC boundary instead of exposing LDAP, Lua backend stores, or authority Redis to edge nodes.
The edge remains the browser-facing IdP. The authority is not a remote OIDC token factory for the edge. Instead, the edge asks the authority for authentication, identity, MFA, WebAuthn, and attribute data through a narrow gRPC backend contract.
What Becomes Possible?
- Public OIDC authorization-code and device-code flows on the edge with identity data resolved by the authority.
- SAML SSO on the edge with attributes resolved by the authority.
- Required TOTP registration and login through the edge while the authority owns the secret.
- Recovery-code generation and consumption through the edge while the authority owns the stored hashes.
- WebAuthn registration and login through the edge while the authority owns persistent credentials and sign-count state.
- Multi-edge continuity where a flow starts on one edge instance and completes on another through shared edge Redis.
- Defense-in-depth with mTLS, OAuth scopes, local operation allow-lists, backend-reference validation, and Redis separation.
Security Model
The hard security rule is ownership:
| State or credential | Owner |
|---|---|
| Public IdP sessions and browser flow state | Edge |
| OIDC/SAML redirect, nonce, device-code, and login continuation state | Edge |
| Edge authority-token cache | Edge Redis |
| LDAP bind credentials and Lua backend credentials | Authority |
| MFA secrets and recovery-code hashes | Authority |
| WebAuthn persistent credentials | Authority |
| Authority caller access tokens | Authority Redis |
| Backend-reference payloads | Authority Redis |
| Backend cache and idempotency outcomes | Authority Redis |
The edge must not read authority Redis. The authority must not read edge Redis. They meet only over the authority gRPC channel and the authority token endpoint used for service-principal caller tokens.
Communication Paths
Caller Token Acquisition
Password Login And Identity Resolution
MFA And WebAuthn
Build Plan
The safest way to build the system is to work from the inside out:
- Design the trust boundaries and DNS names.
- Deploy authority Redis and authority-local backends.
- Configure and validate the authority instance.
- Configure authority caller-token issuance.
- Deploy edge Redis.
- Configure one edge instance with a remote backend.
- Validate direct gRPC checks before browser flows.
- Configure OIDC/SAML clients against the edge.
- Enable MFA and WebAuthn through the edge.
- Add more edge instances and test continuity.
- Tighten network policy and observability.
The following sections walk through those steps.
1. Design The Trust Boundaries
Pick separate names and networks:
| Component | Example |
|---|---|
| Public edge URL | https://idp.example.com |
| Authority gRPC address | authority.internal.example:9444 |
| Authority token endpoint | https://authority.internal.example/oidc/token |
| Edge Redis | edge-redis.internal:6379 |
| Authority Redis | authority-redis.internal:6379 |
| Edge cluster id | dmz-edge |
| Edge instance ids | edge-a, edge-b |
Network policy should allow:
- browsers to reach the edge HTTPS listener;
- edge instances to reach edge Redis;
- edge instances to reach the authority gRPC listener;
- edge instances to reach the authority token endpoint;
- authority to reach authority Redis;
- authority to reach local backend services.
Network policy should deny:
- edge instances to authority Redis;
- authority to edge Redis;
- browsers to authority gRPC;
- browsers to the authority token endpoint when that endpoint is intended only for edge service principals;
- edge instances to LDAP/Lua backend services unless an explicit fallback backend is intentionally configured.