Skip to content

Commit 3e3615a

Browse files
BeryJudewi-tiktanberry
authored
website/docs: add docs for MTLS Stage (#14571)
* website/docs: add docs for MTLS Stage Signed-off-by: Jens Langhammer <[email protected]> * update Signed-off-by: Jens Langhammer <[email protected]> * update docs Signed-off-by: Jens Langhammer <[email protected]> * Apply suggestions from code review Co-authored-by: Dewi Roberts <[email protected]> Signed-off-by: Jens L. <[email protected]> * Apply suggestions from code review Co-authored-by: Tana M Berry <[email protected]> Signed-off-by: Jens L. <[email protected]> * Apply suggestions from code review Co-authored-by: Tana M Berry <[email protected]> Signed-off-by: Jens L. <[email protected]> * update brand docs Signed-off-by: Jens Langhammer <[email protected]> * remove code changes Signed-off-by: Jens Langhammer <[email protected]> * fix build Signed-off-by: Jens Langhammer <[email protected]> * reword Signed-off-by: Jens Langhammer <[email protected]> * Update website/docs/add-secure-apps/flows-stages/stages/mtls/index.md Signed-off-by: Tana M Berry <[email protected]> * Update website/docs/add-secure-apps/flows-stages/stages/mtls/index.md Signed-off-by: Tana M Berry <[email protected]> --------- Signed-off-by: Jens Langhammer <[email protected]> Signed-off-by: Jens L. <[email protected]> Signed-off-by: Tana M Berry <[email protected]> Co-authored-by: Dewi Roberts <[email protected]> Co-authored-by: Tana M Berry <[email protected]>
1 parent 79e82c8 commit 3e3615a

File tree

4 files changed

+164
-5
lines changed

4 files changed

+164
-5
lines changed

website/docs/add-secure-apps/flows-stages/flow/context/index.mdx

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Flow Context
3+
toc_max_heading_level: 5
34
---
45

56
Each flow execution has an independent _context_. This context holds all of the arbitrary data about that specific flow, data which can then be used and transformed by stages and policies.
@@ -156,6 +157,7 @@ Possible options:
156157
- `auth_mfa` (Authentication via MFA device without password)
157158
- `auth_webauthn_pwl` (Passwordless authentication via WebAuthn with Passkeys)
158159
- `jwt` ([M2M](../../../providers/oauth2/client_credentials.mdx) authentication via an existing JWT)
160+
- `mtls` (Authentication via Certificate, see [Mutual TLS Stage](../../stages/mtls/index.md))
159161

160162
##### `auth_method_args` (dictionary)
161163

@@ -176,7 +178,10 @@ Example:
176178
// JWT information when `auth_method` `jwt` was used
177179
"jwt": {},
178180
"source": null,
179-
"provider": null
181+
"provider": null,
182+
// Certificate used for authentication
183+
// applies for `auth_method` `mtls`
184+
"certificate": {}
180185
}
181186
```
182187

@@ -203,3 +208,22 @@ If _Show matched user_ is disabled, this key will be set to the user identifier
203208
[Set this key](../../../../customize/policies/expression/managing_flow_context_keys.md) in an Expression Policy to override [Redirect stage](../../stages/redirect/index.md) to force it to redirect to a certain URL or flow. This is useful when a flow requires that the redirection target be decided dynamically.
204209

205210
Use the format `ak-flow://{slug}` to use the Redirect stage in Flow mode. Any other format will result in the Redirect stage running in Static mode.
211+
212+
#### Mutual TLS Stage
213+
214+
##### `certificate` (dictionary):ak-version[2025.6]
215+
216+
This key is set by the Mutual TLS Stage during enrollment and contains data about the certificate supplied by the browser.
217+
218+
Example:
219+
220+
```json
221+
{
222+
"serial_number": "1234",
223+
"subject": "CN=client",
224+
"issuer": "CN=authentik Test CA, O=authentik, OU=Self-signed",
225+
"fingerprint_sha256": "08:D4:A4:79:25:CA:C3:51:28:88:BB:30:C2:96:C3:44:5A:EB:18:07:84:CA:B4:75:27:74:61:19:8A:6A:AF:FC",
226+
"fingerprint_sha1": "5D:14:0D:5F:A2:7E:14:B0:F1:1D:6F:CD:E3:4B:81:68:71:24:1A:70",
227+
"raw": "-----BEGIN CERTIFICATE-----...."
228+
}
229+
```
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
---
2+
title: Mutual TLS stage
3+
authentik_version: "2025.6"
4+
authentik_preview: true
5+
authentik_enterprise: true
6+
toc_max_heading_level: 5
7+
---
8+
9+
The Mutual TLS stage enables authentik to use client certificates to enroll and authenticate users. These certificates can be local to the device or available via PIV Smart Cards, Yubikeys, etc.
10+
11+
Management of client certificates is out of the scope of this document.
12+
13+
## Reverse-proxy configuration
14+
15+
Using the Mutual TLS stage requires special configuration of any reverse proxy that is used in front of authentik, because the reverse-proxy interacts directly with the browser.
16+
17+
- nginx
18+
- [Standalone nginx](#nginx-standalone)
19+
- [nginx kubernetes ingress](#nginx-ingress)
20+
- Traefik
21+
- [Standalone Traefik](#traefik-standalone)
22+
- [Traefik kubernetes ingress](#traefik-ingress)
23+
- [envoy](#envoy)
24+
- [No reverse proxy](#no-reverse-proxy)
25+
26+
#### nginx Standalone
27+
28+
Add this configuration snippet in your authentik virtual host:
29+
30+
```nginx
31+
# server {
32+
ssl_client_certificate /etc/ssl/path-to-my-ca.pem;
33+
ssl_verify_client on;
34+
35+
# location / {
36+
proxy_set_header ssl-client-cert $ssl_client_escaped_cert;
37+
# }
38+
# }
39+
```
40+
41+
See [nginx documentation](https://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_client_certificate) for reference.
42+
43+
#### nginx Ingress
44+
45+
Add these annotations to your authentik ingress object:
46+
47+
```yaml
48+
nginx.ingress.kubernetes.io/auth-tls-pass-certificate-to-upstream: "true"
49+
# This secret needs to contain `ca.crt` which is the certificate authority to validate against.
50+
nginx.ingress.kubernetes.io/auth-tls-secret: namespace/secretName
51+
```
52+
53+
See [ingress-nginx documentation](https://kubernetes.github.io/ingress-nginx/examples/auth/client-certs/) for reference.
54+
55+
#### Traefik Standalone
56+
57+
Add this snippet to your traefik configuration:
58+
59+
```yaml
60+
tls:
61+
options:
62+
default:
63+
clientAuth:
64+
# in PEM format. each file can contain multiple CAs.
65+
caFiles:
66+
- tests/clientca1.crt
67+
- tests/clientca2.crt
68+
clientAuthType: RequireAndVerifyClientCert
69+
```
70+
71+
See the [Traefik mTLS documentation](https://doc.traefik.io/traefik/https/tls/#client-authentication-mtls) for reference.
72+
73+
#### Traefik Ingress
74+
75+
Create a middleware object with these options:
76+
77+
```yaml
78+
apiVersion: traefik.io/v1alpha1
79+
kind: Middleware
80+
metadata:
81+
name: test-passtlsclientcert
82+
spec:
83+
passTLSClientCert:
84+
pem: true
85+
```
86+
87+
See the [Traefik PassTLSClientCert documentation](https://doc.traefik.io/traefik/middlewares/http/passtlsclientcert/) for reference.
88+
89+
#### Envoy
90+
91+
See the [Envoy mTLS documentation](https://www.envoyproxy.io/docs/envoy/latest/start/quick-start/securing#use-mutual-tls-mtls-to-enforce-client-certificate-authentication) and [Envoy header documentation](https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_conn_man/headers#x-forwarded-client-cert) for configuration.
92+
93+
#### No reverse proxy
94+
95+
When using authentik without a reverse proxy, select the certificate authorities in the corresponding [brand](../../../../sys-mgmt/brands.md#client-certificates) for the domain, under **Other global settings**.
96+
97+
## Stage configuration
98+
99+
1. Log in as an admin to authentik, and go to the Admin interface.
100+
101+
2. In the Admin interface, navigate to **System -> Certificates**
102+
103+
3. Create a new certificate for the Certificate Authority used to sign client certificates.
104+
105+
4. In the Admin interface, navigate to **Flows -> Stages**.
106+
107+
5. Click **Create**, and select **Mutual TLS Stage**, and in the **New stage** box, define the following fields:
108+
109+
- **Name**: define a descriptive name, such as "chrome-device-trust".
110+
111+
- **Stage-specific settings**
112+
113+
- **Mode**: Configure the mode this stage operates in.
114+
115+
- **Certificate optional**: When no certificate is provided by the user or the reverse proxy, the flow will continue to the next stage.
116+
- **Certificate required**: When no certificate is provided, the flow ends with an error message.
117+
118+
- **Certificate authorities**: Select the certificate authorities used to sign client certificates.
119+
120+
- **Certificate attribute**: Select the attribute of the certificate to be used to find a user for authentication.
121+
122+
- **User attribute**: Select the attribute of the user the certificate should be compared against.
123+
124+
6. Click **Finish**.

website/docs/sys-mgmt/brands.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Brands
33
slug: /brands
44
---
55

6-
As an authentik admin, you can customize your instance's appearance and behavior using brands. While a single authentik instance supports only one brand per domain, you can apply a separate brand to each domain.
6+
As an authentik admin, you can customize your instance's appearance and behavior using brands. Brands apply to a single domain, a domain wildcard or can be set as default, in which case the brand will be used when no other brand matches the domain.
77

88
For an overview of branding and other customization options in authentik refer to [Customize your instance](../customize/index.md).
99

@@ -61,4 +61,14 @@ This means that if you want to select a default flow based on policy, you can le
6161

6262
## Other global settings
6363

64-
Under **Other global settings** you can specify an exact web certificate.
64+
#### Web Certificate
65+
66+
The **Web Certificate** option can be used to configure which certificate authentik uses when its accessed directly via HTTPS (via port 9443).
67+
68+
#### Client Certificates:ak-version[2025.4]
69+
70+
When using the [Mutual TLS Stage](../add-secure-apps/flows-stages/stages/mtls/index.md) and accessing authentik directly, this option configures which certificate authorities clients' certificates can be issued by.
71+
72+
#### Attributes
73+
74+
Attributes such as locale, theme settings and custom attributes can be set to a per-brand default value here. Any custom attributes can be retrieved via [`group_attributes()`](../users-sources/user/user_ref.mdx#object-properties).

website/sidebars/docs.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,18 +301,19 @@ const items = [
301301
},
302302
items: [
303303
"add-secure-apps/flows-stages/stages/authenticator_duo/index",
304-
"add-secure-apps/flows-stages/stages/authenticator_endpoint_gdtc/index",
305304
"add-secure-apps/flows-stages/stages/authenticator_email/index",
305+
"add-secure-apps/flows-stages/stages/authenticator_endpoint_gdtc/index",
306306
"add-secure-apps/flows-stages/stages/authenticator_sms/index",
307307
"add-secure-apps/flows-stages/stages/authenticator_static/index",
308308
"add-secure-apps/flows-stages/stages/authenticator_totp/index",
309-
"add-secure-apps/flows-stages/stages/authenticator_webauthn/index",
310309
"add-secure-apps/flows-stages/stages/authenticator_validate/index",
310+
"add-secure-apps/flows-stages/stages/authenticator_webauthn/index",
311311
"add-secure-apps/flows-stages/stages/captcha/index",
312312
"add-secure-apps/flows-stages/stages/deny",
313313
"add-secure-apps/flows-stages/stages/email/index",
314314
"add-secure-apps/flows-stages/stages/identification/index",
315315
"add-secure-apps/flows-stages/stages/invitation/index",
316+
"add-secure-apps/flows-stages/stages/mtls/index",
316317
"add-secure-apps/flows-stages/stages/password/index",
317318
"add-secure-apps/flows-stages/stages/prompt/index",
318319
"add-secure-apps/flows-stages/stages/redirect/index",

0 commit comments

Comments
 (0)