Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for "authorization_realms" #33262

Merged
merged 23 commits into from
Aug 31, 2018
Merged

Add support for "authorization_realms" #33262

merged 23 commits into from
Aug 31, 2018

Conversation

tvernum
Copy link
Contributor

@tvernum tvernum commented Aug 30, 2018

Authorization Realms allow an authenticating realm to delegate the task
of constructing a User object (with name, roles, etc) to one or more
other realms.

E.g. A client could authenticate using PKI, but then delegate to an LDAP
realm. The LDAP realm performs a "lookup" by principal, and then does
regular role-mapping from the discovered user.

This commit includes:

  • authorization_realm support in the pki, ldap, saml & kerberos realms
  • docs for authorization_realms
  • checks that there are no "authorization chains"
    (whereby "realm-a" delegates to "realm-b", but "realm-b" delegates to "realm-c"

Authorizing_realms is a platinum feature.

tvernum and others added 23 commits July 17, 2018 15:37
Authorizing Realms allow an authenticating realm to delegate the task
of constructing a User object (with name, roles, etc) to one or more
other realms.
This commit allows the PKI realm to delegate authorization to any
other configured realm
Makes "authorizing_realms" a platinum (or trial) feature.

If the license is not compliant, then any attempt to authenticate will
fail in the same way that "cannot find lookup user" fails, but with a
"license not compliant" message.
This allows an LDAP realm (but not, in this commit, active directory)
to delegate the User construction to one or more other realms.

The LDAP realm caches the user in order to avoid hitting the directory
for to authenticate every action, but this cache is only used for
password checking. The delegated realms are consulted for each request
and this relies on the cache for each of those realms.
The previous name incorrectly implies that the realms are actively
authorizing something, however the reality is that they are realms
that are consulted for the purposes of authorization.
This commit allows Kerberos realm to delegate `User` creation
to configured authorization realms.
If no authorization realms are configured, then Kerberos realm
uses native role mapper to resolve User.
In the case of delegated realms, users are not cached.
Allows a SAML realm to lookup user data from another realm (e.g.
native, or LDAP) rather than using role mapping from SAML attributes
# Conflicts:
#	x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/kerberos/KerberosRealmTests.java
# Conflicts:
#	x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/kerberos/KerberosRealmTests.java
Adds links to the "authorization_realms" (Delegating authorization to
another realm) section to each of the applicable realms, and adds the
"authorization_realms" setting to the list of realm settings.
Update Kerberos docs to mention authorization_realms as an
alternative to role mapping.
If realm "A" delegates authoriaation to realm "B" then it is not
permissible for realm "B" to also be using delegated authorization.
A realm which is in the value for "authorization_realms" must handle
its own authorization.
@tvernum tvernum added >feature v7.0.0 :Security/Authentication Logging in, Usernames/passwords, Realms (Native/LDAP/AD/SAML/PKI/etc) :Security/Authorization Roles, Privileges, DLS/FLS, RBAC/ABAC v6.5.0 labels Aug 30, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-security

@tvernum tvernum requested a review from bizybot August 30, 2018 08:15
@tvernum tvernum requested a review from jaymode August 30, 2018 08:15
@tvernum
Copy link
Contributor Author

tvernum commented Aug 30, 2018

Every (non-merge) commit in this PR was reviewed before being merged to the security-lookup-realms branch.
It shouldn't be necessary to do a full code review, but rather confirm that:

  • we think this is ready to merge to master
  • we think that it has all the features we expected for 6.5

Copy link
Member

@jaymode jaymode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jaymode
Copy link
Member

jaymode commented Aug 30, 2018

I've had a thought and we may have discussed it before, but I've lost the outcome of the discussion. I have a strong feeling that we should have a realm setting authentication.enabled, which would default to true. If a user wants to add a authorization only realm then they can set this to false. An example use case is the desire is to only allow non built in user to login with SAML but still pull the authorization data from the backend LDAP. What do you think?

This is a simple change IMO and I wouldn't hold up this merge for this as we can open a issue and deal with in a follow on if we come to an agreement that this makes sense to add.

@tvernum
Copy link
Contributor Author

tvernum commented Aug 31, 2018

You're right. That had been in the back of my head, but I forgot. I raised #33292 with the aim to include it in 6.5

Copy link
Contributor

@bizybot bizybot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thank you.

@tvernum tvernum merged commit 273c82d into master Aug 31, 2018
dnhatn added a commit that referenced this pull request Aug 31, 2018
* master:
  Integrates soft-deletes into Elasticsearch (#33222)
  Revert "Integrates soft-deletes into Elasticsearch (#33222)"
  Add support for "authorization_realms" (#33262)
tvernum added a commit to tvernum/elasticsearch that referenced this pull request Sep 25, 2018
Authorization Realms allow an authenticating realm to delegate the
task of constructing a User object (with name, roles, etc) to one
or more other realms.

E.g. A client could authenticate using PKI, but then delegate to
an LDAP realm. The LDAP realm performs a "lookup" by principal,
and then does regular role-mapping from the discovered user.

This commit includes:
- authorization_realm support in the pki, ldap, saml & kerberos realms
- docs for authorization_realms
- checks that there are no "authorization chains"
   (whereby "realm-a" delegates to "realm-b", but "realm-b"
    delegates to "realm-c")

Authorization realms is a platinum feature.
tvernum added a commit that referenced this pull request Sep 26, 2018
Authorization Realms allow an authenticating realm to delegate the
task of constructing a User object (with name, roles, etc) to one
or more other realms.

E.g. A client could authenticate using PKI, but then delegate to
an LDAP realm. The LDAP realm performs a "lookup" by principal,
and then does regular role-mapping from the discovered user.

This commit includes:
- authorization_realm support in the pki, ldap, saml & kerberos realms
- docs for authorization_realms
- checks that there are no "authorization chains"
   (whereby "realm-a" delegates to "realm-b", but "realm-b"
    delegates to "realm-c")

Authorization realms is a platinum feature.
@colings86 colings86 removed the :Security/Authentication Logging in, Usernames/passwords, Realms (Native/LDAP/AD/SAML/PKI/etc) label Nov 2, 2018
@bizybot bizybot deleted the security-lookup-realms branch February 7, 2019 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants