Configuring Kibana

edit

SAML authentication in Kibana requires a small number of additional settings in addition to the standard Kibana security configuration. The Kibana security documentation provides details on the available configuration options that you can apply.

In particular, since your Elasticsearch nodes have been configured to use TLS on the HTTP interface, you must configure Kibana to use a https URL to connect to Elasticsearch, and you may need to configure elasticsearch.ssl.certificateAuthorities to trust the certificates that Elasticsearch has been configured to use.

SAML authentication in Kibana is also subject to the xpack.security.sessionTimeout setting that is described in the Kibana security documentation, and you may wish to adjust this timeout to meet your local needs.

The three additional settings that are required for SAML support are shown below:

xpack.security.authc.providers: [saml]
xpack.security.authc.saml.realm: saml1
server.xsrf.whitelist: [/api/security/v1/saml]

The configuration values used in the example above are:

xpack.security.authc.providers
Set this to [ saml ] to instruct Kibana to use SAML SSO as the authentication method.
xpack.security.authc.saml.realm
Set this to the name of the SAML realm that you have used in your Elasticsearch realm configuration, for instance: saml1
server.xsrf.whitelist
Kibana has in-built protection against Cross Site Request Forgery attacks which are designed to prevent the Kibana server from processing requests that originated from outside the Kibana application. In order to support SAML authentication messages that originate from your Identity Provider, we need to explicitly whitelist the SAML authentication URL within Kibana, so that the Kibana server will not reject these external messages.

Supporting SAML and basic authentication in Kibana

edit

The SAML support in Kibana is designed on the expectation that it will be the primary (or sole) authentication method for users of that Kibana instance. However, it is possible to support both SAML and Basic authentication within a single Kibana instance by setting xpack.security.authc.providers as per the example below:

xpack.security.authc.providers: [saml, basic]

The order is important - this will initiate SAML authentication for unauthenticated users, but will accept basic authentication.

If Kibana is configured in this way, then users who wish to login with a username and password, can do so by directly accessing the /login page in Kibana. This login will not use SAML credentials, and will rely on one of the other security realms within Elasticsearch. Only users who have a username and password for a configured Elasticsearch authentication realm will be able to login via this page.

Alternatively, when the basic authentication provider is enabled, you can place a reverse proxy in front of Kibana, and configure it to send a basic authentication header (Authorization: Basic ....) for each request. If this header is present and valid, Kibana will not initiate the SAML authentication process.

Operating multiple Kibana instances

edit

If you wish to have multiple Kibana instances that authenticate against the same Elasticsearch cluster, then each Kibana instance that is configured for SAML authentication, requires its own SAML realm.

Each SAML realm must have its own unique Entity ID (sp.entity_id), and its own Assertion Consumer Service (sp.acs). Each Kibana instance will be mapped to the correct realm by looking up the matching sp.acs value.

These realms may use the same Identity Provider, but are not required to.

The following is example of having 3 difference Kibana instances, 2 of which use the same internal IdP, and another which uses a different IdP.

xpack.security.authc.realms.saml.saml_finance:
  order: 2
  idp.metadata.path: saml/idp-metadata.xml
  idp.entity_id: "https://sso.example.com/"
  sp.entity_id:  "https://kibana.finance.example.com/"
  sp.acs: "https://kibana.finance.example.com/api/security/v1/saml"
  sp.logout: "https://kibana.finance.example.com/logout"
  attributes.principal: "urn:oid:0.9.2342.19200300.100.1.1"
  attributes.groups: "urn:oid:1.3.6.1.4.1.5923.1.5.1."
xpack.security.authc.realms.saml.saml_sales:
  order: 3
  idp.metadata.path: saml/idp-metadata.xml
  idp.entity_id: "https://sso.example.com/"
  sp.entity_id:  "https://kibana.sales.example.com/"
  sp.acs: "https://kibana.sales.example.com/api/security/v1/saml"
  sp.logout: "https://kibana.sales.example.com/logout"
  attributes.principal: "urn:oid:0.9.2342.19200300.100.1.1"
  attributes.groups: "urn:oid:1.3.6.1.4.1.5923.1.5.1."
xpack.security.authc.realms.saml.saml_eng:
  order: 4
  idp.metadata.path: saml/idp-external.xml
  idp.entity_id: "https://engineering.sso.example.net/"
  sp.entity_id:  "https://kibana.engineering.example.com/"
  sp.acs: "https://kibana.engineering.example.com/api/security/v1/saml"
  sp.logout: "https://kibana.engineering.example.com/logout"
  attributes.principal: "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn"

It is possible to have one or more Kibana instances that use SAML, while other instances use basic authentication against another realm type (e.g. Native or LDAP).