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

Generally enable reading secrets from files #2498

Open
beorn7 opened this issue Mar 1, 2021 · 10 comments
Open

Generally enable reading secrets from files #2498

beorn7 opened this issue Mar 1, 2021 · 10 comments

Comments

@beorn7
Copy link
Member

beorn7 commented Mar 1, 2021

This is the same as prometheus/prometheus#8551 , just for Alertmanager.

@roidelapluie
Copy link
Member

roidelapluie commented Apr 1, 2021

Some fields we are missing:

smtp_auth_password_file
smtp_auth_secret_file
slack_api_url_file
victorops_api_key_file
opsgenie_api_key_file
wechat_api_secret_file

julienduchesne added a commit to julienduchesne/alertmanager that referenced this issue Apr 2, 2021
- Added support for the file in both the global and the lower level
- Tried to follow configuration patterns I saw in prometheus
- The slack file is read on every request as mentioned in the prometheus issue to enable seamless switches

prometheus#2498
julienduchesne added a commit to julienduchesne/alertmanager that referenced this issue Apr 2, 2021
- Added support for the file in both the global and the lower level
- Tried to follow configuration patterns I saw in prometheus
- The slack file is read on every request as mentioned in the prometheus issue to enable seamless switches

prometheus#2498
Signed-off-by: Julien Duchesne <julien.duchesne@grafana.com>
@gr8Adakron
Copy link

When can we expect to have configuration for victorops_api_key_file ??

@beorn7
Copy link
Member Author

beorn7 commented Apr 20, 2021

I guess the implementation for all the other fields will follow the same pattern as #2534. PRs welcome. 😃

@sinkingpoint
Copy link
Contributor

Would anyone object to a general case of something like api_key: file:/tmp/foo to read the value for api_key from /tmp/foo? Seems like the most generic solution, if a bit "magic" but I'd be happy to PR it

@beorn7
Copy link
Member Author

beorn7 commented Jun 7, 2021

That would collide with any secret that happens to start with file: (unlikely, but who knows…).

I guess including a "schema" from the beginning would have been the best solution (file:/tmp/foo vs passwd:9euo9.y.3t3).

We could switch to such a generic solution with AM, in principle, because we are still pre 1.x, but on the other hand, keeping things consistent with Prometheus (where we cannot change easily) has its value, too.

Just my random thoughts…

@Duologic
Copy link

There are a few more not mentioned above:

  • pagerduty.service_key_file
  • pagerduty.routing_key_file
  • pushover.user_key_file
  • pushover.token_file

@roidelapluie
Copy link
Member

I like to have multiple keys. Having file: would just lead to more yaml issues for new users.

@jkroepke
Copy link
Contributor

jkroepke commented Oct 1, 2021

I found a workaround for Opsgenie, Pagerduty and Pushover:

While coding #2728 I detect a hidden functionality inside Alertmanager.

I saw this functionally for pagerduty and pushover

All properties are piped through Alertmanager template engine.

A possible workaround would be to define template (this can be a file on the filesystem, maybe mounted through an kubernetes secret) a like:

{{ define "pushover.default.user_key" }}API_KEY{{ end }}

And inside the configuration of Aertmanager, use this template inside the configuration:

receivers:
- name: 'team-X'
  pushover_configs:
  - user_key: '{{ template "pushover.default.user_key" . }}'

That could be a workaround some users. Except for VictorOps.

@parberge
Copy link

parberge commented Dec 8, 2021

It would be nice to use the feature #2728. Any plans on doing a release soon?

@valvin1
Copy link

valvin1 commented Aug 31, 2022

I found a workaround for Opsgenie, Pagerduty and Pushover:
...
A possible workaround would be to define template (this can be a file on the filesystem, maybe mounted through an kubernetes secret) a like:

{{ define "pushover.default.user_key" }}API_KEY{{ end }}

And inside the configuration of Aertmanager, use this template inside the configuration:

receivers:
- name: 'team-X'
  pushover_configs:
  - user_key: '{{ template "pushover.default.user_key" . }}'

I was so happy while reading this workaround unfortunately it doesn't work for smtp configuration.

https://github.com/prometheus/alertmanager/blob/main/notify/email/email.go#L103

really hope #3038 will be accepted and available.

sr added a commit to sr/alertmanager that referenced this issue Jan 3, 2023
Add the user_key_file and token_file keys to the pushover config.

/cc prometheus#2498

Signed-off-by: Simon Rozet <me@simonrozet.com>
sr added a commit to sr/alertmanager that referenced this issue Jan 3, 2023
Add the user_key_file and token_file keys to the pushover config.

/cc prometheus#2498

Signed-off-by: Simon Rozet <me@simonrozet.com>
simonpasquier pushed a commit that referenced this issue Jan 18, 2023
* support loading pushover secrets from files

Add the user_key_file and token_file keys to the pushover config.

/cc #2498

Signed-off-by: Simon Rozet <me@simonrozet.com>
sr added a commit to sr/alertmanager that referenced this issue Jan 19, 2023
sr added a commit to sr/alertmanager that referenced this issue Jan 19, 2023
/cc prometheus#2498

Signed-off-by: Simon Rozet <me@simonrozet.com>
sr added a commit to sr/alertmanager that referenced this issue Jan 23, 2023
/cc prometheus#2498

Signed-off-by: Simon Rozet <me@simonrozet.com>
simonpasquier pushed a commit that referenced this issue Mar 3, 2023
* support loading webhook URL from a file

/cc #2498

Signed-off-by: Simon Rozet <me@simonrozet.com>

* notify/webhook: add test for reading url from file

Signed-off-by: Simon Rozet <me@simonrozet.com>

* notify/pushover: add tests for reading secrets from files

Signed-off-by: Simon Rozet <me@simonrozet.com>

---------

Signed-off-by: Simon Rozet <me@simonrozet.com>
hoperays pushed a commit to hoperays/alertmanager that referenced this issue Apr 23, 2023
* support loading pushover secrets from files

Add the user_key_file and token_file keys to the pushover config.

/cc prometheus#2498

Signed-off-by: Simon Rozet <me@simonrozet.com>
hoperays pushed a commit to hoperays/alertmanager that referenced this issue Apr 23, 2023
* support loading webhook URL from a file

/cc prometheus#2498

Signed-off-by: Simon Rozet <me@simonrozet.com>

* notify/webhook: add test for reading url from file

Signed-off-by: Simon Rozet <me@simonrozet.com>

* notify/pushover: add tests for reading secrets from files

Signed-off-by: Simon Rozet <me@simonrozet.com>

---------

Signed-off-by: Simon Rozet <me@simonrozet.com>
radek-ryckowski pushed a commit to goldmansachs/alertmanager that referenced this issue Nov 6, 2023
* support loading pushover secrets from files

Add the user_key_file and token_file keys to the pushover config.

/cc prometheus#2498

Signed-off-by: Simon Rozet <me@simonrozet.com>
radek-ryckowski pushed a commit to goldmansachs/alertmanager that referenced this issue Nov 6, 2023
* support loading webhook URL from a file

/cc prometheus#2498

Signed-off-by: Simon Rozet <me@simonrozet.com>

* notify/webhook: add test for reading url from file

Signed-off-by: Simon Rozet <me@simonrozet.com>

* notify/pushover: add tests for reading secrets from files

Signed-off-by: Simon Rozet <me@simonrozet.com>

---------

Signed-off-by: Simon Rozet <me@simonrozet.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants