I have ldap realm configured to allow access to elasticsearch APIs. I also have SAML configured for kibana.
Now I want to setup user authorisation in saml using ldap realm instead of api based role mapping. I read this in elastic documentation _;
If your users also exist in a repository that can be directly accessed by Elasticsearch (such as an LDAP directory) then you can use authorization realms instead of role mappings.
In this case, you perform the following steps: 1. In your SAML realm, assigned a SAML attribute to act as the lookup userid, by configuring the attributes.principal setting. 2. Create a new realm that can lookup users from your local repository (e.g. an ldap realm) 3. In your SAML realm, set authorization_realms to the name of the realm you created in step 2.
attributes.principal needs to specify a SAML attribute (or nameid) that matches exactly with the userid you use in LDAP.
That is, something that your SAML IdP sends to ES that we can substitute into uid={0},ou=people,o=mine.com,o=email in order to get the correct DN for the LDAP bind.
Without knowing what your SAML setup looks like, I can't give you any more details than that.
The SAML Assertion contained the following attributes:
You have mentioned that you want to delegate the authorization to the LDAP realm. As Tim already explainer earlier: In order to do that, you need to configure attributes.principal to be the SAML Attribute that contains the value that is the user's uid in LDAP. So from all the SAML attributes that your IDP is sending and you need to determine which one has a value that corresponds to the value of the uid Attribute in LDAP.
Please do not share any SAML role mappings as these are irrelevant to the above and only complicate the discussion without adding any benefit. You have said that you want to do delegation in the LDAP realm ( == NOT in the SAML realm) , so -once the issue above is fixed- you would need to create role mappings that use information from the LDAP realm (see here for more information), and not the SAML one.
Slightly unrelated to the above discussion: Are you certain you need to delegate authorization to an LDAP realm ? It looks like that the SAML IDP uses this same LDAP to authenticate the users and it also gets their group memberships and releases this information within the SAML Assertion as the groups attribute. Why not use the value of groups attribute from SAML and SAML Role mappings to assign roles to your users instead of doing an extra call to your LDAP (by using the LDAP realm as an authorization realm ) in order to get the group membership information that you already have ?
Please take the time to correctly format your posts. It greatly helps people that try to assist you. You can use the preview panel on the right to make sure your post looks fine. It would be great if you can fix that for your previous post.
Also do take the time to explain what you want to achieve, so that we can help you do that. Judging from what you said above, is it safe to assume that you don't want to use LDAP as an authorization realm anymore, and we should focus on getting your saml role mappings right ?
Finally, please do provider all the information you are asked to provide in previous answers. This will minimize the number of posts all of us have to write and eventually help you resolve your issues quickly. I Asked you above:
Did you do that ? What is this output? Can you share the logs with us ?
No, as you can imagine we need to decrypt the assertion in order to consume it, so we get access to the attributes.
I can't understand how this happens, as we do print them in TRACE level. If you can't find them, can you at least copy paste here the part of your logs where the SAML authentication happens?
p.s. your post above is still not correctly formatted Please fix that.
You should be looking for a line that starts with The SAML Assertion contained the following attributes: . What you have shared is you looking for the string response.
As you can also find in our documentation you need to map the saml attribute to the relevant user property in elasticsearch and then use that property in your role mappings. More concretely you need to add
attributes.groups: Groups
to your saml realm configuration in elasticsearch.yml and then change your role mapping rule to
PUT /_cluster/settings
{
"transient": {
"logger.org.elasticsearch.xpack.security.authc.support.mapper": "trace"
}
}
try to login again and look into (or share for us to look) your elasticsearch logs. The reason you are not getting authorized will be evident there. If you do select to share your logs, please do not use tail and grep as this will output only one line from the log entry and we need to see all of it. Grab the part of logs that is relevant to this troubleshooting and copy paste it here (using the proper formatting )
Can you also share how the relevant part to Groups within the
The problem is the above. Your IDP is sending all your groups in a comma separated string. The usual way to send multivalued attributes in SAML is to have multiple <AttributeValue> elements. So we would expect to get:
Glad you sorted this out. If you get the IDP to start sending you the groups one per AttributeValue instead of a comma separated string, then you can go back and change
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.