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

Consider a global config option for require_tls #433

Closed
kaoruu opened this Issue Jul 20, 2016 · 5 comments

Comments

Projects
None yet
4 participants
@kaoruu

kaoruu commented Jul 20, 2016

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: "myname@mydomain.com"
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.

@sahne

This comment has been minimized.

Show comment
Hide comment
@sahne

sahne Jul 20, 2016

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: 'devops@example.com'
    require_tls: false

Maybe a global option to set the default would be helpful.

sahne commented Jul 20, 2016

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: 'devops@example.com'
    require_tls: false

Maybe a global option to set the default would be helpful.

@beorn7

This comment has been minimized.

Show comment
Hide comment
@beorn7

beorn7 Jul 20, 2016

Member

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.

Member

beorn7 commented Jul 20, 2016

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.

@kaoruu

This comment has been minimized.

Show comment
Hide comment
@kaoruu

kaoruu Jul 20, 2016

I see, well this ticket can be close. Global option would be great. Thank you guys.

kaoruu commented Jul 20, 2016

I see, well this ticket can be close. Global option would be great. Thank you guys.

@beorn7 beorn7 changed the title from [BUG] Forcing the RequiredTLS on Default Email config even if it is set to false in the alertmanager's config to Consider a global config option for require_tls Jul 20, 2016

@beorn7

This comment has been minimized.

Show comment
Hide comment
@beorn7

beorn7 Jul 20, 2016

Member

I have edited the title accordingly.

Member

beorn7 commented Jul 20, 2016

I have edited the title accordingly.

@powerman

This comment has been minimized.

Show comment
Hide comment
@powerman

powerman Oct 30, 2016

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.

powerman commented Oct 30, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment