Skip to content

[8.0] URL option for BaseRunAsSuperuserCommand (#81025)#81185

Merged
jkakavas merged 1 commit intoelastic:8.0from
jkakavas:backport/8.0/pr-81025
Dec 1, 2021
Merged

[8.0] URL option for BaseRunAsSuperuserCommand (#81025)#81185
jkakavas merged 1 commit intoelastic:8.0from
jkakavas:backport/8.0/pr-81025

Conversation

@jkakavas
Copy link
Copy Markdown
Contributor

Backports the following commits to 8.0:

Add a --url option for elasticsearch-reset-password and
elasticsearch-create-enrollment-token CLI Tools ( and any tools
that would extend BaseRunAsSuperuserCommand ).
The tools use CommandLineHttpClient internally, which tries its
best to deduce the URL of the local node based on the configuration
but there are certain cases where it either fails or returns an
unwanted result. Concretely:

- CommandLineHttpClient#getDefaultURL will always return a URL with
the port set to 9200, unless otherwise explicitly set in the
configuration. When running multiple nodes on the same host,
subsequent nodes get sequential port numbers after 9200 by default
and this means that the CLI tool will always connect the first of
n nodes in a given host. Since these tools depend on a file realm
local user, requests to other nodes would fail
- When an ES node binds and listens to many addresses, there can
be the case that not all of the IP addresses are added as SANs in
the certificate that is used for TLS on the HTTP layer.
CommandLineHttpClient#getDefaultURL will pick an address based on
a preference order but that address might not be in the SANs and
thus all requests to the node would fail due to failed hostname
verification.

Manually setting `--url` to an appropriate value allows users to
overcome these edge cases.
@jkakavas jkakavas merged commit d956c7f into elastic:8.0 Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants