-
Notifications
You must be signed in to change notification settings - Fork 75
httpclient: add support for tls.Config.GetClientCertificate #1429
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
base: main
Are you sure you want to change the base?
Conversation
Expose tls.Config.GetClientCertificate to allow supplying a callback that loads the client certificate and key on each request. This enables mTLS setups where certificates are rotated automatically without restarting the application. Inspired by the etcd approach: etcd-io/etcd#7829 Signed-off-by: Seena Fallah <[email protected]>
|
|
|
Hello, Thank you for the contribution. Unfortunately this goes against plugin best practices: Plugins should not use the local file system. This is a security measure to avoid plugins accessing restricted files from the system or other plugin files. The recommended approach is still using a provisioning file, which could read files from the system, even though that requires a restart of the pod running the plugin. This shouldn't have any impact or downtime if served in HA. |
|
@andresmgot - thanks for the feedback. i'm still little confused about it. |
|
Let me try to clarify.
Yes, the provisioning system is part of Grafana core, where the code that's being executed is controlled and verified that it works as expected. In the case of plugins, we don't own the code and therefore we need to be more careful of what's being allowed.
I'm not sure if you mean this middleware. As you can see, the struct has those file paths deprecated and has not been removed (yet) to avoid breaking changes.
This patch introduces a new set of paths for local files and that's what is not allowed. Apart from the security implications (plugins could try to read unexpected files from those locations), plugins should not assume any state of the machine they are running since that may change over time and datasources will not. Hope that makes sense. |
|
@andresmgot understood that you don't want filesystem access through plugins. Do you have another idea in mind on how to realise mTLS cert rotation in a generic way to be supported by any kind of datasource? |
|
See this suggestion: grafana/grafana#113982 (comment) |
What this PR does / why we need it:
Expose tls.Config.GetClientCertificate to allow supplying a callback that loads the client certificate and key on each request. This enables mTLS setups where certificates are rotated automatically without restarting the application.
Inspired by the etcd approach: etcd-io/etcd#7829
Which issue(s) this PR fixes:
Needed for: grafana/grafana#113982
Related to grafana/grafana#44296