Forward-Auth & Reverse Proxy Integration¶
StackPilot supports enterprise Single Sign-On (SSO) and Identity Provider integration via Forward-Authentication headers, allowing seamless pairing with Authentik, Authelia, Keycloak, or Cloudflare Access.
1. How Forward-Auth Operates¶
When placed behind a reverse proxy configured with Forward-Auth: 1. Incoming browser requests hit the reverse proxy (e.g. Traefik, Caddy, Nginx). 2. The proxy queries the identity provider (e.g. Authentik) to authenticate the session. 3. Upon successful login, the proxy forwards the request to the StackPilot Central Hub along with identity headers.
2. Supported Header Sets¶
StackPilot natively handles both standard generic headers and Authentik-specific headers:
| Standard Header | Authentik Native Header | Description |
|---|---|---|
Remote-User |
X-Authentik-Username |
Authenticated username or subject identifier |
Remote-Email |
X-Authentik-Email |
User's verified email address |
Remote-Groups |
X-Authentik-Groups |
Comma or pipe-separated list of user groups |
3. RBAC Role Mapping¶
Groups received from the identity provider map directly to StackPilot roles:
| Group Name | Mapped Role | Permissions |
|---|---|---|
stackpilot-admins |
admin |
Full access: deployments, deletions, secret refactoring, users |
stackpilot-operators |
operator |
Can restart services, pull images, view logs (cannot delete) |
| (Any other authenticated user) | viewer |
Read-only metrics, container lists, and status |
4. Trusted Proxy Verification¶
Security Requirement: Exact Proxy Address Validation
To prevent attackers from spoofing identity headers, StackPilot verifies the direct socket peer against an explicit allowlist. CIDR ranges are not supported and cause startup to fail.
Set each trusted reverse proxy address in your environment or Quadlet:
Environment=REQUIRE_FORWARD_AUTH=true
Environment=STACKPILOT_FORWARD_AUTH_TRUSTED_PROXIES=127.0.0.1,10.0.0.5
Use exact IPv4 or IPv6 addresses. localhost is accepted as an alias for either loopback address. Hostnames, address ranges such as 10.0.0.0/8, and values containing ports are rejected.
StackPilot evaluates only the direct socket peer. X-Forwarded-For and X-Real-IP cannot make an untrusted peer trusted, including in multi-proxy deployments. Configure the address of the final proxy hop that connects directly to the Hub.
Rootless Podman port forwarding may make the direct peer appear as loopback. In that deployment, explicitly trust 127.0.0.1, ::1, or localhost, strip all client-supplied identity headers at the proxy, and prevent direct network access to the Hub. Requests from unlisted or unavailable socket addresses are treated as unauthenticated.