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

Enable authentication for the HTTP interface. #1792

Merged
merged 1 commit into from
Sep 4, 2023
Merged

Conversation

royjacobson
Copy link
Contributor

CC @Pothulapati @ashotland for awareness.

@ashotland
Copy link
Contributor

Hi @royjacobson, what should we watch for?

Does http on admin approt require no auth? (we hit it for metrics)

@royjacobson
Copy link
Contributor Author

Hi @royjacobson, what should we watch for?

Does http on admin approt require no auth? (we hit it for metrics)

If the admin interface is configured without password and the HTTP interface is not exposed on the main port (--noprimary_port_http_enabled) then there's no change.

@royjacobson royjacobson merged commit 502f76f into main Sep 4, 2023
10 checks passed
@royjacobson royjacobson deleted the http_password branch September 4, 2023 12:18
@dragonflydb dragonflydb deleted a comment from ashotland Sep 4, 2023
@romange
Copy link
Collaborator

romange commented Sep 4, 2023

@royjacobson can you please provide an example on how to fetch metrics with password using curl/wget?

@s5unty
Copy link

s5unty commented Sep 26, 2023

In versions after 1.9, under the default configuration, the /metrics endpoint requires basic authentication for access.
Due to the limitations of Prometheus's scrape_config, each job can only specify a single basic authentication setting.
To collect from different authenticated /metrics endpoints within a single job, you can set these three configurations.

--primary_port_http_enabled=false
--admin_nopass=true
--admin_port=16579

This way, the /metrics endpoint will be provided on the port 16579 and will not require basic authentication.


update (v1.11.0):

Lots of ACL/Auth fixes. Specifically (IMPORTANT):
we changed the default http user to be "default" instead of "user" to be consistent with Dragonfly ACL rules.
We also removed the requirement for authenticated access to /metrics http page even if ACL are enabled.

@romange
Copy link
Collaborator

romange commented Sep 26, 2023

@royjacobson I prefer cancelling http authentication and rethink it properly as a separate task. Too many things are colliding around it.

@romange
Copy link
Collaborator

romange commented Sep 26, 2023

@s5unty can you explain in more detail why setting basic_auth in scrape_config does not work for you?
https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config

@s5unty
Copy link

s5unty commented Sep 27, 2023

@s5unty can you explain in more detail why setting basic_auth in scrape_config does not work for you? https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config

To scrape the /metrics endpoints of two instances while keeping the job_name uniform,

  • case1: found multiple scrape configs with job name "my-job"

    - job_name: 'my-job'
      metrics_path: /metrics
      static_configs:
        - targets: [ 10.1.1.1:6479 ]
      basic_auth: { username: "user", password: "pw6479" }
    
    - job_name: 'my-job'
      metrics_path: /metrics
      static_configs:
        - targets: [ 10.1.1.1:6579 ]
      basic_auth: { username: "user", password: "pw6579" }
    
  • case2: static_configs does not support basic_auth

    - job_name: 'my-job'
      metrics_path: /metrics
      static_configs:
        - targets: [ 10.1.1.1:6479 ]
          basic_auth: { username: "user", password: "pw6479" }
    
        - targets: [ 10.1.1.1:6579 ]
          basic_auth: { username: "user", password: "pw6579" }
    

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.

6 participants