@@ -6,14 +6,7 @@ users. To integrate with Active Directory, you configure an `active_directory`
66realm and map Active Directory users and groups to {security} roles in the
77<<mapping-roles, role mapping file>>.
88
9- To protect passwords, communications between Elasticsearch and the Active Directory
10- server should be encrypted using SSL/TLS. Clients and nodes that connect via
11- SSL/TLS to the Active Directory server need to have the Active Directory server's
12- certificate or the server's root CA certificate installed in their keystore or
13- truststore. For more information about installing certificates, see
14- <<active-directory-ssl>>.
15-
16- ==== Configuring an Active Directory Realm
9+ See {ref}/configuring-ad-realm.html[Configuring an Active Directory Realm].
1710
1811{security} uses LDAP to communicate with Active Directory, so `active_directory`
1912realms are similar to <<ldap-realm, `ldap` realms>>. Like LDAP directories,
@@ -39,132 +32,6 @@ Active Directory. Once the user has been found, the Active Directory realm then
3932retrieves the user's group memberships from the `tokenGroups` attribute on the
4033user's entry in Active Directory.
4134
42- To configure an `active_directory` realm:
43-
44- . Add a realm configuration of type `active_directory` to `elasticsearch.yml`
45- under the `xpack.security.authc.realms` namespace. At a minimum, you must set the realm
46- `type` to `active_directory` and specify the Active Directory `domain_name`. To
47- use SSL/TLS for secured communication with the Active Directory server, you must
48- also set the `url` attribute and specify the `ldaps` protocol and secure port
49- number. If you are configuring multiple realms, you should also explicitly set
50- the `order` attribute to control the order in which the realms are consulted
51- during authentication. See <<ad-settings, Active Directory Realm Settings>>
52- for all of the options you can set for an `active_directory` realm.
53- +
54- NOTE: Binding to Active Directory fails if the domain name is not mapped in DNS.
55- If DNS is not being provided by a Windows DNS server, add a mapping for
56- the domain in the local `/etc/hosts` file.
57- +
58- For example, the following realm configuration configures {security} to connect
59- to `ldaps://example.com:636` to authenticate users through Active Directory.
60- +
61- [source, yaml]
62- ------------------------------------------------------------
63- xpack:
64- security:
65- authc:
66- realms:
67- active_directory:
68- type: active_directory
69- order: 0 <1>
70- domain_name: ad.example.com
71- url: ldaps://ad.example.com:636 <2>
72- ------------------------------------------------------------
73- <1> The realm order controls the order in which the configured realms are checked
74- when authenticating a user.
75- <2> If you don't specify the URL, it defaults to `ldap:<domain_name>:389`.
76- +
77- IMPORTANT: When you configure realms in `elasticsearch.yml`, only the
78- realms you specify are used for authentication. If you also want to use the
79- `native` or `file` realms, you must include them in the realm chain.
80-
81- . Restart Elasticsearch.
82-
83- ===== Configuring a Bind User
84- By default, all of the LDAP operations are run by the user that {security} is
85- authenticating. In some cases, regular users may not be able to access all of the
86- necessary items within Active Directory and a _bind user_ is needed. A bind user
87- can be configured and will be used to perform all operations other than the LDAP
88- bind request, which is required to authenticate the credentials provided by the user.
89-
90- The use of a bind user enables the <<run-as-privilege,run as feature>> to be
91- used with the Active Directory realm and the ability to maintain a set of pooled
92- connections to Active Directory. These pooled connection reduce the number of
93- resources that must be created and destroyed with every user authentication.
94-
95- The following example shows the configuration of a bind user through the user of the
96- `bind_dn` and `secure_bind_password` settings.
97-
98- [source, yaml]
99- ------------------------------------------------------------
100- xpack:
101- security:
102- authc:
103- realms:
104- active_directory:
105- type: active_directory
106- order: 0
107- domain_name: ad.example.com
108- url: ldaps://ad.example.com:636
109- 110- ------------------------------------------------------------
111- <1> This is the user that all Active Directory search requests are executed as.
112- Without a bind user configured, all requests run as the user that is authenticating
113- with Elasticsearch.
114-
115- The password for the `bind_dn` user should be configured by adding the appropriate
116- `secure_bind_password` setting to the {es} keystore.
117- For example, the following command adds the password for the example realm above:
118-
119- [source, shell]
120- ------------------------------------------------------------
121- bin/elasticsearch-keystore add xpack.security.authc.realms.active_directory.secure_bind_password
122- ------------------------------------------------------------
123-
124- When a bind user is configured, connection pooling is enabled by default.
125- Connection pooling can be disabled using the `user_search.pool.enabled` setting.
126-
127- ===== Multiple Domain Support
128- When authenticating users across multiple domains in a forest, there are a few minor
129- differences in the configuration and the way that users will authenticate. The `domain_name`
130- setting should be set to the forest root domain name. The `url` setting also needs to
131- be set as you will need to authenticate against the Global Catalog, which uses a different
132- port and may not be running on every Domain Controller.
133-
134- For example, the following realm configuration configures {security} to connect to specific
135- Domain Controllers on the Global Catalog port with the domain name set to the forest root.
136-
137- [source, yaml]
138- ------------------------------------------------------------
139- xpack:
140- security:
141- authc:
142- realms:
143- active_directory:
144- type: active_directory
145- order: 0
146- domain_name: example.com <1>
147- url: ldaps://dc1.ad.example.com:3269, ldaps://dc2.ad.example.com:3269 <2>
148- load_balance:
149- type: "round_robin" <3>
150- ------------------------------------------------------------
151- <1> The `domain_name` is set to the name of the root domain in the forest.
152- <2> The `url` value used in this example has URLs for two different Domain Controllers,
153- which are also Global Catalog servers. Port 3268 is the default port for unencrypted
154- communication with the Global Catalog; port 3269 is the default port for SSL connections.
155- The servers that are being connected to can be in any domain of the forest as long as
156- they are also Global Catalog servers.
157- <3> A load balancing setting is provided to indicate the desired behavior when choosing
158- the server to connect to.
159-
160- In this configuration, users will need to use either their full User Principal
161- Name (UPN) or their Down-Level Logon Name. A UPN is typically a concatenation of
162- the username with `@<DOMAIN_NAME` such as `
[email protected] `. The Down-Level
163- Logon Name is the NetBIOS domain name, followed by a `\` and the username, such as
164- `AD\johndoe`. Use of Down-Level Logon Name requires a connection to the regular LDAP
165- ports (389 or 636) in order to query the configuration container to retrieve the
166- domain name from the NetBIOS name.
167-
16835[[ad-load-balancing]]
16936===== Load Balancing and Failover
17037The `load_balance.type` setting can be used at the realm level to configure how
@@ -181,86 +48,13 @@ See {ref}/security-settings.html#ref-ad-settings[Active Directory Realm Settings
18148[[mapping-roles-ad]]
18249==== Mapping Active Directory Users and Groups to Roles
18350
184- An integral part of a realm authentication process is to resolve the roles
185- associated with the authenticated user. Roles define the privileges a user has
186- in the cluster.
187-
188- Since with the `active_directory` realm the users are managed externally in the
189- Active Directory server, the expectation is that their roles are managed there
190- as well. In fact, Active Directory supports the notion of groups, which often
191- represent user roles for different systems in the organization.
192-
193- The `active_directory` realm enables you to map Active Directory users to roles
194- via their Active Directory groups, or other metadata. This role mapping can be
195- configured via the {ref}/security-api-role-mapping.html[role-mapping API], or by using
196- a file stored on each node. When a user authenticates against an Active
197- Directory realm, the privileges for that user are the union of all privileges
198- defined by the roles to which the user is mapped.
199-
200- Within a mapping definition, you specify groups using their distinguished
201- names. For example, the following mapping configuration maps the Active
202- Directory `admins` group to both the `monitoring` and `user` roles, maps the
203- `users` group to the `user` role and maps the `John Doe` user to the `user`
204- role.
205-
206- Configured via the role-mapping API:
207- [source,js]
208- --------------------------------------------------
209- PUT _xpack/security/role_mapping/admins
210- {
211- "roles" : [ "monitoring" , "user" ],
212- "rules" : { "field" : {
213- "groups" : "cn=admins,dc=example,dc=com" <1>
214- } },
215- "enabled": true
216- }
217- --------------------------------------------------
218- // CONSOLE
219- <1> The Active Directory distinguished name (DN) of the `admins` group.
220-
221- [source,js]
222- --------------------------------------------------
223- PUT _xpack/security/role_mapping/basic_users
224- {
225- "roles" : [ "user" ],
226- "rules" : { "any": [
227- { "field" : {
228- "groups" : "cn=users,dc=example,dc=com" <1>
229- } },
230- { "field" : {
231- "dn" : "cn=John Doe,cn=contractors,dc=example,dc=com" <2>
232- } }
233- ] },
234- "enabled": true
235- }
236- --------------------------------------------------
237- // CONSOLE
238- <1> The Active Directory distinguished name (DN) of the `users` group.
239- <2> The Active Directory distinguished name (DN) of the user `John Doe`.
240-
241- Or, alternatively, configured via the role-mapping file:
242- [source, yaml]
243- ------------------------------------------------------------
244- monitoring: <1>
245- - "cn=admins,dc=example,dc=com" <2>
246- user:
247- - "cn=users,dc=example,dc=com" <3>
248- - "cn=admins,dc=example,dc=com"
249- - "cn=John Doe,cn=contractors,dc=example,dc=com" <4>
250- ------------------------------------------------------------
251- <1> The name of the role.
252- <2> The Active Directory distinguished name (DN) of the `admins` group.
253- <3> The Active Directory distinguished name (DN) of the `users` group.
254- <4> The Active Directory distinguished name (DN) of the user `John Doe`.
255-
256- For more information, see <<mapping-roles, Mapping Users and Groups to Roles>>.
51+ See {ref}/configuring-ad-realm.html[Configuring an Active Directory realm].
25752
25853[[ad-user-metadata]]
25954==== User Metadata in Active Directory Realms
55+
26056When a user is authenticated via an Active Directory realm, the following
261- properties are populated in the user's _metadata_. This metadata is returned in the
262- {ref}/security-api-authenticate.html[authenticate API], and can be used with
263- <<templating-role-query, templated queries>> in roles.
57+ properties are populated in the user's _metadata_:
26458
26559|=======================
26660| Field | Description
@@ -270,51 +64,15 @@ properties are populated in the user's _metadata_. This metadata is returned in
27064 groups were mapped to a role).
27165|=======================
27266
67+ This metadata is returned in the
68+ {ref}/security-api-authenticate.html[authenticate API] and can be used with
69+ <<templating-role-query, templated queries>> in roles.
70+
27371Additional metadata can be extracted from the Active Directory server by configuring
27472the `metadata` setting on the Active Directory realm.
27573
27674[[active-directory-ssl]]
27775==== Setting up SSL Between Elasticsearch and Active Directory
27876
279- To protect the user credentials that are sent for authentication, it's highly
280- recommended to encrypt communications between Elasticsearch and your Active
281- Directory server. Connecting via SSL/TLS ensures that the identity of the Active
282- Directory server is authenticated before {security} transmits the user
283- credentials, and the usernames and passwords are encrypted in transit.
284-
285- To encrypt communications between Elasticsearch and Active Directory:
286-
287- . Configure each node to trust certificates signed by the CA that signed your
288- Active Directory server certificates. The following example demonstrates how to trust a CA certificate,
289- `cacert.pem`, located within the {xpack} configuration directory:
290- +
291- [source,shell]
292- --------------------------------------------------
293- xpack:
294- security:
295- authc:
296- realms:
297- active_directory:
298- type: active_directory
299- order: 0
300- domain_name: ad.example.com
301- url: ldaps://ad.example.com:636
302- ssl:
303- certificate_authorities: [ "CONFIG_DIR/x-pack/cacert.pem" ]
304- --------------------------------------------------
305- +
306- The CA cert must be a PEM encoded certificate.
307-
308- . Set the `url` attribute in the realm configuration to specify the LDAPS protocol
309- and the secure port number. For example, `url: ldaps://ad.example.com:636`.
310-
311- . Restart Elasticsearch.
312-
313- NOTE: By default, when you configure {security} to connect to Active Directory
314- using SSL/TLS, {security} attempts to verify the hostname or IP address
315- specified with the `url` attribute in the realm configuration with the
316- values in the certificate. If the values in the certificate and realm
317- configuration do not match, {security} does not allow a connection to the
318- Active Directory server. This is done to protect against man-in-the-middle
319- attacks. If necessary, you can disable this behavior by setting the
320- {ref}/security-settings.html#ssl-tls-settings[`ssl.verification_mode`] property to `certificate`.
77+ See
78+ {ref}/configuring-tls.html#tls-active-directory[Encrypting communications between {es} and Active Directory].
0 commit comments