-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
prometheus_client plugin: Add transport encryption via TLS and authentication via http basic_auth #3719
Conversation
Sorry, I have implemented this last november and took it to the current master. I didn't recognize the parameter change in promhttp.HandlerFor() call. Now all tests should pass. |
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, can you make the following changes just for consistency between plugins?
@@ -10,6 +10,16 @@ This plugin starts a [Prometheus](https://prometheus.io/) Client, it exposes all | |||
# Address to listen on | |||
listen = ":9273" | |||
|
|||
# Use TLS | |||
tls = true | |||
tls_crt = "/etc/ssl/telegraf.crt" |
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.
Call this tls_cert
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.
Done in de9d7fa
@@ -10,6 +10,16 @@ This plugin starts a [Prometheus](https://prometheus.io/) Client, it exposes all | |||
# Address to listen on | |||
listen = ":9273" | |||
|
|||
# Use TLS | |||
tls = true |
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.
Remove this option, if other tls options are set then enable tls, see http_listener input for an example.
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.
Done in ffc0690
# Use http basic authentication | ||
basic_auth = true | ||
username = "Foo" | ||
password = "Bar" |
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.
For basic auth lets do it like in #3496, enable if either username or password is set and no enable flag.
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.
Done in bfe91ac
PreferServerCipherSuites: true, | ||
CipherSuites: []uint16{ | ||
tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, | ||
}, |
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.
Shouldn't we be using p.TLSCert and p.TLSKey somewhere? Why are we so specific on the ciphers and tls version?
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.
We specify the certificate and key in ListenAndServeTLS() in line 171.
The specified cipher is the mandatory cipher for HTTP/2 which is used by prometheus when using TLS. If you want we can leave it open but it is the mandatory cipher for HTTP/2.
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 the explanation, yeah lets leave CipherSuites and PreferServerCipherSuites unset so that it will use the defaults.
I have removed the specific TLS settings and use the defaults. |
Required for all PRs:
Hello community,
this commit adds support for TLS transport encryption and http basic_auth for authentication in prometheus_client output plugin.
Configurations:
Prometheus:
Telegraf configuration:
Greetings,
Philipp