active-directory-realm.asciidoc 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. [role="xpack"]
  2. [[active-directory-realm]]
  3. === Active Directory user authentication
  4. You can configure {security} to communicate with Active Directory to authenticate
  5. users. To integrate with Active Directory, you configure an `active_directory`
  6. realm and map Active Directory users and groups to {security} roles in the
  7. <<mapping-roles, role mapping file>>.
  8. See {ref}/configuring-ad-realm.html[Configuring an Active Directory Realm].
  9. {security} uses LDAP to communicate with Active Directory, so `active_directory`
  10. realms are similar to <<ldap-realm, `ldap` realms>>. Like LDAP directories,
  11. Active Directory stores users and groups hierarchically. The directory's
  12. hierarchy is built from containers such as the _organizational unit_ (`ou`),
  13. _organization_ (`o`), and _domain controller_ (`dc`).
  14. The path to an entry is a _Distinguished Name_ (DN) that uniquely identifies a
  15. user or group. User and group names typically have attributes such as a
  16. _common name_ (`cn`) or _unique ID_ (`uid`). A DN is specified as a string, for
  17. example `"cn=admin,dc=example,dc=com"` (white spaces are ignored).
  18. {security} only supports Active Directory security groups. You cannot map
  19. distribution groups to roles.
  20. NOTE: When you use Active Directory for authentication, the username entered by
  21. the user is expected to match the `sAMAccountName` or `userPrincipalName`,
  22. not the common name.
  23. The Active Directory realm authenticates users using an LDAP bind request. After
  24. authenticating the user, the realm then searches to find the user's entry in
  25. Active Directory. Once the user has been found, the Active Directory realm then
  26. retrieves the user's group memberships from the `tokenGroups` attribute on the
  27. user's entry in Active Directory.
  28. [[ad-load-balancing]]
  29. ==== Load balancing and failover
  30. The `load_balance.type` setting can be used at the realm level to configure how
  31. {security} should interact with multiple Active Directory servers. Two modes of
  32. operation are supported: failover and load balancing.
  33. See {ref}/security-settings.html#load-balancing[Load Balancing and Failover Settings].
  34. [[ad-settings]]
  35. ==== Active Directory realm settings
  36. See {ref}/security-settings.html#ref-ad-settings[Active Directory Realm Settings].
  37. [[mapping-roles-ad]]
  38. ==== Mapping Active Directory users and groups to roles
  39. See {ref}/configuring-ad-realm.html[Configuring an Active Directory realm].
  40. [[ad-user-metadata]]
  41. ==== User metadata in Active Directory realms
  42. When a user is authenticated via an Active Directory realm, the following
  43. properties are populated in the user's _metadata_:
  44. |=======================
  45. | Field | Description
  46. | `ldap_dn` | The distinguished name of the user.
  47. | `ldap_groups` | The distinguished name of each of the groups that were
  48. resolved for the user (regardless of whether those
  49. groups were mapped to a role).
  50. |=======================
  51. This metadata is returned in the
  52. {ref}/security-api-authenticate.html[authenticate API] and can be used with
  53. <<templating-role-query, templated queries>> in roles.
  54. Additional metadata can be extracted from the Active Directory server by configuring
  55. the `metadata` setting on the Active Directory realm.
  56. [[active-directory-ssl]]
  57. ==== Setting up SSL between Elasticsearch and Active Directory
  58. See
  59. {ref}/configuring-tls.html#tls-active-directory[Encrypting communications between {es} and Active Directory].