security - 为 Alertmanager 配置 HTTPS 和基本身份验证

标签 security https prometheus basic-authentication prometheus-alertmanager

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

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']

最佳答案

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

有关如何散列密码和测试整个设置的详细信息可以改编自 Prometheus documentation .

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

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

关于security - 为 Alertmanager 配置 HTTPS 和基本身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67269503/

相关文章:

monitoring - Prometheus-Alertmanager 警报的复杂规则/过滤器

prometheus - Prometheus 中的标签是什么?

c++ - 使用 VC++ 在 Windows 上保护虚拟磁盘

ios - 通过联系人添加用户 ios

php openssl : how to match the private key with the certificate

ssl - 在 Heroku 上使用 PointDNS 管理 SSL 和非 www 到 www 重定向

kubernetes - Prometheus 查询以获取 kubernetes pod 中的 CPU 和内存使用情况

java - Eclipse插件: How to secure sensitive data?

node.js - 在 Node.js Express 日志文件中发现奇怪的 http 请求

amazon-web-services - AWS API Gateway 将请求转发到带有私有(private)证书的 HTTPS 服务器