-
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
Add username/password in Metricbeat autodiscover hints #15349
Conversation
Signed-off-by: chrismark <chrismarkou92@gmail.com>
@@ -198,6 +208,14 @@ func (m *metricHints) getMetricPath(hints common.MapStr) string { | |||
return builder.GetHintString(hints, m.Key, metricspath) | |||
} | |||
|
|||
func (m *metricHints) getUserName(hints common.MapStr) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit pick only: isn't it correct in English to use a single word "username" instead two ones "user Name"?
Signed-off-by: chrismark <chrismarkou92@gmail.com>
[float] | ||
===== `co.elastic.metrics/password` | ||
|
||
The password to use for authentication |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should put a note here advising not to use plain text passwords here, but references to ENV vars in the Metricbeat container, or passwords stored in keystore. Long term I think we should implement a way to allow referencing passwords from k8s secrets
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for implementing this! I left a comment about docs, the rest LGTM
Signed-off-by: chrismark <chrismarkou92@gmail.com>
097c49d
to
7af7e60
Compare
Signed-off-by: chrismark <chrismarkou92@gmail.com>
(cherry picked from commit 7d08f9b)
Tested this functionality manually with BC1 and it works as expected. However, I do have one concern: when the password is provided via a container label it is emitted in the Metricbeat debug log. Should we omit it or mask it? Or is it okay since it's not emitted in the Metricbeat log by default but only when debug level logging is turned on? |
@ChrsMark pointed me to a related discussion that already happened in this PR: #15349 (comment). So this is a known issue and user should specify the password carefully. |
I put up a PR to mask the password in log output: #15616. |
This PR closes #15115
Manual Testing
./metricbeat -e -d "hints.builder"
docker run -l co.elastic.metrics/module=nats -l co.elastic.metrics/username=user42 --name nats nats
2019-12-16T15:53:18.712+0200 DEBUG [hints.builder] hints/metrics.go:144 generated config: {"enabled":true,"hosts":null,"metricsets":["connections","routes","stats","subscriptions"],"module":"nats","period":"1m","processors":null,"ssl":null,"timeout":"3s","username":"user42"}