realm-chains.asciidoc 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. [role="xpack"]
  2. [[realm-chains]]
  3. === Realm chains
  4. <<realms,Realms>> live within a _realm chain_. It is essentially a prioritized
  5. list of configured realms (typically of various types). Realms are consulted in
  6. ascending order (that is to say, the realm with the lowest `order` value is
  7. consulted first). You should make sure each configured realm has a distinct
  8. `order` setting. In the event that two or more realms have the same `order`,
  9. they are processed in `name` order.
  10. During the authentication process, {stack} {security-features} consult and try
  11. to authenticate the request one realm at a time. Once one of the realms
  12. successfully authenticates the request, the authentication is considered to be
  13. successful. The authenticated user is associated with the request, which then
  14. proceeds to the authorization phase. If a realm cannot authenticate the request,
  15. the next realm in the chain is consulted. If all realms in the chain cannot
  16. authenticate the request, the authentication is considered to be unsuccessful
  17. and an authentication error is returned (as HTTP status code `401`).
  18. NOTE: Some systems (e.g. Active Directory) have a temporary lock-out period
  19. after several successive failed login attempts. If the same username exists in
  20. multiple realms, unintentional account lockouts are possible. For more
  21. information, see <<trouble-shoot-active-directory>>.
  22. The default realm chain contains the `native` and `file` realms. To explicitly
  23. configure a realm chain, you specify the chain in the `elasticsearch.yml` file.
  24. When you configure a realm chain, only the realms you specify are used for
  25. authentication. To use the `native` and `file` realms, you must include them in
  26. the chain.
  27. The following snippet configures a realm chain that includes the `file` and
  28. `native` realms, as well as two LDAP realms and an Active Directory realm.
  29. [source,yaml]
  30. ----------------------------------------
  31. xpack.security.authc.realms:
  32. file.file1:
  33. order: 0
  34. native.native1:
  35. order: 1
  36. ldap.ldap1:
  37. order: 2
  38. enabled: false
  39. url: 'url_to_ldap1'
  40. ...
  41. ldap.ldap2:
  42. order: 3
  43. url: 'url_to_ldap2'
  44. ...
  45. active_directory.ad1:
  46. order: 4
  47. url: 'url_to_ad'
  48. ----------------------------------------
  49. As can be seen above, each realm has a unique name that identifies it. Each type
  50. of realm dictates its own set of required and optional settings. That said,
  51. there are
  52. <<ref-realm-settings,settings that are common to all realms>>.
  53. [[authorization_realms]]
  54. ==== Delegating authorization to another realm
  55. Some realms have the ability to perform _authentication_ internally, but
  56. delegate the lookup and assignment of roles (that is, _authorization_) to
  57. another realm.
  58. For example, you may wish to use a PKI realm to authenticate your users with
  59. TLS client certificates, then lookup that user in an LDAP realm and use their
  60. LDAP group assignments to determine their roles in Elasticsearch.
  61. Any realm that supports retrieving users (without needing their credentials) can
  62. be used as an _authorization realm_ (that is, its name may appear as one of the
  63. values in the list of `authorization_realms`). See <<run-as-privilege>> for
  64. further explanation on which realms support this.
  65. For realms that support this feature, it can be enabled by configuring the
  66. `authorization_realms` setting on the authenticating realm. Check the list of
  67. <<realm-settings,supported settings>> for each realm
  68. to see if they support the `authorization_realms` setting.
  69. If delegated authorization is enabled for a realm, it authenticates the user in
  70. its standard manner (including relevant caching) then looks for that user in the
  71. configured list of authorization realms. It tries each realm in the order they
  72. are specified in the `authorization_realms` setting. The user is retrieved by
  73. principal - the user must have identical usernames in the _authentication_ and
  74. _authorization realms_. If the user cannot be found in any of the authorization
  75. realms, authentication fails.
  76. See <<configuring-authorization-delegation>> for more details.
  77. NOTE: Delegated authorization requires a
  78. https://www.elastic.co/subscriptions[Platinum or Trial license].