Set up Enterprise Search with PKI user authentication
editSet up Enterprise Search with PKI user authentication
editThis feature is not available for all Elastic subscription levels. Refer to the subscriptions pages for Elastic Cloud and Elastic Stack. To change your subscription level or start a trial, see Elastic subscription.
The following documentation describes the process of configuring Elasticsearch and Kibana:
Within your Enterprise Search configuration settings, make sure that:
-
kibana.host
is set -
kibana.external_url
is set -
any
auth.source
configurations are removed.
Configure Enterprise Search role mappings for PKI users
editWhen you configured Elasticsearch and Kibana for PKI authentication using the documentation links above, one of the steps advised you to create a role mapping to be able to access Kibana. As a very simple and permissive example, you can give all users in pki1
realm superuser
role, and that will also give them full access to App Search and Workplace Search:
PUT /_security/role_mapping/pki1_mapping { "roles": [ "superuser" ], "enabled": true, "rules": { "all": [ {"field": { "realm.name": "pki1"}}} ] } }
However, it’s better to have more control. In the following example, users who successfully log in to the pki1
realm get full access to Kibana, but no access to Enterprise Search:
PUT /_security/role_mapping/pki1_mapping { "roles": [ "kibana_admin" ], "enabled": true, "rules": { "all": [ {"field": { "realm.name": "pki1"}}} ] } }
In this case, pki1
users can be managed via Enterprise Search mappings. Before any mappings can be created, it is necessary to enable role-based access (RBAC) mode in either App Search or Workplace Search. After that, users can be mapped in Users and Roles.
Mapping can use common Elasticsearch user attributes, such as username
and email
, but also anything provided in metadata
that is returned by the provider. A user logged in with a PKI certificate would have a pki_dn
(distinguished name) populated in metadata
. Example:
{ "pki_dn": "CN=john.smith, OU=Example Company Users, DC=example, DC=com", "pki_delegated_by_realm": "pki1", "pki_delegated_by_user": "localhost" }
We could give users different permissions applying a pattern match on the pki_dn
. In the following snippet, Example Company Users would get user-level permissions to Workplace Search:
PUT /_security/role_mapping/pki1_mapping { "roles": [ "enterprise-search-workplace-search-user" ], "enabled": true, "rules": { "all": [ {"field": { "dn": "*, OU=Example Company Users, DC=example, DC=com"}}} ] } }
However, Example Company Admins would get admin-level permissions:
PUT /_security/role_mapping/pki1_mapping { "roles": [ "enterprise-search-workplace-search-admin" ], "enabled": true, "rules": { "all": [ {"field": { "dn": "*, OU=Example Company Admins, DC=example, DC=com"}}} ] } }