【问题标题】:Https for prometheus with self-signed ssl certificate带有自签名 ssl 证书的 prometheus 的 Https
【发布时间】:2021-09-24 23:26:25
【问题描述】:

尝试为 prometheus 建立 SSL(通过 docker 启动)。我使用 open ssl 自己生成了密钥和 crt。对:key 和 crt 工作正常。 当我在主机上执行此命令时:

openssl s_server -cert prometheus.crt -key prometheus.key

意思是“接受”

这是我用于 prometheus 容器的 Dockerfile:
https://pastebin.com/4wGtCGp6
当我构建映像并启动它时,它说:
level=error ts=2021-09-24T20:44:11.649Z caller=stdlib.go:105 component=web caller="http: 来自 127.0.0.1:50458 的 TLS 握手错误" msg="remote error: tls: bad certificate " кричит постоянно

在 web.yml 中,我通过以下方式配置 SSL:

tls_server_config:
  cert_file: /etc/prometheus/prometheus.crt
  key_file: /etc/prometheus/prometheus.key

在 prometheus.yml 中,我通过以下方式配置 SSL:

scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'
    scheme: https
    tls_config:
      ca_file: /etc/prometheus/prometheus.crt
      cert_file: /etc/prometheus/prometheus.crt
      key_file: /etc/prometheus/prometheus.key

这个错误的原因可能是什么?

【问题讨论】:

    标签: ssl openssl prometheus dock


    【解决方案1】:

    如果它是自签名的,则不需要 CA 文件,因此请尝试删除 tls_config 中的该行并重新启动容器。

    我知道这很老了,所以如果回答一个老问题不好,请道歉。随意删除。

    【讨论】:

      猜你喜欢
      • 2015-06-18
      • 1970-01-01
      • 1970-01-01
      • 2014-05-05
      • 2020-04-24
      • 1970-01-01
      • 2010-09-12
      • 1970-01-01
      • 2021-03-17
      相关资源
      最近更新 更多