huginn: SMTP Error: SSL_connect returned=1 errno=0 state=error: certificate verify failed (self signed certificate)

Hello! I use the Huginn Docker image and update the image each week. After the last update I noticed that all of my emails were failing to send with this error:

SSL_connect returned=1 errno=0 state=error: certificate verify failed (self signed certificate)

My postfix instance does not require authentication, does not use encryption, and doesn’t have a certificate.

Any ideas why this might have happened and how I can fix it? I’ve tried a number of permutations of the SMTP_* env vars and I haven’t been able to get past it.

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 3
  • Comments: 45 (21 by maintainers)

Most upvoted comments

I’ve ran into the same issue and I suspect it’s a regression, since an older version works.

Thanks, that at least confirms that the our money patch didn’t break anything.

Maybe you are hitting this https://meta.discourse.org/t/email-hostname-certificate-mismatch-causing-sidekiq-queue-overload-severe-site-instability/225778/47

Can you try it with

SMTP_ENABLE_STARTTLS_AUTO=true
SMTP_SSL=true

Could you all try to update Huginn to the latest version and check if you are still getting the same exception? If yes it should only include “upstream” code and we need to figure out what configuration change we need to allow to connect to SMTP with self signed/invalid certificates .

Thank you @dsander for the suggestion with the lowercase of none, however the error message is still pretty much the same afterwards (I updated the docker images today so I guess even with the different ruby version we still struggle here):

SSL_connect returned=1 errno=0 peeraddr=172.26.0.4:587 state=error: certificate verify failed (hostname mismatch)
/usr/local/lib/ruby/3.2.0/net/protocol.rb:46:in `connect_nonblock'
/usr/local/lib/ruby/3.2.0/net/protocol.rb:46:in `ssl_socket_connect'
/app/config/initializers/force_sni.rb:7:in `ssl_socket_connect'
/app/vendor/bundle/ruby/3.2.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:690:in `tlsconnect'
/app/vendor/bundle/ruby/3.2.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:666:in `do_start'
/app/vendor/bundle/ruby/3.2.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:611:in `start'
/app/vendor/bundle/ruby/3.2.0/gems/mail-2.8.1/lib/mail/network/delivery_methods/smtp.rb:109:in `start_smtp_session'
/app/vendor/bundle/ruby/3.2.0/gems/mail-2.8.1/lib/mail/network/delivery_methods/smtp.rb:100:in `deliver!'
/app/vendor/bundle/ruby/3.2.0/gems/mail-2.8.1/lib/mail/message.rb:2145:in `do_delivery'
/app/vendor/bundle/ruby/3.2.0/gems/mail-2.8.1/lib/mail/message.rb:253:in `block in deliver'