You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: deploy-manage/users-roles/cluster-or-deployment-auth/pki.md
+45-33Lines changed: 45 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,39 +44,51 @@ To use PKI in {{es}}, you configure a PKI realm, enable client authentication on
44
44
When you configure realms in `elasticsearch.yml`, only the realms you specify are used for authentication. If you also want to use the `native` or `file` realms, you must include them in the realm chain.
45
45
::::
46
46
47
-
2. Optional: The username is defined by the [username_pattern](elasticsearch://reference/elasticsearch/configuration-reference/security-settings.md#ref-pki-settings). If you want to use something other than the CN of the Subject DN as the username, you can specify a regex to extract the desired username. The regex is applied on the Subject DN.
48
-
49
-
For example, the regex in the following configuration extracts the email address from the Subject DN:
50
-
51
-
```yaml
52
-
xpack:
53
-
security:
54
-
authc:
55
-
realms:
56
-
pki:
57
-
pki1:
58
-
order: 1
59
-
username_pattern: "EMAILADDRESS=(.*?)(?:,|$)"
60
-
```
61
-
62
-
::::{note}
63
-
If the regex is too restrictive and does not match the Subject DN of the client’s certificate, then the realm does not authenticate the certificate.
64
-
::::
65
-
66
-
Alternatively, username can be extracted from a specific RDN attribute in the Subject DN by using [username_rdn_name](elasticsearch://reference/elasticsearch/configuration-reference/security-settings.md#ref-pki-settings) or [username_rdn_oid](elasticsearch://reference/elasticsearch/configuration-reference/security-settings.md#ref-pki-settings). When an RDN attribute configuration is provided, it supersedes `username_pattern`.
67
-
68
-
For example, to extract the username from the `CN` RDN attribute:
69
-
70
-
```yaml
71
-
xpack:
72
-
security:
73
-
authc:
74
-
realms:
75
-
pki:
76
-
pki1:
77
-
order: 1
78
-
username_rdn_name: "CN"
79
-
```
47
+
2. Optional: The username is defined by the [username_pattern](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/tree/main/reference/elasticsearch/configuration-reference/security-settings#ref-pki-settings). If you want to use something other than the CN of the Subject DN as the username, you can use one of the following methods to extract the username:
48
+
49
+
* {applies_to}`stack: ga 9.1` Extract the username from a specific RDN attribute in the Subject DN.
50
+
* Specify a regex to extract the desired username. The regex is applied on the Subject DN.
51
+
52
+
:::::{tab-set}
53
+
54
+
::::{tab-item} Specific RDN attribute
55
+
The username can be extracted from a specific RDN attribute in the Subject DN by using [username_rdn_name](elasticsearch://reference/elasticsearch/configuration-reference/security-settings.md#ref-pki-settings) or [username_rdn_oid](elasticsearch://reference/elasticsearch/configuration-reference/security-settings.md#ref-pki-settings). When an RDN attribute configuration is provided, it supersedes `username_pattern`.
56
+
57
+
For example, to extract the username from the `CN` RDN attribute:
58
+
59
+
```yaml
60
+
xpack:
61
+
security:
62
+
authc:
63
+
realms:
64
+
pki:
65
+
pki1:
66
+
order: 1
67
+
username_rdn_name: "CN"
68
+
```
69
+
::::
70
+
71
+
::::{tab-item} Regex
72
+
Specify a regex to extract the desired username. The regex is applied on the Subject DN.
73
+
74
+
For example, the regex in the following configuration extracts the email address from the Subject DN:
75
+
76
+
```yaml
77
+
xpack:
78
+
security:
79
+
authc:
80
+
realms:
81
+
pki:
82
+
pki1:
83
+
order: 1
84
+
username_pattern: "EMAILADDRESS=(.*?)(?:,|$)"
85
+
```
86
+
:::{note}
87
+
If the regex is too restrictive and does not match the Subject DN of the client’s certificate, then the realm does not authenticate the certificate.
88
+
:::
89
+
::::
90
+
91
+
:::::
80
92
81
93
3. Optional: If you want the same users to also be authenticated using certificates when they connect to {{kib}}, you must configure the {{es}} PKI realm to allow delegation. See [PKI authentication for clients connecting to {{kib}}](#pki-realm-for-proxied-clients).
82
94
4. Restart {{es}} because realm configuration is not reloaded automatically. If you’re following through with the next steps, you might wish to hold the restart for last.
0 commit comments