-
Notifications
You must be signed in to change notification settings - Fork 69
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
Use GetClientCertificate to allow client cert to be reloaded #537
Conversation
bb05304
to
bcfd8c4
Compare
Signed-off-by: Ruben Vargas <[email protected]>
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 looks reasonable to me. Adhere to the lint check.
Is the expectation here that the server certificate will be reloaded by some other means?
Signed-off-by: Ruben Vargas <[email protected]>
The expectation is that at some point the certificate expired, and usually in some platforms there is a logic for cert renewal. But if the certificate is loaded only one time in memory, even if the file changed this won't take effect. Unless you reload it as this PR does. may be an additional improvement will be to not reload each time |
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.
The idea makes sense to me, but the current implementation doesn't really. I think it changes too much basically, without clear rationale.
Co-authored-by: Arve Knudsen <[email protected]>
Co-authored-by: Arve Knudsen <[email protected]>
Co-authored-by: Arve Knudsen <[email protected]>
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.
Looks pretty good now, but validateCertificatePaths
is now dead and should be removed. Plus, some other simplifications should be made.
Co-authored-by: Arve Knudsen <[email protected]>
Co-authored-by: Arve Knudsen <[email protected]>
Co-authored-by: Arve Knudsen <[email protected]>
Signed-off-by: Ruben Vargas <[email protected]>
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.
LGTM, thanks for addressing my feedback!
This change has broken the
Could you please take a look @rubenvp8510? You should be able to pull the branch from grafana/mimir#8833 to reproduce this. |
Hello @charleskorn I'll take a look today, it seems like the test is expecting one of these to be defined: Other thing I can do is set |
How goes the testing? I'm seeing the above error in Tempo also after the dskit update. |
I'm trying to reproduce the test error on my side. |
Strange, on my side the memberlist-kv module doesn't fail for the reason Charles linked to in CI. For me it fails with a non-informative error:
|
I'm seeing this in Tempo.
|
It seems like in order to not break anything we will need to provide a |
@charleskorn @rubenvp8510 @zalegrala I think the problem is that memberlist/kv uses a client certificate also for server purposes, that's the reason for the error. As a fix, shall we also set the |
@aknuds1 that make sense According to go documentation
This is confusing because the struture is named About setting certificates, What I don't know is , if I set certificates then |
@rubenvp8510 I agree it's confusing, I don't know yet why memberlist/kv appears to use
The // GetClientCertificate, if not nil, is called when a server requests a
// certificate from a client. If set, the contents of Certificates will
// be ignored. |
I've tested also setting |
Great! then we can set it with confidence :) |
I've made a PR to fix the issue, please review. Tried the broken Mimir integration test with it, it passes. |
What this PR does:
Use
GetClientCertificate
to reload the client certificates from the disk, similar to what has been done withGetCertificate
in this library https://github.com/prometheus/exporter-toolkit/blob/master/web/tls_config.go#L204 which is used here: https://github.com/grafana/dskit/blob/main/server/server.go#L317 by the server.Which issue(s) this PR fixes:
This is useful because the certificates can rotate, and with this change we will reload the certificate from the disk without need to restart the application for it.
Fixes #549
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]