Skip to content
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

Please implement scraping via HTTPS (SSL/TLS) #474

Closed
stapelberg opened this Issue Jan 27, 2015 · 9 comments

Comments

Projects
None yet
5 participants
@stapelberg
Copy link

stapelberg commented Jan 27, 2015

For a small distributed application that I intend to monitor, we’re using HTTPS (with real certificates, so certificate verification is not an issue) and basic authentication instead of a separate private network, mostly because the setup should stay simple and the application runs on multiple different servers, distributed over the internet.

Therefore, could you please add a configuration option to the JobConfig proto message? I’m using SRV record resolving, so I’d like to see e.g. a schema key which defaults to http, but can be set to https.

@beorn7

This comment has been minimized.

Copy link
Member

beorn7 commented Jan 27, 2015

Makes sense. Thanks for the input.

@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented Jan 27, 2015

@stapelberg I guess then you'll also need to be able to configure the username/password for the basic auth, so that the final URL will be something like <scheme>://<username>:<password>@<SRV host:port>/<metrics path>?

@stapelberg

This comment has been minimized.

Copy link
Author

stapelberg commented Jan 27, 2015

Indeed, yes. For now, I’ve just set up a couple of static targets, but being able to specify userinfo and scheme would be great :).

@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented Jan 27, 2015

Cool, already started coding it. There are just some remaining code hygiene issues I need to figure out before doing a PR.

@m13

This comment has been minimized.

Copy link

m13 commented Jan 29, 2015

+1
(A document about best security practices should be also amazing)

@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented Feb 3, 2015

Just to give an update, I added TLS and basic auth functionality in this branch: https://github.com/prometheus/prometheus/commits/scheme-and-auth

But to properly test it (disabling certificate checks only during tests, etc.), I think there's some more refactoring to do in how per-job configuration (auth, scheme, disabling TLS checks, ...) is propagated to the targets. I can't spend the time right now, but might later. That's why I'm not opening a PR for that yet.

Anyways, if you're interested, you might want to give this a spin. I hope the changes in the config/config.proto are self-documenting.

@stapelberg

This comment has been minimized.

Copy link
Author

stapelberg commented Jun 23, 2015

From my POV, this issue is done. Prometheus 0.14.0 allows me to use the following config:

- job_name: robustirc
  scheme: https
  basic_auth:
    username: 'robustirc'
    password: 'secret'
  dns_sd_configs:
  - names:
    - '_robustirc._tcp.robustirc.net'
  relabel_configs:
  - source_labels: ['__address__']
    regex:         '(.+)\.robustirc\.net:[0-9]+'
    target_label:  'instance'
    replacement:   '$1'
@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented Jun 23, 2015

Indeed, thanks for pointing that out! Closing this issue.

@juliusv juliusv closed this Jun 23, 2015

simonpasquier pushed a commit to simonpasquier/prometheus that referenced this issue Oct 12, 2017

@fnkr

This comment has been minimized.

Copy link

fnkr commented Jan 8, 2019

Here is another example with a static scrape config:

# https://prometheus:foo@myservice.example.com/prometheus_exporter
scrape_configs:
  - job_name: My Service
    scrape_interval: 1s
    metrics_path: /prometheus_exporter
    scheme: https
    basic_auth:
      username: prometheus
      password: foo
    static_configs:
      - targets: ['myservice.example.com']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.