ldap-realm.asciidoc 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. [role="xpack"]
  2. [[ldap-realm]]
  3. === LDAP user authentication
  4. You can configure the {stack} {security-features} to communicate with a
  5. Lightweight Directory Access Protocol (LDAP) server to authenticate users. To
  6. integrate with LDAP, you configure an `ldap` realm and map LDAP groups to user
  7. roles in the <<mapping-roles, role mapping file>>.
  8. LDAP stores users and groups hierarchically, similar to the way folders are
  9. grouped in a file system. An LDAP directory's hierarchy is built from containers
  10. such as the _organizational unit_ (`ou`), _organization_ (`o`), and
  11. _domain controller_ (`dc`).
  12. The path to an entry is a _Distinguished Name_ (DN) that uniquely identifies a
  13. user or group. User and group names typically have attributes such as a
  14. _common name_ (`cn`) or _unique ID_ (`uid`). A DN is specified as a string,
  15. for example `"cn=admin,dc=example,dc=com"` (white spaces are ignored).
  16. The `ldap` realm supports two modes of operation, a user search mode
  17. and a mode with specific templates for user DNs.
  18. [[ldap-user-search]]
  19. ==== User search mode and user DN templates mode
  20. See <<configuring-ldap-realm>>.
  21. [[ldap-load-balancing]]
  22. ==== Load balancing and failover
  23. The `load_balance.type` setting can be used at the realm level to configure how
  24. the {security-features} should interact with multiple LDAP servers. The
  25. {security-features} support both failover and load balancing modes of operation.
  26. See
  27. <<load-balancing>>.
  28. [[ldap-settings]]
  29. ==== LDAP realm settings
  30. See <<ref-ldap-settings>>.
  31. [[mapping-roles-ldap]]
  32. ==== Mapping LDAP groups to roles
  33. An integral part of a realm authentication process is to resolve the roles
  34. associated with the authenticated user. Roles define the privileges a user has
  35. in the cluster.
  36. Since with the `ldap` realm the users are managed externally in the LDAP server,
  37. the expectation is that their roles are managed there as well. In fact, LDAP
  38. supports the notion of groups, which often represent user roles for different
  39. systems in the organization.
  40. The `ldap` realm enables you to map LDAP users to roles via their LDAP
  41. groups, or other metadata. This role mapping can be configured via the
  42. <<security-api-put-role-mapping,add role mapping API>> or by using a
  43. file stored on each node. When a user authenticates with LDAP, the privileges
  44. for that user are the union of all privileges defined by the roles to which
  45. the user is mapped. For more information, see
  46. <<configuring-ldap-realm>>.
  47. [[ldap-user-metadata]]
  48. ==== User metadata in LDAP realms
  49. When a user is authenticated via an LDAP realm, the following properties are
  50. populated in the user's _metadata_:
  51. |=======================
  52. | Field | Description
  53. | `ldap_dn` | The distinguished name of the user.
  54. | `ldap_groups` | The distinguished name of each of the groups that were
  55. resolved for the user (regardless of whether those
  56. groups were mapped to a role).
  57. |=======================
  58. This metadata is returned in the
  59. <<security-api-authenticate,authenticate API>>, and can be used with
  60. <<templating-role-query, templated queries>> in roles.
  61. Additional fields can be included in the user's metadata by configuring
  62. the `metadata` setting on the LDAP realm. This metadata is available for use
  63. with the <<mapping-roles-api, role mapping API>> or in
  64. <<templating-role-query, templated role queries>>.
  65. [[ldap-ssl]]
  66. ==== Setting up SSL between Elasticsearch and LDAP
  67. See
  68. <<tls-ldap>>.