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

Insufficient privileges with API key #361

Open
cvanallen99 opened this issue Sep 15, 2024 · 6 comments
Open

Insufficient privileges with API key #361

cvanallen99 opened this issue Sep 15, 2024 · 6 comments

Comments

@cvanallen99
Copy link

Environment
Home-Assistant version: 2024.9.1
Elasticsearch version: 8.15

Describe the bug
When attempting to add the configuration using authenticate via API key within Home Assistant, HA returns an "Insufficient privileges for specified user" error. I am able to add the integration using username/password, so both HA and Elastic appear configured correctly. I copied the api key requirements exactly as in the configuration guide using the Elastic dev console. They key created with no errors

To Reproduce
Steps to reproduce the behavior:

  1. Go to Home Assistant -> Settings -> Add Integration.
  2. Add Elasticsearch integration. Chose the Authenticate via API key option
  3. Enter URL and API key info.
  4. After clicking submit, HA returns an error "Insufficient privileges for specified user"

For validation, here's the API key settings in elastic:

{
"hass_writer": {
"cluster": [
"manage_index_templates",
"monitor"
],
"indices": [
{
"names": [
"metrics-homeassistant.*"
],
"privileges": [
"manage",
"index",
"create_index",
"create"
],
"allow_restricted_indices": false
}
],
"applications": [],
"run_as": [],
"metadata": {},
"transient_metadata": {
"enabled": true
}
}
}

Used to work fine. I suspect something changed recently in either HA or Elastic. As a workaround, I can user username/password, I just prefer key based authentication for security reasons.

@legrego
Copy link
Owner

legrego commented Sep 19, 2024

@cvanallen99, a few questions:

  1. which version of this integration are you using?

  2. Did the username/password credentials have the same set of privileges as your API Key, or a different set of privileges?

  3. Can you enable debug logging for the integration, and share that with us (redacting if necessary)?

cc @strawgate in case you have other questions

@cvanallen99
Copy link
Author

cvanallen99 commented Sep 19, 2024 via email

@strawgate
Copy link
Collaborator

For version 0.7 you need the "manage_ilm" cluster permission, did you follow the setup instructions for 0.7 or for 2.0?

@cvanallen99
Copy link
Author

cvanallen99 commented Sep 20, 2024 via email

@strawgate
Copy link
Collaborator

Are you able to test adding the manage ilm cluster permission and let us know if that resolves the issue?

@cvanallen99
Copy link
Author

cvanallen99 commented Sep 20, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants