Skip to content

Conversation

@eta-orionis
Copy link

@eta-orionis eta-orionis commented Dec 25, 2019

Basic idea: pass a configuration file as a new, optional argument. The config file specifies HTTP authentication credentials and/or SSL/TLS authentication certificates. Syntax: YAML

If the config file has been given and there is a client certificate specified in it, then in collector.go a http client with added TLS configuration will be used instead of the http.defaultClient.

If HTTP authentication credentials have been specified, the request will be updated to include these.

From there on everything works as usual/was not changed.

I also added everything necessary to test this: TLS certificates for both server and client, provided an example configuration, updated the nginx config (copy-pasted existing block, added certificate directives), updated the README, and added a README for how to generate certificates so people can generate their own in case of need.

Erion Elmasllari added 2 commits December 25, 2019 21:38
…lient-certificate protected scrape endpoints.

Updated test and example to match
@eta-orionis eta-orionis marked this pull request as ready for review December 25, 2019 21:26
Copy link
Owner

@bakins bakins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a comment on when we load the auth info.

FWIW, I no longer use HTTP for the exporter and may drop support for it in version 2.


resp, err := http.DefaultClient.Do(&req)
var client *http.Client
if c.exporter.authConfig.ClientCert != "" {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could load this when we first start the process and exit the process if there is an issue with loading authentication information initially.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants