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

Beats require unnecessary privileges at startup on 7.13 #26322

Closed
iorfix opened this issue Jun 15, 2021 · 7 comments · Fixed by #27508
Closed

Beats require unnecessary privileges at startup on 7.13 #26322

iorfix opened this issue Jun 15, 2021 · 7 comments · Fixed by #27508
Assignees
Labels
bug Team:Elastic-Agent Label for the Agent team

Comments

@iorfix
Copy link

iorfix commented Jun 15, 2021

Using version 7.13.1 Beats force to set ILM policies, even when configuration explicitly set them to don't set them.
This may cause an error, if beats credentials are reduced to minimum, as in: https://www.elastic.co/guide/en/beats/filebeat/current/privileges-to-publish-events.html

  1. create a user with this privileges, and use it in a metricbeat.yml configuration:
{
  "cluster": ["monitor" ,"cluster:admin/ingest/pipeline/get"],
  "indices": [
    {
      "names": [ "cloud-metrics*", "cloud-logs*", "metricbeat-*", "filebeat-*", "heartbeat-*" ],
      "privileges": ["create_doc"]
    }
  ],
  "metadata" : { 
    "version" : 1
  }
}
  1. execute metricbeat setup with proper superuser credentials.
metricbeat setup -E setup.ilm.overwrite=true -E setup.template.enabled=true -E output.elasticsearch.username=elastic -E output.elasticsearch.password=***
  1. configure metricbeat.yml with these settings:
setup.template.enabled: false
setup.ilm.check_exists: false
setup.ilm.overwrite: false
setup.ilm.enabled: true
  1. start metricbeat and check for logs. It should appear something similar to:
{"log.level":"error","@timestamp":"2021-06-14T11:06:35.785+0200","log.logger":"index-management.ilm","log.origin":{"file.name":"ilm/std.go","file.line":166},"message":"ILM policy heartbeat creation failed: 403 Forbidden: {\"error\":{\"root_cause\":[{\"type\":\"security_exception\",\"reason\":\"action [cluster:admin/ilm/put] is unauthorized for API key id [0e0c9nkBdKUEp4Eqeb4y] of user [apikeywriteruser], this action is granted by the cluster privileges [manage_ilm,manage,all]\"}],\"type\":\"security_exception\",\"reason\":\"action [cluster:admin/ilm/put] is unauthorized for API key id [0e0c9nkBdKUEp4Eqeb4y] of user [apikeywriteruser], this action is granted by the cluster privileges [manage_ilm,manage,all]\"},\"status\":403}","ecs.version":"1.6.0"}
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jun 15, 2021
@ph ph added the Team:Elastic-Agent Label for the Agent team label Jun 15, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/agent (Team:Agent)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jun 15, 2021
@ph ph added the bug label Jun 15, 2021
@ph
Copy link
Contributor

ph commented Jun 15, 2021

@iorfix This was working as is in 7.10.2?

@iorfix
Copy link
Author

iorfix commented Jun 15, 2021

It works as expected with 7.10.2, but it doesn’t work in 7.13.1

@4urb4nm0nk
Copy link

4urb4nm0nk commented Aug 11, 2021

I still have this issue on 7.14 with all Beats when using API for authentication. I followed this guide. I know it's a open issue and I'll be watching for any changes.
I even get it when I change the authentication to the elastic user. So it builds the index and then goes back to API authentication. But I don't want to do this for every Beats every time I update or when the index reaches 50GB or 30 days.

@ruflin
Copy link
Collaborator

ruflin commented Aug 17, 2021

@kvch This seems to be related to #27270 ?

@kvch
Copy link
Contributor

kvch commented Aug 24, 2021

Have you tried setting setup.ilm.enabled to false so ILM is not loaded and output.elasticsearch.index to your index name so the Beat knows what is the target index?

@MrMMorris
Copy link

MrMMorris commented Mar 25, 2024

still seeing this issue with metricbeat 7.17.0.

used this to create api key:
https://www.elastic.co/guide/en/beats/metricbeat/7.17/beats-api-keys.html

get this error:
ILM policy metricbeat creation failed: 403 Forbidden: {"error":{"root_cause"[{"type":"security_exception","reason":"action [cluster:admin/ilm/put] is unauthorized for API key id [xxxxxxxxxxxxxx] of user [elastic], this action is granted by the cluster privileges [manage_ilm,manage,all]"}]

EDIT: even after updating the api key permissions to add the above, I now get this error:
action [indices:admin/index_template/put] is unauthorized for API key id [xxxxxxxxxxxx] of user [elastic], this action is granted by the cluster privileges [manage_index_templates,manage,all]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Team:Elastic-Agent Label for the Agent team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants