【问题标题】:Configure HTTPS and Basic Auth for Alertmanager为 Alertmanager 配置 HTTPS 和基本身份验证
【发布时间】:2021-07-19 23:54:33
【问题描述】:

我想使用 tls 和身份验证来保护我的 Alertmanager,以便在我的网络中,不是每个人都能够访问面向公众的端点。我不想使用 nginx 服务器作为代理。 这将是我的 prometheus 配置:

global:
  scrape_interval:     15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration
alerting:
  alertmanagers:
  - scheme: https
    basic_auth:
      username: abc
      password: ####
    tls_config:
      ca_file: ca.crt
      cert_file: ca.crt
      key_file: ca.key
    static_configs:
    - targets: ['localhost:9093']

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  - "alertRules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
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
    basic_auth:
      username: abc
      password: ###
    tls_config:
      ca_file: ca.crt
    static_configs:
    - targets: ['localhost:9090']

【问题讨论】:

  • 您能再解释一下您的问题吗?您是否尝试将警报管理器配置为需要基本身份验证,尝试将 prometheus 配置为在需要基本身份验证或两者兼有的警报管理器中触发警报?

标签: security https prometheus basic-authentication prometheus-alertmanager


【解决方案1】:

从 0.22 版开始,Alertmanager 支持基本身份验证和 https。检查original documentation 以了解如何配置它,因为您的配置似乎与那里的描述不匹配。

有关如何对密码进行哈希处理和测试整个设置的详细信息可以从Prometheus documentation 进行修改。

更新:我再次查看了您的问题,我想我被标题弄糊涂了。看起来您要做的是将 Prometheus 配置为与需要基本身份验证的 Alertmanager 一起使用。我在本文开头提供的解决方案是将 Alertmanager 配置为需要基本身份验证。

如果您想将 Prometheus 配置为与需要基本身份验证的 Alertmanager 进行通信,您的配置似乎是正确的,如 Prometheus documentation 的本节所述。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-11-21
    • 1970-01-01
    • 2011-05-10
    • 1970-01-01
    • 1970-01-01
    • 2011-01-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多