Common SAML issues
Some of the common SAML problems are shown below with tips on how to resolve these issues.
- Symptoms: Authentication in Kibana fails and the following error is printed in the Elasticsearch logs:
Cannot find any matching realm for [SamlPrepareAuthenticationRequest{realmName=saml1, assertionConsumerServiceURL=https://my.kibana.url/api/security/saml/callback}]
xpack.security.authc.providers.saml.<provider-name>.realm
setting to explicitly set the SAML realm name in Kibana. It must match the name of the SAML realm that is configured in Elasticsearch. If you get an error like the one above, it possibly means that the value ofxpack.security.authc.providers.saml.<provider-name>.realm
in your Kibana configuration is wrong. Verify that it matches the name of the configured realm in Elasticsearch, which is the string afterxpack.security.authc.realms.saml.
in your Elasticsearch configuration. - Symptoms: Authentication in Kibana fails and the following error is printed in the Elasticsearch logs:
Authentication to realm saml1 failed - Provided SAML response is not valid for realm saml/saml1 (Caused by ElasticsearchSecurityException[Conditions [https://5aadb9778c594cc3aad0efc126a0f92e.kibana.company....ple.com/] do not match required audience [https://5aadb9778c594cc3aad0efc126a0f92e.kibana.company.example.com]])
elasticsearch.yml
(sp.entity_id
) does not match what has been configured as the SAML Service Provider Entity ID in the SAML Identity Provider documentation. To resolve this issue, ensure that both the saml realm in Elasticsearch and the IdP are configured with the same string for the SAML Entity ID of the Service Provider. In the Elasticsearch log, just before the exception message (above), there will also be one or moreINFO
level messages of the formAudience restriction [https://5aadb9778c594cc3aad0efc126a0f92e.kibana.company.example.com/] does not match required audience [https://5aadb9778c594cc3aad0efc126a0f92e.kibana.company.example.com] (difference starts at character [#68] [/] vs [])
These strings are compared as case-sensitive strings and not as canonicalized URLs even when the values are URL-like. Be mindful of trailing slashes, port numbers, etc.
:::: - Symptoms: Authentication in Kibana fails and the following error is printed in the Elasticsearch logs:
Cannot find metadata for entity [your:entity.id] in [metadata.xml]
your:entity.id
in the configured metadata file (metadata.xml
).- Ensure that the
metadata.xml
file you are using is indeed the one provided by your SAML Identity Provider. - Ensure that the
metadata.xml
file contains one <EntityDescriptor> element as follows:<EntityDescriptor ID="0597c9aa-e69b-46e7-a1c6-636c7b8a8070" entityID="https://saml.example.com/f174199a-a96e-4201-88f1-0d57a610c522/" ...
where the value of theentityID
attribute is the same as the value of theidp.entity_id
that you have set in your SAML realm configuration inelasticsearch.yml
. - Note that these are also compared as case-sensitive strings and not as canonicalized URLs even when the values are URL-like.
- Ensure that the
- Symptoms: Authentication in Kibana fails and the following error is printed in the Elasticsearch logs:
unable to authenticate user [<unauthenticated-saml-user>] for action [cluster:admin/xpack/security/saml/authenticate]
<unauthenticated-saml-user>
placeholder is used instead. To diagnose the actual problem, you must check the Elasticsearch logs for further details. - Symptoms: Authentication in Kibana fails and the following error is printed in the Elasticsearch logs:
Authentication to realm <saml-realm-name> failed - SAML Attribute [<AttributeName0>] for [xpack.security.authc.realms.saml.<saml-realm-name>.attributes.principal] not found in saml attributes [<AttributeName1>=<AttributeValue1>, <AttributeName2>=<AttributeValue2>, ...] or NameID [ NameID(format)=value ]
xpack.security.authc.realms.saml.<saml-realm-name>.attributes.principal: AttributeName0
AttributeName0
or aNameID
with the appropriate format in the SAML response so that it can map it to theprincipal
user property. Theprincipal
user property is a mandatory one, so if this mapping can’t happen, the authentication fails. If you are attempting to map aNameID
, make sure that the expectedNameID
format matches the one that is sent. See Special attribute names for more details. If you are attempting to map a SAML attribute and it is not part of the list in the error message, it might mean that you have misspelled the attribute name, or that the IdP is not sending this particular attribute. You might be able to use another attribute from the list to map toprincipal
or consult with your IdP administrator to determine if the required attribute can be sent. - Symptoms: Authentication in Kibana fails and the following error is printed in the Elasticsearch logs:
Cannot find [{urn:oasis:names:tc:SAML:2.0:metadata}IDPSSODescriptor]/[urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect] in descriptor
<SingleSignOnService>
endpoint with binding of HTTP-Redirect (urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect). Elasticsearch supports only theHTTP-Redirect
binding for SAML authentication requests (and it doesn’t support theHTTP-POST
binding). Consult your IdP administrator in order to enable at least one<SingleSignOnService>
supportingHTTP-Redirect
binding and update your IdP SAML Metadata. - Symptoms: Authentication in Kibana fails and the following error is printed in the Elasticsearch logs:
Authentication to realm my-saml-realm failed - Provided SAML response is not valid for realm saml/my-saml-realm (Caused by ElasticsearchSecurityException[SAML Response is not a 'success' response: The SAML IdP did not grant the request. It indicated that the Elastic Stack side sent something invalid (urn:oasis:names:tc:SAML:2.0:status:Requester). Specific status code which might indicate what the issue is: [urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy]] )
-
urn:oasis:names:tc:SAML:2.0:status:AuthnFailed
: The SAML Identity Provider failed to authenticate the user. There is not much to troubleshoot on the Elastic Stack side for this status, the logs of the SAML Identity Provider will hopefully offer much more information. -
urn:oasis:names:tc:SAML:2.0:status:InvalidNameIDPolicy
: The SAML Identity Provider cannot support releasing a NameID with the requested format. When creating SAML Authentication Requests, Elasticsearch sets the NameIDPolicy element of the Authentication request with the appropriate value. This is controlled by thenameid_format
configuration parameter inelasticsearch.yml
, which if not set defaults tourn:oasis:names:tc:SAML:2.0:nameid-format:transient
. This instructs the Identity Provider to return a NameID with that specific format in the SAML Response. If the SAML Identity Provider cannot grant that request, for example because it is configured to release a NameID format withurn:oasis:names:tc:SAML:2.0:nameid-format:persistent
format instead, it returns this error indicating an invalid NameID policy. This issue can be resolved by adjustingnameid_format
to match the format the SAML Identity Provider can return or by setting it tourn:oasis:names:tc:SAML:2.0:nameid-format:unspecified
so that the Identity Provider is allowed to return any format it wants.
-
- Symptoms: Authentication in Kibana fails and the following error is printed in the Elasticsearch logs:
The XML Signature of this SAML message cannot be validated. Please verify that the saml realm uses the correct SAMLmetadata file/URL for this Identity Provider
- As the error message indicates, the most common cause is that the wrong metadata file is used and as such the public key it contains doesn’t correspond to the private key the Identity Provider uses.
- The configuration of the Identity Provider has changed or the key has been rotated and the metadata file that Elasticsearch is using has not been updated.
- The SAML Response has been altered in transit and the signature cannot be validated even though the correct key is used.
The private keys and public keys and self-signed X.509 certificates that are used in SAML for digital signatures as described above have no relation to the keys and certificates that are used for TLS either on the transport or the http layer. A failure such as the one described above has nothing to do with yourxpack.ssl
related configuration.
:::: - Symptoms: Users are unable to login with a local username and password in Kibana because SAML is enabled. Resolution: If you want your users to be able to use local credentials to authenticate to Kibana in addition to using the SAML realm for Single Sign-On, you must enable the
basic
authProvider
in Kibana. The process is documented in the SAML Guide - Symptoms: No SAML request ID values are being passed from Kibana to Elasticsearch:
Caused by org.elasticsearch.ElasticsearchSecurityException: SAML content is in-response-to [_A1B2C3D4E5F6G8H9I0] but expected one of []
xpack.security.sameSiteCookies
is not set toStrict
. Depending on your configuration, you may be able to rely on the default value or explicitly set the value toNone
. For further information, please read MDN SameSite cookies If you serve multiple Kibana installations behind a load balancer make sure to use the same security configuration for all installations.
Logging:
If the previous resolutions do not solve your issue, enable additional logging for the SAML realm to troubleshoot further. You can enable debug logging by configuring the following persistent setting:
PUT /_cluster/settings
{
"persistent": {
"logger.org.elasticsearch.xpack.security.authc.saml": "debug"
}
}
Alternatively, you can add the following lines to the end of the log4j2.properties
configuration file in the ES_PATH_CONF
:
logger.saml.name = org.elasticsearch.xpack.security.authc.saml
logger.saml.level = DEBUG
Refer to configuring logging levels for more information.