configuring-authorization-delegation.asciidoc 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. [role="xpack"]
  2. [[configuring-authorization-delegation]]
  3. === Configuring authorization delegation
  4. In some cases, after the user has been authenticated by a realm, we may
  5. want to delegate user lookup and assignment of roles to another realm.
  6. Any realm that supports retrieving users (without needing their credentials)
  7. can be used as an authorization realm.
  8. For example, a user that is authenticated by the Kerberos realm can be looked up
  9. in the LDAP realm. The LDAP realm takes on responsibility for searching the user
  10. in LDAP and determining the role. In this case, the LDAP realm acts as an
  11. _authorization realm_.
  12. ==== LDAP realm as an authorization realm
  13. Following is an example configuration for the LDAP realm that can be used as
  14. an _authorization realm_. This LDAP realm is configured in user search mode
  15. with a specified filter.
  16. For more information on configuring LDAP realms see <<ldap-realm>>.
  17. [source, yaml]
  18. ------------------------------------------------------------
  19. xpack:
  20. security:
  21. authc:
  22. realms:
  23. ldap:
  24. ldap1:
  25. order: 0
  26. authentication.enabled: true <1>
  27. user_search:
  28. base_dn: "dc=example,dc=org"
  29. filter: "(cn={0})"
  30. group_search:
  31. base_dn: "dc=example,dc=org"
  32. files:
  33. role_mapping: "ES_PATH_CONF/role_mapping.yml"
  34. unmapped_groups_as_roles: false
  35. ------------------------------------------------------------
  36. <1> Here, we explicitly allow the LDAP realm to be used for authentication
  37. (that is, users can authenticate using their LDAP username and password).
  38. If we wanted this LDAP realm to be used for authorization only, then we
  39. would set this to `false`.
  40. ==== Kerberos realm configured to delegate authorization
  41. Following is an example configuration where the Kerberos realm authenticates a
  42. user and then delegates authorization to the LDAP realm. The
  43. Kerberos realm authenticates the user and extracts user principal name
  44. (usually of format `user@REALM`). In this example, we enable the `remove_realm_name`
  45. setting to remove the `@REALM` part from the user principal name to get the username.
  46. This username is used to do a user lookup by the configured authorization realms (in this case the LDAP realm).
  47. For more information on Kerberos realm see <<kerberos-realm>>.
  48. [source, yaml]
  49. ------------------------------------------------------------
  50. xpack:
  51. security:
  52. authc:
  53. realms:
  54. kerberos:
  55. kerb1:
  56. order: 1
  57. keytab.path: "ES_PATH_CONF/es.keytab"
  58. remove_realm_name: true
  59. authorization_realms: ldap1
  60. ------------------------------------------------------------
  61. ==== PKI realm configured to delegate authorization
  62. We can similarly configure PKI realm to delegate authorization to LDAP realm.
  63. The user is authenticated by the PKI realm and the authorization is delegated to
  64. the LDAP realm. In this example, the username is the common name (CN)
  65. extracted from the DN of the client certificate. The LDAP realm uses this
  66. username to lookup user and assign the role.
  67. For more information on PKI realms see <<pki-realm>>.
  68. [source, yaml]
  69. ------------------------------------------------------------
  70. xpack:
  71. security:
  72. authc:
  73. realms:
  74. pki:
  75. pki1:
  76. order: 2
  77. authorization_realms: ldap1
  78. ------------------------------------------------------------
  79. Similar to the above examples, we can configure realms to delegate authorization to
  80. authorization realms (which have the capability to lookup users by the username and assign roles).