Ask Your Question
4

How can HTTPS and Basic Authentication be set up for Alertmanager?

asked 2022-02-27 11:00:00 +0000

pufferfish gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2022-03-07 13:00:00 +0000

huitzilopochtli gravatar image

To set up HTTPS and Basic Authentication for Alertmanager, follow these steps:

  1. Generate SSL/TLS certificates for Alertmanager using a tool like Let’s Encrypt or OpenSSL.

  2. Open the Alertmanager configuration file and add the following lines to enable HTTPS:

# Secure the web interface with HTTPS
tls_config:
  cert_file: /path/to/cert.pem
  key_file: /path/to/key.pem

Replace /path/to/cert.pem and /path/to/key.pem with the paths to your SSL/TLS certificate and key files.

  1. Install basic-auth plugin for Alertmanager by running this command:
$ go get -u github.com/prometheus/alertmanager/cmd/amtool
  1. Run the following command to create an Auth file:
$ echo "myUser:$(openssl passwd -apr1)" > /path/to/alertmanager/htpasswd 

Replace myUser with the desired username.

  1. Add the following lines to the Alertmanager configuration file to enable basic authentication:
# Authenticate users with HTTP basic authentication
route:
  receiver: 'slack'
  group_by: ['alertname']
  group_wait: 30s
  group_interval: 5m
  repeat_interval: 30m
  routes:
  - match:
      alertname: DeadMansSwitch
    receiver: team-X-mails
    continue: true
    authentication:
      basic_auth:
        usersfile: /path/to/alertmanager/htpasswd

Replace /path/to/alertmanager/htpasswd with the path to the Auth file created in step 4.

  1. Restart the Alertmanager service to apply the changes.

Now, when users access the Alertmanager web interface, they will be prompted to enter their username and password for authentication, and all communication will be secured over HTTPS.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-02-27 11:00:00 +0000

Seen: 15 times

Last updated: Mar 07 '22