Add username/password in Metricbeat autodiscover hints#15349
Add username/password in Metricbeat autodiscover hints#15349ChrsMark merged 6 commits intoelastic:masterfrom
Conversation
Signed-off-by: chrismark <chrismarkou92@gmail.com>
| return builder.GetHintString(hints, m.Key, metricspath) | ||
| } | ||
|
|
||
| func (m *metricHints) getUserName(hints common.MapStr) string { |
There was a problem hiding this comment.
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.
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
exekias
left a comment
There was a problem hiding this comment.
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 nats2019-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"}