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

[DOCS] Separate "user lookup" into its own doc #88533

Merged
merged 6 commits into from
Aug 12, 2022

Conversation

tvernum
Copy link
Contributor

@tvernum tvernum commented Jul 14, 2022

When we introduced "authorization delegation" we piggy backed on the
implementation and documentation for "run as". The authorization
delegation docs just link to "run as" in order to explain which realms
support being the target of delegation.

However, authorization delegation is now at least as popular as
"run as", and forcing people to make sense of the "run as" docs and
apply them to their delegation authorization ("authorization_realm")
scenario wasn't helpful or clear.

This commit moves (and improves) the content for "lookup a user
without authentication" into a new page within the authentication
section, and links to it from both "run as" and "delegated
authorization".

Preview link: https://elasticsearch_88533.docs-preview.app.elstc.co/guide/en/elasticsearch/reference/master/user-lookup.html

When we introduced "authorization delegation" we piggy backed on the
implementation and documentation for "run as". The authorization
delegation docs just link to "run as" in order to explain which realms
support being the target of delegation.

However, authorization delegation is now at least as popular as
"run as", and forcing people to make sense of the "run as" docs and
apply them to their delegation authorization ("authorization_realm")
scenario wasn't helpful or clear.

This commit moves (and improves) the content for "lookup a user
without authentication" into a new page within the authentication
section, and links to it from both "run as" and "delegated
authorization".
@tvernum tvernum added >docs General docs changes :Security/Authentication Logging in, Usernames/passwords, Realms (Native/LDAP/AD/SAML/PKI/etc) v8.4.0 v8.3.3 labels Jul 14, 2022
@elasticmachine elasticmachine added Team:Docs Meta label for docs team Team:Security Meta label for security team labels Jul 14, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-docs (Team:Docs)

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-security (Team:Security)

`run-as` and delegated authorization features - there are no APIs for user lookup.
If you wish to test your user lookup configuration, then you can do this with
`run_as`. Use the <<security-api-authenticate>> API, authenticate as a
`superuser` (e.g. the builtin `elastic` user) and specify the
Copy link
Contributor

Choose a reason for hiding this comment

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

should we be de-emphasizing the built in 'elastic' user as well as the super user role ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so. It's the only user we ship with that is able to be used for this sort of testing, so I don't think there's any reason so avoid suggesting it as an option here.

Copy link
Contributor

@jakelandis jakelandis left a comment

Choose a reason for hiding this comment

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

changes look good ! I think this is very helpful. ++ as-is , but with minor wording suggestion

Copy link
Contributor

@lockewritesdocs lockewritesdocs left a comment

Choose a reason for hiding this comment

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

Added some minor suggestions for edits, but looks solid overall. Thanks for adding this page @tvernum!

Comment on lines 24 to 26
In each of the above cases the second user must be resolved without directly
authenticating. The ability for a realm to lookup a user by username is an
optional operation that is not supported by all realms.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
In each of the above cases the second user must be resolved without directly
authenticating. The ability for a realm to lookup a user by username is an
optional operation that is not supported by all realms.
In each of these cases, a user must first authenticate to one realm. Authorization is handled by looking up that user in a second realm. The user is authenticated in the first realm, but only must exist in the second realm (the user doesn't need credentials to the second realm). Querying the second realm for authorization purposes is known as user lookup.
See the <<run-as-privilege,run_as>> and <<authorization_realms,delegated authorization>> documentation for which realms support the ability to perform `run_as` or delegate authorization. In both cases, only the following realms can be used for the user lookup:

Copy link
Contributor

Choose a reason for hiding this comment

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

I like Jake's suggestion, so I added it as a suggested change with minor edits.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks Adam ... i really need to figure out how to do multi-line suggestions in GH (and edits look good)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the phrasing around "Authorization" is slightly misleading for run-as.

Authorization is performed for the first user to ensure they are permitted to "run as" the second user, and then authorization checks are performed again to ensure the 2nd user is permitted to execute the request.
The proposed wording implies that authorization is exclusive performed against the second user.

I'll try and come up with a variation that avoid that implication.

Copy link
Contributor

Choose a reason for hiding this comment

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

@tvernum, here's a suggested version that incorporates the distinction you highlighted:

In both cases, a user must authenticate to a realm first. After successfully authenticating, two authorization
checks occur:

  • The first check ensures that the authenticated user has privileges to execute requests as a different user.
  • The second check ensures that the unauthenticated user (the second user) has privileges to execute the
    specified request.

Querying the second realm to retrieve the unauthenticated user's privileges is known as a user lookup. The authenticated user doesn't need credentials in the second realm; they only need to exist in that realm.

Copy link
Contributor

@justincr-elastic justincr-elastic Aug 8, 2022

Choose a reason for hiding this comment

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

I think describing it in order of operations helps to understand the relationship of delegated authz vs run-as.

If a realm successfully authenticates a user, a realm can be configured to choose the authenticated user's privileges by one of these two configured options. The options cannot be used simultaneously.

  1. The realm that performed authentication can do the authorization lookups.
  2. The realm that performed authentication can list a subset of other realms to do the authorization lookups by username.

After the authenticated user has been authorized by one of the above configured methods, one more check is done before servicing a request.

If the request includes a run-as header, the authenticated user's privileges are checked to see if it is allowed to run-as that requests user. If yes, all configured realms are asked to do a lookup of the run-as user by username. If the run-as user is found, the first realm to find that username returns that run-as user with a set of privileges resolved by that lookup realm. The request is then executed as the run-as user, with the run-as user's privileges, not the original authenticated user's privileges.

All 10 realms can request delegated authorization: reserved, native, file, ldap, ad, pki, saml, oidc, kerberos, jwt.

Only 4 realms can fulfill delegated authorizations: native, file, ldap, ad

There is overlap where an LDAP/AD realm can authenticate, and then request delegated authorization from a different LDAP/AD realm. Note, recursion does not make sense; an LDAP/AD realm should not delegate authorization to itself, just omit the delegated authorization setting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a doc trying to describe user lookup, not run as or delegated authorization. Both those features have their own docs, I don't want to explain them again here.

The point of mentioning them is to provide examples of why the concept of user lookup exists so that the description has some context, but if the readers want to know more details about run-as or delegated authorization they should read the pages for those 2 features.

I'm happy to make this paragraph clearer, but I don't want to end up becoming a distraction from the purpose of the page.

@elasticsearchmachine elasticsearchmachine changed the base branch from master to main July 22, 2022 23:05
Copy link
Contributor

@lockewritesdocs lockewritesdocs left a comment

Choose a reason for hiding this comment

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

Added a suggestion for distinguishing the two authorization checks that occur with run_as and delegated authorization.

and metadata associated with a user from a different realm.

In each of the above cases the second user must be resolved without directly
authenticating. The ability for a realm to lookup a user by username is an
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
authenticating. The ability for a realm to lookup a user by username is an
authenticating. The ability for a realm to look up a user by username is an

Comment on lines 24 to 26
In each of the above cases the second user must be resolved without directly
authenticating. The ability for a realm to lookup a user by username is an
optional operation that is not supported by all realms.
Copy link
Contributor

Choose a reason for hiding this comment

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

@tvernum, here's a suggested version that incorporates the distinction you highlighted:

In both cases, a user must authenticate to a realm first. After successfully authenticating, two authorization
checks occur:

  • The first check ensures that the authenticated user has privileges to execute requests as a different user.
  • The second check ensures that the unauthenticated user (the second user) has privileges to execute the
    specified request.

Querying the second realm to retrieve the unauthenticated user's privileges is known as a user lookup. The authenticated user doesn't need credentials in the second realm; they only need to exist in that realm.

@justincr-elastic
Copy link
Contributor

LGTM

@tvernum
Copy link
Contributor Author

tvernum commented Aug 10, 2022

@elasticmachine update branch

@tvernum tvernum added the v8.4.1 label Aug 10, 2022
@tvernum
Copy link
Contributor Author

tvernum commented Aug 12, 2022

@elasticmachine update branch

@tvernum tvernum merged commit e063ce8 into elastic:main Aug 12, 2022
tvernum added a commit to tvernum/elasticsearch that referenced this pull request Aug 12, 2022
When we introduced "authorization delegation" we piggy backed on the
implementation and documentation for "run as". The authorization
delegation docs just link to "run as" in order to explain which realms
support being the target of delegation.

However, authorization delegation is now at least as popular as
"run as", and forcing people to make sense of the "run as" docs and
apply them to their delegation authorization ("authorization_realm")
scenario wasn't helpful or clear.

This commit moves (and improves) the content for "lookup a user
without authentication" into a new page within the authentication
section, and links to it from both "run as" and "delegated
authorization".

Co-authored-by: Adam Locke <[email protected]>
tvernum added a commit to tvernum/elasticsearch that referenced this pull request Aug 12, 2022
When we introduced "authorization delegation" we piggy backed on the
implementation and documentation for "run as". The authorization
delegation docs just link to "run as" in order to explain which realms
support being the target of delegation.

However, authorization delegation is now at least as popular as
"run as", and forcing people to make sense of the "run as" docs and
apply them to their delegation authorization ("authorization_realm")
scenario wasn't helpful or clear.

This commit moves (and improves) the content for "lookup a user
without authentication" into a new page within the authentication
section, and links to it from both "run as" and "delegated
authorization".

Co-authored-by: Adam Locke <[email protected]>
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.3
8.4

elasticsearchmachine pushed a commit that referenced this pull request Aug 12, 2022
When we introduced "authorization delegation" we piggy backed on the
implementation and documentation for "run as". The authorization
delegation docs just link to "run as" in order to explain which realms
support being the target of delegation.

However, authorization delegation is now at least as popular as
"run as", and forcing people to make sense of the "run as" docs and
apply them to their delegation authorization ("authorization_realm")
scenario wasn't helpful or clear.

This commit moves (and improves) the content for "lookup a user
without authentication" into a new page within the authentication
section, and links to it from both "run as" and "delegated
authorization".

Co-authored-by: Adam Locke <[email protected]>

Co-authored-by: Adam Locke <[email protected]>
elasticsearchmachine pushed a commit that referenced this pull request Aug 12, 2022
When we introduced "authorization delegation" we piggy backed on the
implementation and documentation for "run as". The authorization
delegation docs just link to "run as" in order to explain which realms
support being the target of delegation.

However, authorization delegation is now at least as popular as
"run as", and forcing people to make sense of the "run as" docs and
apply them to their delegation authorization ("authorization_realm")
scenario wasn't helpful or clear.

This commit moves (and improves) the content for "lookup a user
without authentication" into a new page within the authentication
section, and links to it from both "run as" and "delegated
authorization".

Co-authored-by: Adam Locke <[email protected]>

Co-authored-by: Adam Locke <[email protected]>
@mark-vieira mark-vieira added v8.4.0 and removed v8.4.1 labels Aug 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>docs General docs changes :Security/Authentication Logging in, Usernames/passwords, Realms (Native/LDAP/AD/SAML/PKI/etc) Team:Docs Meta label for docs team Team:Security Meta label for security team v8.3.4 v8.4.0 v8.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants