Skip to content

Conversation

@ankit--sethi
Copy link
Contributor

Backports the following commits to 9.0:

…ealm (elastic#127621)

* This PR addresses elastic#113535 - a confusing error message when the user attempts to update the password for the `elastic` superuser in a cloud deployment.

At the heart of the issue is the difference in how the `elastic` superuser is implemented on self-hosted deployments vs. managed cloud deployments. Elasticsearch has two distinct security realms: `file` and `native`. On a self-hosted deployment, the `elastic` superuser is represented as a document in the `.security` index, whereas in a cloud deployment `elastic` is defined in the `ES_PATH_CONF/users` and `ES_PATH_CONF/user_roles` files placed on each node in the cluster.

The TransportChangePasswordAction impl is designed to update the password for users in the `native` realm specifically, and a failure on cloud to change the password for `elastic` using the Change Password API fails with the error that the user does not exist.

The solution here leverages `fileUserPasswdStore.userExists` to do a low cost check on whether the request username belongs to the `file` realm and will exit early with an informative error message if that is the case.

* Update docs/changelog/127621.yaml

* re-do the ticket in Continuation-passing style. Previous unanswered questions around CI/CD are resolved.

* link issue

* accidental commit, reverting

* Update docs/changelog/127621.yaml

* try to check for membership in all non-native realms

* [CI] Auto commit changes from spotless

* improve checks to fix failing tests

* improve

* improve

* improve logic with GroupedActionListener

* return early

* extra spaces

* revert

* Update x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/action/user/TransportChangePasswordAction.java

Co-authored-by: Slobodan Adamović <[email protected]>

* Update x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authc/esnative/ClientReservedRealm.java

Co-authored-by: Slobodan Adamović <[email protected]>

* PR feedback

* fix imports

* fix test

* add test

---------

Co-authored-by: elasticsearchmachine <[email protected]>
Co-authored-by: Slobodan Adamović <[email protected]>
@ankit--sethi ankit--sethi added :Security/Security Security issues without another label >bug auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport Team:Security Meta label for security team labels Jun 13, 2025
@elasticsearchmachine elasticsearchmachine merged commit 730f34a into elastic:9.0 Jun 13, 2025
22 checks passed
@ankit--sethi ankit--sethi deleted the backport/9.0/pr-127621 branch June 13, 2025 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport >bug :Security/Security Security issues without another label Team:Security Meta label for security team v9.0.3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants