-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Variables substitution doesn’t work from keystore in username/password fields of metricbeat.yml in an autodiscover section #12597
Comments
Thank you for opening this! @ph I'm guessing the problem is happening here: https://github.com/elastic/beats/blob/2c70a2b3ee480e3d2e57da84130213513e4636d5/libbeat/autodiscover/template/config.go, any ideas? |
Hi @nevmerzhitsky! As we found with @exekias when looking into sth relevant Keystore is not supported with Autodiscover right now. This is expected because this could be a security issue when Autodiscover is based on hints. Imagine that you deploy a pod with autodiscover hints that would have access to all the keystore secrets of Metricbeat. However this should be allowed with basic autodiscover where Metricbeat configuration is static and provided by the user that handles keystore as well. |
Yeah, I agree with you in security aspects. I'm personally required for support in the case of static configuration. |
We should consider adding support for this, always for static configs (not hints based autodiscover). I don't see any harm on doing that. We are currently working on #8847, let's make sure the solution we find can fit this in the future |
How can I use keystore variables in
autodiscover.providers.templates.config
section of metricbeat.yml? It looks like broken.Steps to Reproduce
metricbeat keystore add
with appropriate valuesExpected:
Metricbeat successfully connected to RabbitMQ service.
But it doesn't.
Interesting additional info:
For debugging purposes, you can use "
${QUEUE_PASSWORD}
" as a value for fieldoutput.elasticsearch.hosts
of metricbeat.yml and you will see the finish value ofQUEUE_PASSWORD
variable from the keystore in logs of the beat (in error messages about the connection to Elasticsearch). Therefore the keystore really store the correct value.If you replace
${QUEUE_USERNAME}
and${QUEUE_PASSWORD}
by hard-coded values in metricbeat.yml and restart the beat it will work. Therefore Metricbeat can connect to RabbitMQ with required auth andusername
/password
fields of the metricbeat.yml really works.Even if you return the vars back to metricbeat.yml and add 2 Linux env vars
QUEUE_USERNAME
andQUEUE_PASSWORD
and restart the beat it will work too. Therefore environ variables substitution work in theautodiscover.providers.templates.config
section. But keystore variables substitution doesn't work.The text was updated successfully, but these errors were encountered: