Gitlab SMTP shows "Net::SMTPAuthenticationError: 503 5.5.1 Error: authentication not enabled"

1,880 views
Skip to first unread message

Marslo Jiao

unread,
Mar 7, 2017, 10:49:21 AM3/7/17
to GitLab
The mail account and password works in our JIRA and Confluence, but it just cannot work in my environment. I've check online and tried about 1 week, but still cannot find the solution. May I know what's wrong?
Thanks.

The /etc/gitlab/gitlab.rb:
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = 'smtp.company.com'
gitlab_rails['smtp_port'] = 25
gitlab_rails['smtp_user_name'] = 'my....@company.com'
gitlab_rails['smtp_password'] = 'password'
gitlab_rails['smtp_domain'] = 'company.com'
# gitlab_rails['smtp_authentication'] = 'login' or 'plain'
gitlab_rails['smtp_authentication'] = 'plain'
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = false
gitlab_rails['smtp_openssl_verify_mode'] = 'none'


/opt/gitlab/embedded/service/gitlab-rails/config/environments/production.rb:
# config.action_mailer.delivery_method = :sendmail
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.eager_load = true
config.allow_concurrency = false


The test command shows:
> Notify.test_email('marsl...@company.com', 'Message Subject', 'Message Body').deliver_now
Notify#test_email: processed outbound mail in 1.3ms

Sent mail to marsl...@company.com (685.6ms)
Date: Tue, 07 Mar 2017 23:24:36 +0800
From: GitLab <my....@company.com>
Reply-To: GitLab <my....@philips.com>
Message-ID: <58bed0b46c4d4_1dc...@Gitlab.mail>
Subject: Message Subject
Mime-Version: 1.0
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body><p>Message Body</p></body></html>

Net::SMTPAuthenticationError: 503 5.5.1 Error: authentication not enabled

        from /opt/gitlab/embedded/lib/ruby/2.3.0/net/smtp.rb:977:in `check_auth_response'
        from /opt/gitlab/embedded/lib/ruby/2.3.0/net/smtp.rb:741:in `auth_plain'
        from /opt/gitlab/embedded/lib/ruby/2.3.0/net/smtp.rb:733:in `authenticate'
        from /opt/gitlab/embedded/lib/ruby/2.3.0/net/smtp.rb:568:in `do_start'
        from /opt/gitlab/embedded/lib/ruby/2.3.0/net/smtp.rb:521:in `start'
        from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/mail-2.6.4/lib/mail/network/delivery_methods/smtp.rb:113:in `deliver!'
        from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/mail-2.6.4/lib/mail/message.rb:2149:in `do_delivery'
        from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/mail-2.6.4/lib/mail/message.rb:237:in `block in deliver'
        from /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'
        from /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'
        from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
        from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/notifications.rb:164:in `instrument'
        from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/actionmailer-4.2.7.1/lib/action_mailer/base.rb:541:in `deliver_mail'
        from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/mail-2.6.4/lib/mail/message.rb:237:in `deliver'
        from /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'
        from (irb):2
        from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/commands/console.rb:110:in `start'
        from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/commands/console.rb:9:in `start'
        from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:68:in `console'
        from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
        from /opt/gitlab/embedded/service/gem/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/commands.rb:17:in `<top (required)>'
        from bin/rails:9:in `require'
        from bin/rails:9:in `<main>'
irb(main):003:0> exit

Marslo Jiao

unread,
Mar 7, 2017, 10:52:12 AM3/7/17
to GitLab
Here my environment:
* OS: Ubuntu 16.04 LTS
* Gitlab: 8.15.4
git version 2.7.4

Marslo Jiao

unread,
Mar 15, 2017, 1:01:40 PM3/15/17
to GitLab
Anyone can  help me?
Thanks in advanced.


On Tuesday, March 7, 2017 at 11:49:21 PM UTC+8, Marslo Jiao wrote:
The mail account and password works in our JIRA and Confluence, but it just cannot work in my environment. I've check online and tried about 1 week, but still cannot find the solution. May I know what's wrong?
Thanks.

The /etc/gitlab/gitlab.rb:
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = 'smtp.company.com'
gitlab_rails['smtp_port'] = 25
gitlab_rails['smtp_user_name'] = 'my....@company.com'
gitlab_rails['smtp_password'] = 'password'
gitlab_rails['smtp_domain'] = 'company.com'
# gitlab_rails['smtp_authentication'] = 'login' or 'plain'
gitlab_rails['smtp_authentication'] = 'plain'
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = false
gitlab_rails['smtp_openssl_verify_mode'] = 'none'


/opt/gitlab/embedded/service/gitlab-rails/config/environments/production.rb:
# config.action_mailer.delivery_method = :sendmail
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.eager_load = true
config.allow_concurrency = false


The test command shows:
> Notify.test_email('marslo.ji...@company.com', 'Message Subject', 'Message Body').deliver_now
Notify#test_email: processed outbound mail in 1.3ms

Sent mail to marsl...@company.com (685.6ms)
Date: Tue, 07 Mar 2017 23:24:36 +0800
From: GitLab <my....@company.com>
Reply-To: GitLab <my....@philips.com>
Message-ID: <58bed0b46c4d4_1dce3fdc836db1146863@Gitlab.mail>

Magnus Therning

unread,
Mar 16, 2017, 5:03:35 AM3/16/17
to gitl...@googlegroups.com

Marslo Jiao <marsl...@gmail.com> writes:

> Anyone can help me?
> Thanks in advanced.

My suggestion is that you also check the mail server logs, maybe they
can shed more light on the issue.

/M

--
Magnus Therning, magnus....@cipherstone.com
Cipherstone Technologies AB
Theres Svenssons gata 10, 417 55 Gothenburg, Sweden

Unix is the answer, but only if you phrase the question very
carefully.
— Unknown
Message has been deleted

Marslo Jiao

unread,
Apr 24, 2017, 8:03:38 AM4/24/17
to GitLab
After the gitlab_rails['smtp_tls'] = false set to gitlab_rails['smtp_tls'] = true

The error shows to OPENSSL error, but still haven't any clue about it.

irb(main):001:0> Notify.test_email('marsl...@mycompany.com', 'test subject', 'test body').deliver_now

Notify#test_email: processed outbound mail in 408.9ms

Sent mail to marsl...@mycompany.com (545.2ms)
Date: Mon, 24 Apr 2017 19:08:18 +0800
From: GitLab <my....@mycompany.com>
Reply-To: GitLab <my....@mycompany.com>
Message-ID: <58fddca2a24f6_3f0...@Gitlab.mail>
Subject: test subject
Mime-Version: 1.0
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: 7bit
Auto-Submitted: auto-generated
X-Auto-Response-Suppress: All

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body><p>test body</p></body></html>

OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol
        from /opt/gitlab/embedded/lib/ruby/2.3.0/net/smtp.rb:587:in `connect'
        from /opt/gitlab/embedded/lib/ruby/2.3.0/net/smtp.rb:587:in `tlsconnect'
        from /opt/gitlab/embedded/lib/ruby/2.3.0/net/smtp.rb:555:in `do_start'
        from /opt/gitlab/embedded/lib/ruby/2.3.0/net/smtp.rb:521:in `start'
        from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/mail-2.6.4/lib/mail/network/delivery_methods/smtp.rb:113:in `deliver!'
        from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/mail-2.6.4/lib/mail/message.rb:2149:in `do_delivery'
        from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/mail-2.6.4/lib/mail/message.rb:237:in `block in deliver'
        from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/actionmailer-4.2.8/lib/action_mailer/base.rb:543:in `block in deliver_mail'
        from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/notifications.rb:164:in `block in instrument'
        from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
        from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/notifications.rb:164:in `instrument'
        from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/actionmailer-4.2.8/lib/action_mailer/base.rb:541:in `deliver_mail'
        from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/mail-2.6.4/lib/mail/message.rb:237:in `deliver'
        from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/actionmailer-4.2.8/lib/action_mailer/message_delivery.rb:85:in `deliver_now'
        from (irb):1
        from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/commands/console.rb:110:in `start'
        from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/commands/console.rb:9:in `start'
        from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/commands/commands_tasks.rb:68:in `console'
        from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
        from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/commands.rb:17:in `<top (required)>'
        from bin/rails:9:in `require'
        from bin/rails:9:in `<main>'

Postfix Configuration:

# postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
inet_interfaces = all
inet_protocols = all
mailbox_size_limit = 0
mydestination = $myhostname, Gitlab, www.gitlab.mycompany.com CNHSZHDCS1VU107, localhost.localdomain, localhost
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_sasl_auth_enable = yes
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noplaintext
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes


# postconf -M
smtp       inet  n       -       y       -       -       smtpd
pickup     unix  n       -       y       60      1       pickup
cleanup    unix  n       -       y       -       0       cleanup
qmgr       unix  n       -       n       300     1       qmgr
tlsmgr     unix  -       -       y       1000?   1       tlsmgr
rewrite    unix  -       -       y       -       -       trivial-rewrite
bounce     unix  -       -       y       -       0       bounce
defer      unix  -       -       y       -       0       bounce
trace      unix  -       -       y       -       0       bounce
verify     unix  -       -       y       -       1       verify
flush      unix  n       -       y       1000?   0       flush
proxymap   unix  -       -       n       -       -       proxymap
proxywrite unix  -       -       n       -       1       proxymap
smtp       unix  -       -       y       -       -       smtp
relay      unix  -       -       y       -       -       smtp
showq      unix  n       -       y       -       -       showq
error      unix  -       -       y       -       -       error
retry      unix  -       -       y       -       -       error
discard    unix  -       -       y       -       -       discard
local      unix  -       n       n       -       -       local
virtual    unix  -       n       n       -       -       virtual
lmtp       unix  -       -       y       -       -       lmtp
anvil      unix  -       -       y       -       1       anvil
scache     unix  -       -       y       -       1       scache
maildrop   unix  -       n       n       -       -       pipe flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
uucp       unix  -       n       n       -       -       pipe flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
ifmail     unix  -       n       n       -       -       pipe flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp      unix  -       n       n       -       -       pipe flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix - n       n       -       2       pipe flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman    unix  -       n       n       -       -       pipe flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py ${nexthop} ${user}

Aleksey Tsalolikhin

unread,
Apr 24, 2017, 8:17:14 AM4/24/17
to gitl...@googlegroups.com
What does the mail server log say?

On Apr 24, 2017 8:03 AM, "Marslo Jiao" <marsl...@gmail.com> wrote:
After the gitlab_rails['smtp_tls'] = false set to gitlab_rails['smtp_tls'] = true

The error shows to OPENSSL error, but still haven't any clue about it.

irb(main):001:0> Notify.test_email('marslo.ji...@mycompany.com', 'test subject', 'test body').deliver_now

Notify#test_email: processed outbound mail in 408.9ms

Sent mail to marsl...@mycompany.com (545.2ms)
Date: Mon, 24 Apr 2017 19:08:18 +0800
From: GitLab <my....@mycompany.com>
Reply-To: GitLab <my....@mycompany.com>
Message-ID: <58fddca2a24f6_3f0c3fd89a4db11c643c0@Gitlab.mail>

--
You received this message because you are subscribed to the Google Groups "GitLab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gitlabhq+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gitlabhq/136d0cff-06f3-4757-8df2-ea751493d0e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages