Allow elastic agent in containers to use basic auth to get service token#29651
Conversation
Allow the agent to use basic auth defined by env vars to retrieve a service token from Elasticsearch and inject it into the config used for the agent and fleet.
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
💚 Flaky test reportTests succeeded. 🤖 GitHub commentsTo re-run your PR in the CI, just comment with:
|
|
Running It looks like using a @aleksmaus, I noticed you had to adjust the permissions the service token gets in Elasticsearch, do you think we're missing another one? |
|
Related issue: elastic/fleet-server#1048 where priveleges that are defined on the package level are missing. |
@michel-laterman the fleet service token has full access to the |
Chagne from using the ES api to gather the token to the Kibana API.
|
I can use basic auth to generate a |
|
@michel-laterman I think I see the problem and I believe it should be addressed by the work in elastic/kibana#121824. Could you confirm that it works against this branch? If so, I think we'll probably want a more focused PR to fix this for 8.0, which I can prepare. |
|
Went ahead and threw up a focused fix, please test against this one: elastic/kibana#122320 |
|
Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane) |
|
Thanks @joshdover, I've confirmed that a service token can now list policies |
blakerouse
left a comment
There was a problem hiding this comment.
Nicely done! Looks good.
…ken (#29651) * Allow elastic agent in containers to use basic auth to get service token Allow the agent to use basic auth defined by env vars to retrieve a service token from Elasticsearch and inject it into the config used for the agent and fleet. * Fix linter * Use Kibana API for all requests. Change from using the ES api to gather the token to the Kibana API. (cherry picked from commit 31c0099)
…ken (#29651) (#29713) * Allow elastic agent in containers to use basic auth to get service token Allow the agent to use basic auth defined by env vars to retrieve a service token from Elasticsearch and inject it into the config used for the agent and fleet. * Fix linter * Use Kibana API for all requests. Change from using the ES api to gather the token to the Kibana API. (cherry picked from commit 31c0099) Co-authored-by: Michel Laterman <82832767+michel-laterman@users.noreply.github.com>
What does this PR do?
Allow the agent to use basic auth defined by env vars to retrieve a
service token from Elasticsearch and inject it into the config used for
the agent and fleet.
Why is it important?
Allow the agent started in a container to use basic auth to contact Elasticsearch and generate a
service_token.This should fix the tests which rely on docker-compose.
Checklist
CHANGELOG.next.asciidocorCHANGELOG-developer.next.asciidoc.How to test this PR locally
Related issues
Use cases