-
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
Enable keystore for autodiscover static configuration #16306
Conversation
Signed-off-by: chrismark <chrismarkou92@gmail.com>
libbeat/keystore/keystore.go
Outdated
@@ -34,6 +34,8 @@ var ( | |||
ErrKeyDoesntExists = errors.New("cannot retrieve the key") | |||
) | |||
|
|||
var CentralKeystore Keystore |
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.
this is a hack. We should avoid global variables as they can cause issues when reusing code, among many other problems (I'm ok with this for testing the approach, but we need to find another solution before merging).
I think the Beat
object is exposing the keystore through beat.Keystore()
method. Probably you can get it somewhere and pass it to autodiscover.
Signed-off-by: chrismark <chrismarkou92@gmail.com>
Signed-off-by: chrismark <chrismarkou92@gmail.com>
27f4d01
to
73e0a5c
Compare
@exekias tried to pass the Not sure if this is better than the previous one but not sure if there is other obvious way so far. Feel free to comment/propose on it 🙂 . |
Signed-off-by: chrismark <chrismarkou92@gmail.com>
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.
Thank you for looking into this, the change is looking really clean IMO!
Would it make sense to update docs to explicitly explaining the relation between autodiscover and keystore? Probably we want to explain that keystore can be used from local settings but not from hints.
Will need a changelog
@exekias thanks for the suggestions! So far I changed the code so as to pass ps: I'm adding the docs section in a following commit. |
@exekias tests and docs added, however CI is still failing at https://travis-ci.org/github/elastic/beats/jobs/680132395#L1166 but not sure if this is related to these changes. I was able to reproduce the failure locally with |
Signed-off-by: chrismark <chrismarkou92@gmail.com>
Signed-off-by: chrismark <chrismarkou92@gmail.com>
jenkins, test this again please |
💔 Build FailedExpand to view the summary
Build stats
Test stats 🧪
Test errorsExpand to view the tests failures
--------------------- >> end captured stdout << ---------------------- Steps errorsExpand to view the steps failures
Log outputExpand to view the last 100 lines of log output
|
I will go on and merge this, since Travis succeeded except for the Generator's tests. |
(cherry picked from commit c1160e3)
Close #12597.
What this PR does
This PR makes use of keystore for containers/pods that are autodiscovered with static configurations only. Hint based configuration should not have access to the keystore for security reasons.
How to test it manually
autodiscover
with static template:Check that REDIS metrics are successfully collected.
Try to start REDIS with a different password so as to make Metricbeat fail.
Now check that hints based autodiscovered containers have not access to the keystore:
You should see Metribeat failing to access REDIS since the password is not retrievable.
cc: @exekias