* SMTP config: add global and local password file fields
Add config fields (for both global email config and route-specific email
config) that specify path to file containing SMTP password. We don't
want the password in the config file itself, and reading the password
from a k8s-secret-backed file keeps the password itself "encrypted at
rest" in etcd, and cleanly separated from the rest of the AM config.
I used the same approach as pull request #2534 "Add support to set the
Slack URL in the file"
<https://github.com/prometheus/alertmanager/pull/2534/files> in the
upstream repo.
Signed-off-by: Eric R. Rath <eric.rath@oracle.com>
* changed *AuthPasswordFile field types to string per review feedback
Signed-off-by: Eric R. Rath <eric.rath@oracle.com>
* added error to getPassword() retval per review feedback
Signed-off-by: Eric R. Rath <eric.rath@oracle.com>
* simplified conf.smtp-* files
Signed-off-by: Eric R. Rath <eric.rath@oracle.com>
* update docs to reflect field type change
Signed-off-by: Eric R. Rath <eric.rath@oracle.com>
* don't treat username-without-password as invalid
Signed-off-by: Eric R. Rath <eric.rath@oracle.com>
* test cleanup
Signed-off-by: Eric R. Rath <eric.rath@oracle.com>
* Apply suggestions from code review
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Eric R. Rath <4080262+ericrrath@users.noreply.github.com>
* Updated per review feedback
Signed-off-by: Eric R. Rath <eric.rath@oracle.com>
* added sub-test per review feedback
Signed-off-by: Eric R. Rath <eric.rath@oracle.com>
* added test on Email.getPassword() per feedback
Signed-off-by: Eric R. Rath <eric.rath@oracle.com>
* only inherit global SMTP passwords if neither local password field is set
Signed-off-by: Eric R. Rath <eric.rath@oracle.com>
* removed blank line caught by gofumpt
Signed-off-by: Eric R. Rath <eric.rath@oracle.com>
Signed-off-by: Eric R. Rath <eric.rath@oracle.com>
Signed-off-by: Eric R. Rath <4080262+ericrrath@users.noreply.github.com>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
- 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
https://github.com/prometheus/alertmanager/issues/2498
Signed-off-by: Julien Duchesne <julien.duchesne@grafana.com>
- Add support for custom authorization scheme
- Add support for not following redirects in http_client
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
There was a report that this isn't working.
Updating the config and ensuring the parsing works
correctly indicates that the image_url is being
read into a string.
Signed-off-by: stuart nelson <stuartnelson3@gmail.com>
The variable DefaultGlobalConfig was being used to initialize values, but it stored previous information due to which some things were persisting in the newer initialization.
In this PR, DefaultGlobalConfig is changed to a function so that it returns a fresh GlobalConfig for initialization.
Signed-off-by: Hrishikesh Barman <hrishikeshbman@gmail.com>
To aggregate by all possible labels use '...' as the sole label name.
This effectively disables aggregation entirely, passing through all
alerts as-is. This is unlikely to be what you want, unless you have
a very low alert volume or your upstream notification system performs
its own grouping. Example: group_by: [...]
Signed-off-by: Kyryl Sablin <kyryl.sablin@schibsted.com>
* config: validate URLs at config load time
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Address Brian and Lucas comments
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Shallow copy of URL instead of reparsing it
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Unshadow net/url package
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Make a deep-copy of URL struct
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Support for custom SMTP hello string
Some MTAs insist that they be greeted with a fully qualified domain
name. The default provided by the net/smtp library, "HELLO localhost",
is not sufficient and will result in rejected messages.
This changeset adds a new configuration option that allows the
alertmanager to do its job in such an environment.
* Test SMTPHello parsing