OpenSSL error when using GSuite and TLS

Summary

When using GSuite and port 465/587, GitLab logs one of the two following errors in sidekiq.log

OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol

EOFError: end of file reached

Steps to reproduce

The relevant sections in my gitlab.rb is as follows:

gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp-relay.gmail.com"
gitlab_rails['smtp_port'] = 587
# gitlab_rails['smtp_user_name'] = ""
# gitlab_rails['smtp_password'] = ""
gitlab_rails['smtp_domain'] = "git.samczsun.com"
gitlab_rails['smtp_authentication'] = false
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true
gitlab_rails['smtp_openssl_verify_mode'] = 'none' # Can be: 'none', 'peer', 'client_once', 'fail_if_no_peer_cert', see http://api.rubyonrails.org/classes/ActionMailer/Base.html
gitlab_rails['smtp_ca_path'] = "/etc/ssl/certs"
gitlab_rails['smtp_ca_file'] = "/etc/ssl/certs/ca-certificates.crt"

Expected behavior

I should receive an email sent using TLS

Actual behavior

I don't get an email

Relevant logs and/or screenshots

2017-01-14_04:50:42.24356 2017-01-14T04:50:42.243Z 29764 TID-ovh72qp6w WARN: OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol
2017-01-14_04:50:42.24357 2017-01-14T04:50:42.243Z 29764 TID-ovh72qp6w WARN: /opt/gitlab/embedded/lib/ruby/2.3.0/net/smtp.rb:587:in `connect'
2017-01-14_04:50:42.24357 /opt/gitlab/embedded/lib/ruby/2.3.0/net/smtp.rb:587:in `tlsconnect'
2017-01-14_04:50:42.24357 /opt/gitlab/embedded/lib/ruby/2.3.0/net/smtp.rb:555:in `do_start'
2017-01-14_04:50:42.24357 /opt/gitlab/embedded/lib/ruby/2.3.0/net/smtp.rb:521:in `start'
2017-01-14_04:50:42.24358 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/mail-2.6.4/lib/mail/network/delivery_methods/smtp.rb:113:in `deliver!'
2017-01-14_04:50:42.24358 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/mail-2.6.4/lib/mail/message.rb:2149:in `do_delivery'
2017-01-14_04:50:42.24358 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/mail-2.6.4/lib/mail/message.rb:237:in `block in deliver'
2017-01-14_04:50:42.24358 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/actionmailer-4.2.7.1/lib/action_mailer/base.rb:543:in `block in deliver_mail'
2017-01-14_04:50:42.24358 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/notifications.rb:164:in `block in instrument'
2017-01-14_04:50:42.24358 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
2017-01-14_04:50:42.24358 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/notifications.rb:164:in `instrument'
2017-01-14_04:50:42.24358 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/actionmailer-4.2.7.1/lib/action_mailer/base.rb:541:in `deliver_mail'
2017-01-14_04:50:42.24359 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/mail-2.6.4/lib/mail/message.rb:237:in `deliver'
2017-01-14_04:50:42.24359 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/actionmailer-4.2.7.1/lib/action_mailer/message_delivery.rb:85:in `deliver_now'
2017-01-14_04:50:42.24359 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/actionmailer-4.2.7.1/lib/action_mailer/delivery_job.rb:10:in `perform'
2017-01-14_04:50:42.24359 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activejob-4.2.7.1/lib/active_job/execution.rb:32:in `block in perform_now'
2017-01-14_04:50:42.24359 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:117:in `call'
2017-01-14_04:50:42.24359 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
2017-01-14_04:50:42.24359 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:505:in `call'
2017-01-14_04:50:42.24360 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:498:in `block (2 levels) in around'
2017-01-14_04:50:42.24360 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:343:in `block (2 levels) in simple'
2017-01-14_04:50:42.24360 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/i18n-0.7.0/lib/i18n.rb:257:in `with_locale'
2017-01-14_04:50:42.24360 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activejob-4.2.7.1/lib/active_job/translation.rb:7:in `block (2 levels) in <module:Translation>'
2017-01-14_04:50:42.24360 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:441:in `instance_exec'
2017-01-14_04:50:42.24360 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:441:in `block in make_lambda'
2017-01-14_04:50:42.24361 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:342:in `block in simple'
2017-01-14_04:50:42.24361 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:497:in `block in around'
2017-01-14_04:50:42.24361 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:505:in `call'
2017-01-14_04:50:42.24361 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:498:in `block (2 levels) in around'
2017-01-14_04:50:42.24361 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:343:in `block (2 levels) in simple'
2017-01-14_04:50:42.24361 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activejob-4.2.7.1/lib/active_job/logging.rb:23:in `block (4 levels) in <module:Logging>'
2017-01-14_04:50:42.24361 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/notifications.rb:164:in `block in instrument'
2017-01-14_04:50:42.24362 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
2017-01-14_04:50:42.24362 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/notifications.rb:164:in `instrument'
2017-01-14_04:50:42.24362 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activejob-4.2.7.1/lib/active_job/logging.rb:22:in `block (3 levels) in <module:Logging>'
2017-01-14_04:50:42.24362 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activejob-4.2.7.1/lib/active_job/logging.rb:43:in `block in tag_logger'
2017-01-14_04:50:42.24362 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/tagged_logging.rb:68:in `block in tagged'
2017-01-14_04:50:42.24362 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/tagged_logging.rb:26:in `tagged'
2017-01-14_04:50:42.24362 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/tagged_logging.rb:68:in `tagged'
2017-01-14_04:50:42.24362 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activejob-4.2.7.1/lib/active_job/logging.rb:43:in `tag_logger'
2017-01-14_04:50:42.24363 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activejob-4.2.7.1/lib/active_job/logging.rb:19:in `block (2 levels) in <module:Logging>'
2017-01-14_04:50:42.24363 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:441:in `instance_exec'
2017-01-14_04:50:42.24363 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:441:in `block in make_lambda'
2017-01-14_04:50:42.24363 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:342:in `block in simple'
2017-01-14_04:50:42.24363 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:497:in `block in around'
2017-01-14_04:50:42.24363 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:505:in `call'
2017-01-14_04:50:42.24363 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
2017-01-14_04:50:42.24364 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:778:in `_run_perform_callbacks'
2017-01-14_04:50:42.24364 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
2017-01-14_04:50:42.24364 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activejob-4.2.7.1/lib/active_job/execution.rb:31:in `perform_now'
2017-01-14_04:50:42.24364 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activejob-4.2.7.1/lib/active_job/execution.rb:21:in `execute'
2017-01-14_04:50:42.24364 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activejob-4.2.7.1/lib/active_job/queue_adapters/sidekiq_adapter.rb:42:in `perform'
2017-01-14_04:50:42.24364 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.2.7/lib/sidekiq/processor.rb:158:in `execute_job'
2017-01-14_04:50:42.24365 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.2.7/lib/sidekiq/processor.rb:138:in `block (4 levels) in process'
2017-01-14_04:50:42.24365 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.2.7/lib/sidekiq.rb:36:in `block in <module:Sidekiq>'
2017-01-14_04:50:42.24365 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.2.7/lib/sidekiq/processor.rb:133:in `block (3 levels) in process'
2017-01-14_04:50:42.24365 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.2.7/lib/sidekiq/middleware/chain.rb:128:in `block in invoke'
2017-01-14_04:50:42.24365 /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/sidekiq_middleware/request_store_middleware.rb:6:in `call'
2017-01-14_04:50:42.24365 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.2.7/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'
2017-01-14_04:50:42.24365 /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/sidekiq_middleware/memory_killer.rb:17:in `call'
2017-01-14_04:50:42.24366 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.2.7/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'
2017-01-14_04:50:42.24366 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.2.7/lib/sidekiq/middleware/server/active_record.rb:6:in `call'
2017-01-14_04:50:42.24366 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.2.7/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'
2017-01-14_04:50:42.24366 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.2.7/lib/sidekiq/middleware/server/retry_jobs.rb:74:in `call'
2017-01-14_04:50:42.24367 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.2.7/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'
2017-01-14_04:50:42.24367 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.2.7/lib/sidekiq/middleware/server/logging.rb:11:in `block in call'
2017-01-14_04:50:42.24367 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.2.7/lib/sidekiq/logging.rb:32:in `with_context'
2017-01-14_04:50:42.24367 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.2.7/lib/sidekiq/middleware/server/logging.rb:7:in `call'
2017-01-14_04:50:42.24368 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.2.7/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'
2017-01-14_04:50:42.24368 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.2.7/lib/sidekiq/middleware/chain.rb:133:in `invoke'
2017-01-14_04:50:42.24368 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.2.7/lib/sidekiq/processor.rb:132:in `block (2 levels) in process'
2017-01-14_04:50:42.24368 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.2.7/lib/sidekiq/processor.rb:174:in `stats'
2017-01-14_04:50:42.24368 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.2.7/lib/sidekiq/processor.rb:131:in `block in process'
2017-01-14_04:50:42.24368 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.2.7/lib/sidekiq.rb:35:in `block in <module:Sidekiq>'
2017-01-14_04:50:42.24368 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.2.7/lib/sidekiq/processor.rb:126:in `process'
2017-01-14_04:50:42.24368 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.2.7/lib/sidekiq/processor.rb:82:in `process_one'
2017-01-14_04:50:42.24369 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.2.7/lib/sidekiq/processor.rb:70:in `run'
2017-01-14_04:50:42.24369 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.2.7/lib/sidekiq/util.rb:17:in `watchdog'
2017-01-14_04:50:42.24369 /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/sidekiq-4.2.7/lib/sidekiq/util.rb:25:in `block in safe_thread'

Output of checks

Results of GitLab application Check

root@phys-1-prd-cdg-lne:/etc/nginx/sites-available# gitlab-rake gitlab:check SANITIZE=true
Checking GitLab Shell ...

GitLab Shell version >= 4.1.1 ? ... OK (4.1.1)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:git?
default... yes
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ... can't check, you have no projects
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK
Send ping to redis server: OK
gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Sidekiq ...

Running? ... yes
Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking Reply by email ...

Reply by email is disabled in config/gitlab.yml

Checking Reply by email ... Finished

Checking LDAP ...

LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab ...

Git configured with autocrlf=input? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory setup correctly? ... yes
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
projects have namespace: ... can't check, you have no projects
Redis version >= 2.8.0? ... yes
Ruby version >= 2.1.0 ? ... yes (2.3.3)
Your git bin path is "/opt/gitlab/embedded/bin/git"
Git version >= 2.7.3 ? ... yes (2.8.4)
Active users: 1

Checking GitLab ... Finished

Results of GitLab environment info

root@phys-1-prd-cdg-lne:/etc/nginx/sites-available# gitlab-rake gitlab:env:info

System information
System:         Ubuntu 16.04
Current User:   git
Using RVM:      no
Ruby Version:   2.3.3p222
Gem Version:    2.6.6
Bundler Version:1.13.7
Rake Version:   10.5.0
Sidekiq Version:4.2.7

GitLab information
Version:        8.15.4
Revision:       a0b1379
Directory:      /opt/gitlab/embedded/service/gitlab-rails
DB Adapter:     postgresql
URL:            http://git.samczsun.com
HTTP Clone URL: http://git.samczsun.com/some-group/some-project.git
SSH Clone URL:  git@git.samczsun.com:some-group/some-project.git
Using LDAP:     no
Using Omniauth: no

GitLab Shell
Version:        4.1.1
Repository storage paths:
- default:      /var/opt/gitlab/git-data/repositories
Hooks:          /opt/gitlab/embedded/service/gitlab-shell/hooks/
Git:            /opt/gitlab/embedded/bin/git

Possible fixes

Assignee Loading
Time tracking Loading