@@ -6,26 +6,15 @@ the desired network layers (transport or http), and map the Distinguished Names
6
6
(DNs) from the Subject field in the user certificates to roles. You create the
7
7
mappings in a role mapping file or use the role mappings API.
8
8
9
- If you want the same users to also be authenticated using certificates when they
10
- connect to {kib}, you must configure the {es} PKI realm to
11
- <<pki-realm-for-proxied-clients,allow delegation>> and to
12
- {kibana-ref}/kibana-authentication.html#pki-authentication[enable PKI authentication in {kib}].
13
-
14
- You can also use a combination of PKI and username/password authentication. For
9
+ TIP: You can use a combination of PKI and username/password authentication. For
15
10
example, you can enable SSL/TLS on the transport layer and define a PKI realm to
16
11
require transport clients to authenticate with X.509 certificates, while still
17
- authenticating HTTP traffic using username and password credentials. You can
18
- also set `xpack.security.transport.ssl.client_authentication` to `optional` to
19
- allow clients without certificates to authenticate with other credentials.
20
-
21
- IMPORTANT: You must enable SSL/TLS with client authentication to use PKI when
22
- clients connect directly to {es}.
12
+ authenticating HTTP traffic using username and password credentials.
23
13
24
14
. Add a realm configuration for a `pki` realm to `elasticsearch.yml` under the
25
- `xpack.security.authc.realms.pki` namespace.
26
- If you are configuring multiple realms, you should
27
- explicitly set the `order` attribute. See <<ref-pki-settings>> for all of the
28
- options you can set for a `pki` realm.
15
+ `xpack.security.authc.realms.pki` namespace. If you are configuring multiple
16
+ realms, you should explicitly set the `order` attribute. See
17
+ <<ref-pki-settings>> for all of the options you can set for a `pki` realm.
29
18
+
30
19
--
31
20
For example, the following snippet shows the most basic `pki` realm configuration:
@@ -44,15 +33,21 @@ xpack:
44
33
With this configuration, any certificate trusted by the {es} SSL/TLS layer is
45
34
accepted for authentication. The username is the common name (CN) extracted
46
35
from the DN in the Subject field of the end-entity certificate. This
47
- configuration does not permit PKI authentication to {kib}.
36
+ configuration is not sufficient to permit PKI authentication to {kib};
37
+ additional steps are required.
48
38
49
39
IMPORTANT: When you configure realms in `elasticsearch.yml`, only the
50
40
realms you specify are used for authentication. If you also want to use the
51
41
`native` or `file` realms, you must include them in the realm chain.
52
42
53
- If you want to use something other than the CN of the Subject DN as the
54
- username, you can specify a regex to extract the desired username. The regex is
55
- applied on the Subject DN. For example, the regex in the following
43
+ --
44
+
45
+ . Optional: If you want to use something other than the CN of the Subject DN as
46
+ the username, you can specify a regex to extract the desired username. The regex
47
+ is applied on the Subject DN.
48
+ +
49
+ --
50
+ For example, the regex in the following
56
51
configuration extracts the email address from the Subject DN:
57
52
58
53
[source, yaml]
@@ -71,6 +66,10 @@ client's certificate, then the realm does not authenticate the certificate.
71
66
72
67
--
73
68
69
+ . Optional: If you want the same users to also be authenticated using
70
+ certificates when they connect to {kib}, you must configure the {es} PKI realm
71
+ to allow delegation. See <<pki-realm-for-proxied-clients>>.
72
+
74
73
. Restart {es} because realm configuration is not reloaded automatically. If
75
74
you're following through with the next steps, you might wish to hold the
76
75
restart for last.
@@ -80,6 +79,11 @@ restart for last.
80
79
. Enable client authentication on the desired network layers (transport or http).
81
80
+
82
81
--
82
+ IMPORTANT: To use PKI when clients connect directly to {es}, you must enable
83
+ SSL/TLS with client authentication. That is to say, you must set `xpack.security.transport.ssl.client_authentication` and
84
+ `xpack.security.http.ssl.client_authentication` to `optional` or `required`. If
85
+ the setting value is `optional`, clients without certificates can authenticate
86
+ with other credentials.
83
87
84
88
When clients connect directly to {es} and are not proxy-authenticated, the PKI
85
89
realm relies on the TLS settings of the node's network interface. The realm can
@@ -95,22 +99,22 @@ In particular this means:
95
99
`client_authentication` to `optional` or `required`.
96
100
* The interface must _trust_ the certificate that is presented by the client
97
101
by configuring either the `truststore` or `certificate_authorities` paths,
98
- or by setting `verification_mode` to `none`. See
99
- <<ssl-tls-settings,`ssl.verification_mode`>> for an explanation of this
100
- setting.
102
+ or by setting `verification_mode` to `none`.
101
103
* The _protocols_ supported by the interface must be compatible with those
102
104
used by the client.
105
+
106
+ For an explanation of these settings, see <<ssl-tls-settings>>.
103
107
104
108
The relevant network interface (transport or http) must be configured to trust
105
- any certificate that is to be used within the PKI realm. However, it is possible to
106
- configure the PKI realm to trust only a _subset_ of the certificates accepted
109
+ any certificate that is to be used within the PKI realm. However, it is possible
110
+ to configure the PKI realm to trust only a _subset_ of the certificates accepted
107
111
by the network interface. This is useful when the SSL/TLS layer trusts clients
108
112
with certificates that are signed by a different CA than the one that signs your
109
113
users' certificates.
110
114
111
115
To configure the PKI realm with its own truststore, specify the
112
116
`truststore.path` option. The path must be located within the Elasticsearch
113
- configuration directory (ES_PATH_CONF). For example:
117
+ configuration directory (` ES_PATH_CONF` ). For example:
114
118
115
119
[source, yaml]
116
120
------------------------------------------------------------
@@ -135,25 +139,23 @@ xpack.security.authc.realms.pki.pki1.truststore.secure_password
135
139
------------------------------------------------------------
136
140
137
141
The `certificate_authorities` option can be used as an alternative to the
138
- `truststore.path` setting, when the certificate files are PEM formatted
139
- . The setting accepts a list. The two options are exclusive, they cannot be both used
142
+ `truststore.path` setting, when the certificate files are PEM formatted. The
143
+ setting accepts a list. The two options are exclusive, they cannot be both used
140
144
simultaneously.
141
145
--
142
146
143
147
. Map roles for PKI users.
144
148
+
145
149
--
146
- You map roles for PKI users through the <<security-role-mapping-apis,role
147
- mapping APIs>> or by using a file stored on each node. Both configuration
148
- options are merged together. When a user authenticates against a PKI realm, the
149
- privileges for that user are the union of all privileges defined by the roles
150
- to which the user is mapped.
150
+ You map roles for PKI users through the
151
+ <<security-role- mapping-apis,role mapping APIs>> or by using a file stored on
152
+ each node. Both configuration options are merged together. When a user
153
+ authenticates against a PKI realm, the privileges for that user are the union of
154
+ all privileges defined by the roles to which the user is mapped.
151
155
152
156
You identify a user by the distinguished name in their certificate.
153
157
For example, the following mapping configuration maps `John Doe` to the
154
- `user` role:
155
-
156
- Using the role-mapping API:
158
+ `user` role using the role mapping API:
157
159
158
160
[source,console]
159
161
--------------------------------------------------
@@ -169,10 +171,7 @@ PUT /_security/role_mapping/users
169
171
170
172
<1> The distinguished name (DN) of a PKI user.
171
173
172
- Or, alternatively, configured inside a role-mapping file. The file's path
173
- defaults to `ES_PATH_CONF/role_mapping.yml`. You can specify a different path (which must be within
174
- ES_PATH_CONF) by using the `files.role_mapping` realm setting (e.g.
175
- `xpack.security.authc.realms.pki.pki1.files.role_mapping`):
174
+ Alternatively, use a role-mapping file. For example:
176
175
177
176
[source, yaml]
178
177
------------------------------------------------------------
@@ -182,9 +181,14 @@ user: <1>
182
181
<1> The name of a role.
183
182
<2> The distinguished name (DN) of a PKI user.
184
183
184
+ The file's path defaults to `ES_PATH_CONF/role_mapping.yml`. You can specify a
185
+ different path (which must be within `ES_PATH_CONF`) by using the
186
+ `files.role_mapping` realm setting (e.g.
187
+ `xpack.security.authc.realms.pki.pki1.files.role_mapping`).
188
+
185
189
The distinguished name for a PKI user follows X.500 naming conventions which
186
190
place the most specific fields (like `cn` or `uid`) at the beginning of the
187
- name, and the most general fields (like `o` or `dc`) at the end of the name.
191
+ name and the most general fields (like `o` or `dc`) at the end of the name.
188
192
Some tools, such as _openssl_, may print out the subject name in a different
189
193
format.
190
194
@@ -206,47 +210,60 @@ alternative to role mapping.
206
210
207
211
By default, the PKI realm relies on the node's network interface to perform the
208
212
SSL/TLS handshake and extract the client certificate. This behaviour requires
209
- that that clients connect directly to {es} so that their SSL connection is
210
- terminated by the {es} node. If SSL/TLS authenticatication is to be performed
211
- by {kib}, the PKI realm must be configured to permit delegation.
213
+ that clients connect directly to {es} so that their SSL connection is terminated
214
+ by the {es} node. If SSL/TLS authentication is to be performed by {kib}, the
215
+ PKI realm must be configured to permit delegation.
212
216
213
217
Specifically, when clients presenting X.509 certificates connect to {kib},
214
218
{kib} performs the SSL/TLS authentication. {kib} then forwards the client's
215
- certificate chain, by calling an {es} API, to have them further validated by
219
+ certificate chain ( by calling an {es} API) to have them further validated by
216
220
the PKI realms that have been configured for delegation.
217
221
218
222
To permit authentication delegation for a specific {es} PKI realm, start by
219
223
configuring the realm for the usual case, as detailed in the
220
- <<pki-realm-for-direct-clients>>
221
- section. Note that you must explicitly configure a `truststore` (or,
222
- equivalently `certificate_authorities`) even though it is the same trust
223
- configuration that you have configured on the network layer. Afterwards,
224
- simply toggle the `delegation.enabled` realm setting to `true`. This realm is
225
- now allowed to validate delegated PKI authentication (after restarting {es}).
224
+ <<pki-realm-for-direct-clients>> section. In this scenario, when you enable TLS,
225
+ it is mandatory that you <<tls-http,encrypt HTTP client communications>>.
226
226
227
- NOTE: PKI authentication delegation requires that the
228
- `xpack.security.authc.token.enabled` setting be `true` and that SSL/TLS be
229
- configured (without SSL/TLS client authentication).
227
+ You must also explicitly configure a `truststore` (or, equivalently
228
+ `certificate_authorities`) even though it is the same trust configuration that
229
+ you have configured on the network layer. The
230
+ `xpack.security.authc.token.enabled` and `delegation.enabled` settings must also
231
+ be `true`. For example:
232
+
233
+ [source, yaml]
234
+ ------------------------------------------------------------
235
+ xpack:
236
+ security:
237
+ authc:
238
+ token.enabled: true
239
+ realms:
240
+ pki:
241
+ pki1:
242
+ order: 1
243
+ delegation.enabled: true
244
+ truststore:
245
+ path: "pki1_truststore.jks"
246
+ ------------------------------------------------------------
230
247
231
- NOTE: {kib} also needs to be
232
- {kibana-ref}/kibana-authentication.html#pki-authentication[configured to allow
233
- PKI certificate authentication].
248
+ After you restart {es}, this realm can validate delegated PKI authentication.
249
+ You must then
250
+ {kibana-ref}/kibana-authentication.html#pki-authentication[configure {kib} to allow PKI certificate authentication].
234
251
235
252
A PKI realm with `delegation.enabled` still works unchanged for clients
236
- connecting directly to {es}. Directly authenticated users, and users that are PKI
253
+ connecting directly to {es}. Directly authenticated users and users that are PKI
237
254
authenticated by delegation to {kib} both follow the same
238
255
<<mapping-roles,role mapping rules>> or
239
256
<<authorization_realms,authorization realms configurations>>.
240
257
241
- However, if you use the <<security-role-mapping-apis,role mapping APIs>>,
242
- you can distinguish between users that are authenticated by delegation and
243
- users that are authenticated directly. The former have the
244
- extra fields `pki_delegated_by_user` and `pki_delegated_by_realm` in the user's
245
- metadata. In the common setup, where authentication is delegated to {kib}, the
246
- values of these fields are `kibana` and `reserved`, respectively. For example,
247
- the following role mapping rule will assign the `role_for_pki1_direct` role to
248
- all users that have been authenticated directly by the `pki1` realm, by
249
- connecting to {es} instead of going through {kib}:
258
+ If you use the <<security-role-mapping-apis,role mapping APIs>>, however, you
259
+ can distinguish between users that are authenticated by delegation and users
260
+ that are authenticated directly. The former have the extra fields
261
+ `pki_delegated_by_user` and `pki_delegated_by_realm` in the user's metadata. In
262
+ the common setup, where authentication is delegated to {kib}, the values of
263
+ these fields are `kibana` and `reserved`, respectively. For example, the
264
+ following role mapping rule assigns the `role_for_pki1_direct` role to all users
265
+ that have been authenticated directly by the `pki1` realm, by connecting to {es}
266
+ instead of going through {kib}:
250
267
251
268
[source,console]
252
269
--------------------------------------------------
@@ -269,5 +286,5 @@ PUT /_security/role_mapping/direct_pki_only
269
286
}
270
287
--------------------------------------------------
271
288
272
- <1> only when this metadata field is set (it is *not* `null`) the user has been
273
- authenticated in the delegation scenario.
289
+ <1> If this metadata field is set (that is to say, it is *not* `null`), the user
290
+ has been authenticated in the delegation scenario.
0 commit comments