Skip to content

Commit 7407abc

Browse files
committed
Rearrange the section related to certificate principal extraction in PKI doc
1 parent bb53b30 commit 7407abc

File tree

1 file changed

+45
-33
lines changed
  • deploy-manage/users-roles/cluster-or-deployment-auth

1 file changed

+45
-33
lines changed

deploy-manage/users-roles/cluster-or-deployment-auth/pki.md

Lines changed: 45 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -44,39 +44,51 @@ To use PKI in {{es}}, you configure a PKI realm, enable client authentication on
4444
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.
4545
::::
4646

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+
:::::
8092

8193
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).
8294
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

Comments
 (0)