When gitlab try to send email via external smtp server, sidekiq mail queue crash with error like:

SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

Fix for package installed gitlab:

Edit /etc/gitlab/gitlab.rb and add:

For ubuntu system wide ca bundle:

gitlab_rails['smtp_ca_file'] = "/etc/ssl/certs/ca-certificates.crt"

For centos system wide ca bundle:

gitlab_rails['smtp_ca_file'] = "/etc/pki/tls/certs/ca-bundle.crt"

Or omnibus gitlab package:

gitlab_rails['smtp_ca_file'] = "/opt/gitlab/embedded/ssl/cert.pem"

Then run gitlab-ctl reconfigure.

For gitlab installed from source code:

Edit file config/initializers/smtp_settings.rb:

ActionMailer::Base.smtp_settings = {
    authentication: :login,
    ...
    # For ubuntu
    ca_file: "/etc/ssl/certs/ca-certificates.crt",
    # For centos
    #ca_file: "/etc/pki/tls/certs/ca-bundle.crt",
}

Finnaly restart gitlab service:

service gitlab restart

Links

  1. SSL certification error #1558
  2. SMTP Gmail account working on gitlab but not on gitlab-ci #2143

Comments

comments powered by Disqus