Consider a global config option for require_tls
My setup is to use a relay host to send email alert. This bug might vary depending on the user's need.
config.yml global:
The smarthost and SMTP sender used for mail notifications.
smtp_smarthost: "relayhosthere:25" smtp_from: "[email protected]" route: . . . . . . . . . . .
Postfix:
alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases command_directory = /usr/sbin config_directory = /etc/postfix daemon_directory = /usr/libexec/postfix data_directory = /var/lib/postfix debug_peer_level = 2 html_directory = no inet_interfaces = localhost inet_protocols = all mail_owner = postfix mailq_path = /usr/bin/mailq.postfix manpage_directory = /usr/share/man mydestination = $myhostname, localhost.$mydomain, localhost newaliases_path = /usr/bin/newaliases.postfix queue_directory = /var/spool/postfix readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES relayhost = <relay-host-value-here> sample_directory = /usr/share/doc/postfix-2.6.6/samples sendmail_path = /usr/sbin/sendmail.postfix setgid_group = postdrop unknown_local_recipient_reject_code = 550
When I tried to do this setup, I receive an error in the alertmanager log:
DEBU[5421] Received alert alert=DailyTest[c1fbb74][active] component=dispatcher source=dispatch.go:160 . . . . . . . . DEBU[5421] notify [DailyTest[c1fbb74][active]] source=notify.go:400 step=retry WARN[5421] Notify attempt 1 failed: require_tls: true (default), but "<relay-host-value-here>" does not advertise the STARTTLS extension source=notify.go:193 WARN[5421] Notify attempt 2 failed: require_tls: true (default), but "<relay-host-value-here>" does not advertise the STARTTLS extension source=notify.go:193 WARN[5422] Notify attempt 3 failed: require_tls: true (default), but "<relay-host-value-here>" does not advertise the STARTTLS extension source=notify.go:193 WARN[5422] Notify attempt 4 failed: require_tls: true (default), but "<relay-host-value-here>" does not advertise the STARTTLS extension source=notify.go:193 WARN[5424] Notify attempt 5 failed: require_tls: true (default), but "<relay-host-value-here>" does not advertise the STARTTLS extension source=notify.go:193 WARN[5426] Notify attempt 6 failed: require_tls: true (default), but "<relay-host-value-here>" does not advertise the STARTTLS extension source=notify.go:193 WARN[5429] Notify attempt 7 failed: require_tls: true (default), but "<relay-host-value-here>" does not advertise the STARTTLS extension source=notify.go:193 WARN[5436] Notify attempt 8 failed: require_tls: true (default), but "<relay-host-value-here>" does not advertise the STARTTLS extension source=notify.go:193 WARN[5443] Notify attempt 9 failed: require_tls: true (default), but "<relay-host-value-here>" does not advertise the STARTTLS extension source=notify.go:193 WARN[5453] Notify attempt 10 failed: require_tls: true (default), but "<relay-host-value-here>" does not advertise the STARTTLS extension source=notify.go:193 WARN[5467] Notify attempt 11 failed: require_tls: true (default), but "<relay-host-value-here>" does not advertise the STARTTLS extension source=notify.go:193 WARN[5497] Notify attempt 12 failed: require_tls: true (default), but "<relay-host-value-here>" does not advertise the STARTTLS extension source=notify.go:193 WARN[5544] Notify attempt 13 failed: require_tls: true (default), but "<relay-host-value-here>" does not advertise the STARTTLS extension source=notify.go:193 WARN[5610] Notify attempt 14 failed: require_tls: true (default), but "<relay-host-value-here>" does not advertise the STARTTLS extension source=notify.go:193 WARN[5658] Notify attempt 15 failed: require_tls: true (default), but "<relay-host-value-here>" does not advertise the STARTTLS extension source=notify.go:193 DEBU[5660] Received alert alert=DailyTest[c1fbb74][active] component=dispatcher source=dispatch.go:160 ERRO[5721] Error on notify: context deadline exceeded source=notify.go:152 ERRO[5721] Notify for 1 alerts failed: context deadline exceeded source=dispatch.go:238
I saw a config to turn-off the require_tls by making the value false and put it in the global. Then I reload/restart the alertmanager. I still get an error above.
So what I did was to edit the DefaultEmailConfig's RequiredTLS (config/notifiers.go line 36) to false. Compile, start and I was able to receive email alerts.
As far as I can tell you have to set require_tls to false for each email config. I could not find a way to set it as a global configuration.
eg:
...
receivers:
- name: 'devops'
email_configs:
- to: '[email protected]'
require_tls: false
Maybe a global option to set the default would be helpful.
Yes, require_tls is per email config. It should give you a config error if it is in the global section. If not, that would be a bug.
Making it an actual global option would be a feature request.
I see, well this ticket can be close. Global option would be great. Thank you guys.
I have edited the title accordingly.
Yes, require_tls is per email config. It should give you a config error if it is in the global section. If not, that would be a bug.
It doesn't report any errors.