Skip to content

Commit 5d4ab11

Browse files
committed
clean up pkiz
1 parent 67a0d4e commit 5d4ab11

File tree

2 files changed

+44
-29
lines changed

2 files changed

+44
-29
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
---
22
mapped_pages:
33
- https://www.elastic.co/guide/en/elasticsearch/reference/current/custom-realms.html
4+
applies_to:
5+
deployment:
6+
ece:
47
---
58

69
# Custom realms

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

Lines changed: 41 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ You can also use PKI certificates to authenticate to {{kib}}, however this requi
1111

1212
## PKI authentication for clients connecting directly to {{es}} [pki-realm-for-direct-clients]
1313

14-
To use PKI in {{es}}, you configure a PKI realm, enable client authentication on the desired network layers (transport or http), and map the Distinguished Names (DNs) from the Subject field in the user certificates to roles. You create the mappings in a role mapping file or use the role mappings API.
14+
To use PKI in {{es}}, you configure a PKI realm, enable client authentication on the desired network layers (transport or http), and map the Distinguished Names (DNs) from the `Subject` field in the user certificates to roles. You create the mappings in a role mapping file or use the role mappings API.
1515

1616
1. Add a realm configuration for a `pki` realm to `elasticsearch.yml` under the `xpack.security.authc.realms.pki` namespace. You must explicitly set the `order` attribute. See [PKI realm settings](asciidocalypse://docs/elasticsearch/docs/reference/elasticsearch/configuration-reference/security-settings.md#ref-pki-settings) for all of the options you can set for a `pki` realm.
1717

@@ -54,14 +54,13 @@ To use PKI in {{es}}, you configure a PKI realm, enable client authentication on
5454

5555
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).
5656
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.
57-
5. [Enable SSL/TLS](../../security/secure-cluster-communications.md#encrypt-internode-communication).
58-
6. Enable client authentication on the desired network layers (transport or http).
57+
5. If you're using a self-managed cluster, then [enable SSL/TLS](../../security/secure-cluster-communications.md#encrypt-internode-communication).
58+
6. If you're using a self-managed cluster or {{eck}}, then enable client authentication on the desired network layers (transport or http).
5959

6060
::::{important}
61-
To use PKI when clients connect directly to {{es}}, you must enable SSL/TLS with client authentication. That is to say, you must set `xpack.security.transport.ssl.client_authentication` and `xpack.security.http.ssl.client_authentication` to `optional` or `required`. If the setting value is `optional`, clients without certificates can authenticate with other credentials.
61+
To use PKI when clients connect directly to {{es}}, you must enable SSL/TLS with client authentication by setting `xpack.security.transport.ssl.client_authentication` and `xpack.security.http.ssl.client_authentication` to `optional` or `required`. If the setting value is `optional`, clients without certificates can authenticate with other credentials.
6262
::::
6363

64-
6564
When clients connect directly to {{es}} and are not proxy-authenticated, the PKI realm relies on the TLS settings of the node’s network interface. The realm can be configured to be more restrictive than the underlying network connection. That is, it is possible to configure the node such that some connections are accepted by the network interface but then fail to be authenticated by the PKI realm. However, the reverse is not possible. The PKI realm cannot authenticate a connection that has been refused by the network interface.
6665

6766
In particular this means:
@@ -72,34 +71,44 @@ To use PKI in {{es}}, you configure a PKI realm, enable client authentication on
7271

7372
For an explanation of these settings, see [General TLS settings](asciidocalypse://docs/elasticsearch/docs/reference/elasticsearch/configuration-reference/security-settings.md#ssl-tls-settings).
7473

75-
The relevant network interface (transport or http) must be configured to trust any certificate that is to be used within the PKI realm. However, it is possible to configure the PKI realm to trust only a *subset* of the certificates accepted by the network interface. This is useful when the SSL/TLS layer trusts clients with certificates that are signed by a different CA than the one that signs your users' certificates.
74+
7. Optional: Configure the PKI realm to trust a subset of certificates.
75+
76+
The relevant network interface (transport or http) must be configured to trust any certificate that is to be used within the PKI realm. However, it is possible to configure the PKI realm to trust only a *subset* of the certificates accepted by the network interface. This is useful when the SSL/TLS layer trusts clients with certificates that are signed by a different CA than the one that signs your users' certificates.
7677

77-
To configure the PKI realm with its own truststore, specify the `truststore.path` option. The path must be located within the Elasticsearch configuration directory (`ES_PATH_CONF`). For example:
78+
1. To configure the PKI realm with its own trust store, specify the `truststore.path` option. The path must be located within the {{es}} configuration directory (`ES_PATH_CONF`). For example:
7879

79-
```yaml
80-
xpack:
81-
security:
82-
authc:
83-
realms:
84-
pki:
85-
pki1:
86-
order: 1
87-
truststore:
88-
path: "pki1_truststore.jks"
89-
```
80+
```yaml
81+
xpack:
82+
security:
83+
authc:
84+
realms:
85+
pki:
86+
pki1:
87+
order: 1
88+
truststore:
89+
path: "pki1_truststore.jks"
90+
```
91+
92+
:::{tip}
93+
If you're using {{ece}} or {{ech}}, then you must [upload this file as a custom bundle](/deploy-manage/deploy/elastic-cloud/upload-custom-plugins-bundles.md) before it can be referenced.
9094

91-
If the truststore is password protected, the password should be configured by adding the appropriate `secure_password` setting to the {{es}} keystore. For example, the following command adds the password for the example realm above:
95+
If you're using {{eck}}, then install the file as a [custom configuration file](/deploy-manage/deploy/cloud-on-k8s/custom-configuration-files-plugins.md#use-a-volume-and-volume-mount-together-with-a-configmap-or-secret).
96+
97+
If you're using a self-managed cluster, then the file must be present on each node.
98+
:::
99+
100+
The `certificate_authorities` option can be used as an alternative to the `truststore.path` setting, when the certificate files are PEM formatted. The setting accepts a list. The two options are exclusive, they cannot be both used simultaneously.
101+
102+
2. If the trust store is password protected, the password should be configured by adding the appropriate `secure_password` setting [to the {{es}} keystore](/deploy-manage/security/secure-settings.md). For example, in a self-managed cluster, the following command adds the password for the example realm above:
92103

93104
```shell
94105
bin/elasticsearch-keystore add \
95106
xpack.security.authc.realms.pki.pki1.truststore.secure_password
96107
```
97108

98-
The `certificate_authorities` option can be used as an alternative to the `truststore.path` setting, when the certificate files are PEM formatted. The setting accepts a list. The two options are exclusive, they cannot be both used simultaneously.
109+
8. Map roles for PKI users.
99110

100-
7. Map roles for PKI users.
101-
102-
You map roles for PKI users through the [role mapping APIs](https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-security) or by using a file stored on each node. Both configuration options are merged together. When a user authenticates against a PKI realm, the privileges for that user are the union of all privileges defined by the roles to which the user is mapped.
111+
You map roles for PKI users through the [role mapping APIs](https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-security) or by using a file. Both configuration options are merged together. When a user authenticates against a PKI realm, the privileges for that user are the union of all privileges defined by the roles to which the user is mapped.
103112

104113
You identify a user by the distinguished name in their certificate. For example, the following mapping configuration maps `John Doe` to the `user` role using the role mapping API:
105114

@@ -127,6 +136,13 @@ To use PKI in {{es}}, you configure a PKI realm, enable client authentication on
127136
1. The name of a role.
128137
2. The distinguished name (DN) of a PKI user.
129138

139+
:::{tip}
140+
If you're using {{ece}} or {{ech}}, then you must [upload this file as a custom bundle](/deploy-manage/deploy/elastic-cloud/upload-custom-plugins-bundles.md) before it can be referenced.
141+
142+
If you're using {{eck}}, then install the file as a [custom configuration file](/deploy-manage/deploy/cloud-on-k8s/custom-configuration-files-plugins.md#use-a-volume-and-volume-mount-together-with-a-configmap-or-secret).
143+
144+
If you're using a self-managed cluster, then the file must be present on each node.
145+
:::
130146

131147
The file’s path defaults to `ES_PATH_CONF/role_mapping.yml`. You can specify a different path (which must be within `ES_PATH_CONF`) by using the `files.role_mapping` realm setting (e.g. `xpack.security.authc.realms.pki.pki1.files.role_mapping`).
132148

@@ -140,15 +156,13 @@ To use PKI in {{es}}, you configure a PKI realm, enable client authentication on
140156
The PKI realm supports [authorization realms](realm-chains.md#authorization_realms) as an alternative to role mapping.
141157
::::
142158

143-
144-
145159
## PKI authentication for clients connecting to {{kib}} [pki-realm-for-proxied-clients]
146160

147-
By default, the PKI realm relies on the node’s network interface to perform the SSL/TLS handshake and extract the client certificate. This behaviour requires that clients connect directly to {{es}} so that their SSL connection is terminated by the {{es}} node. If SSL/TLS authentication is to be performed by {{kib}}, the PKI realm must be configured to permit delegation.
161+
By default, the PKI realm relies on the node’s network interface to perform the SSL/TLS handshake and extract the client certificate. This behavior requires that clients connect directly to {{es}} so that their SSL connection is terminated by the {{es}} node. If SSL/TLS authentication is to be performed by {{kib}}, the PKI realm must be configured to permit delegation.
148162

149163
Specifically, when clients presenting X.509 certificates connect to {{kib}}, {{kib}} performs the SSL/TLS authentication. {{kib}} then forwards the client’s certificate chain (by calling an {{es}} API) to have them further validated by the PKI realms that have been configured for delegation.
150164

151-
To permit authentication delegation for a specific {{es}} PKI realm, start by configuring the realm for the usual case, as detailed in the [PKI authentication for clients connecting directly to {{es}}](#pki-realm-for-direct-clients) section. In this scenario, when you enable TLS, it is mandatory that you [encrypt HTTP client communications](../../security/secure-http-communications.md#encrypt-http-communication).
165+
To permit authentication delegation for a specific {{es}} PKI realm, start by [configuring the realm](#pki-realm-for-direct-clients). In this scenario, for self-managed clusters, it is mandatory that you [encrypt HTTP client communications](../../security/secure-http-communications.md#encrypt-http-communication) when you enable TLS.
152166

153167
You must also explicitly configure a `truststore` (or, equivalently `certificate_authorities`) even though it is the same trust configuration that you have configured on the network layer. The `xpack.security.authc.token.enabled` and `delegation.enabled` settings must also be `true`. For example:
154168

@@ -194,5 +208,3 @@ PUT /_security/role_mapping/direct_pki_only
194208

195209
1. If this metadata field is set (that is to say, it is **not** `null`), the user has been authenticated in the delegation scenario.
196210

197-
198-

0 commit comments

Comments
 (0)