0

So the story goes: I have a score of CentOS 6.9 virtual machines, migrated to Microsoft's Azure cloud by VHD upload. Once deployed I found out that Azure doesn't allow to send out email directly from the VM – I am supposed to use an external relay. Microsoft seems to suggest Sendgrid and they have a free tier, so I signed up, configured Postfix according to their instructions (see below) and... nothing. I can't get Postfix to authenticate with the relay SMTP server, or any other external relay, like my own server at gzo.com (exim on cPanel ) or aruba.it (an italian hosting provider).

I made various attempt on ports 587, 2525 and 465 with all those relays, each time postmap-ping the SASL password file and restarting Postfix, and all failed with the following error:

Mar 14 11:17:34 Riprid postfix/postfix-script[6664]: stopping the Postfix mail system
Mar 14 11:17:34 Riprid postfix/master[60718]: terminating on signal 15
Mar 14 11:17:34 Riprid postfix/postfix-script[6736]: starting the Postfix mail system
Mar 14 11:17:34 Riprid postfix/master[6737]: daemon started -- version 2.6.6, configuration /etc/postfix
Mar 14 11:20:00 Riprid postfix/pickup[6739]: 90887634B3: uid=0 from=<root>
Mar 14 11:20:00 Riprid postfix/cleanup[6914]: 90887634B3: message-id=<20180314102000.90887634B3@Riprid.localdomain>
Mar 14 11:20:00 Riprid postfix/qmgr[6740]: 90887634B3: from=<root@Riprid.localdomain>, size=437, nrcpt=1 (queue active)
Mar 14 11:20:02 Riprid postfix/smtp[6916]: warning: SASL authentication failure: No worthy mechs found
Mar 14 11:20:02 Riprid postfix/smtp[6916]: 90887634B3: SASL authentication failed; cannot authenticate to server smtp.sendgrid.net[161.202.148.160]: no mechanism available
Mar 14 11:20:03 Riprid postfix/smtp[6916]: warning: SASL authentication failure: No worthy mechs found
Mar 14 11:20:03 Riprid postfix/smtp[6916]: 90887634B3: to=<dejan@kozina.com>, relay=smtp.sendgrid.net[169.38.103.39]:587, delay=3.2, delays=0.06/0.03/3.1/0, dsn=4.7.0, status=deferred (SASL authentication failed; cannot authenticate to server smtp.sendgrid.net[169.38.103.39]: no mechanism available)

The user credentials are correct: I indeed managed to connect from the Linux shell to all three servers via telnet, open a SMTP session, successfully authenticate both via AUTH PLAIN and AUTH LOGIN, and manually send a test message to myself. It's just Postfix that can't do it.

Still more puzzling: I copied the very same configuration to the original virtual machines from which the VMs in the cloud have been cloned (in-house Hyper-V on premises) and they connect and send mail thru the same servers without error. The machines on Azure are identical to those on premises, except for the modifications required to run on Azure as listed by Microsoft.

I've found dozens of suggestions googling around, and I've tried them all with no effect. I'm running out of ideas (and of time). Please suggest: where else should I look? What else could I try?

This is the configuration (user and password obscurated):

[root@Riprid zeta]# uname -a
Linux Riprid 2.6.32-696.20.1.el6.centos.plus.x86_64 #1 SMP Sun Jan 28 07:56:00 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

[root@Riprid zeta]# postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
header_size_limit = 4096000
html_directory = no
inet_interfaces = all
inet_protocols = ipv4
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mynetworks_style = host
newaliases_path = /usr/bin/newaliases.postfix
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
relayhost = [smtp.sendgrid.net]:587
sample_directory = /usr/share/doc/postfix-2.6.6/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtp_generic_maps = hash:/etc/postfix/generic
smtp_sasl_auth_enable = yes
smtp_sasl_mechanism_filter = plain, login
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_type = cyrus
smtp_tls_CAfile = /etc/postfix/gd_bundle-g2-g1.crt
smtp_tls_security_level = may
smtpd_sasl_security_options = noanonymous
smtpd_sasl_tls_security_options = noanonymous
smtpd_tls_auth_only = no
unknown_local_recipient_reject_code = 550

[root@Riprid zeta]# cat /etc/postfix/sasl_passwd
[smtp.sendgrid.net]:587 azure_260************af88@azure.com:OL***0***w**

[root@Riprid zeta]# cat /etc/sasl2/smtpd.conf
pwcheck_method: saslauthd
mech_list: PLAIN LOGIN

[root@Riprid zeta]# service saslauthd status
saslauthd (pid  28917) is running...

[root@Riprid zeta]# postconf -A
cyrus

[root@Riprid zeta]# yum list postfix cyrus*
...
Installed Packages
cyrus-sasl.x86_64                 2.1.23-15.el6_6.2                  @updates
cyrus-sasl-devel.x86_64           2.1.23-15.el6_6.2                  @updates
cyrus-sasl-lib.x86_64             2.1.23-15.el6_6.2                  @updates
cyrus-sasl-md5.x86_64             2.1.23-15.el6_6.2                  @base
cyrus-sasl-ntlm.x86_64            2.1.23-15.el6_6.2                  @base
cyrus-sasl-plain.x86_64           2.1.23-15.el6_6.2                  @base
postfix.x86_64                    2:2.6.6-8.el6.centos.plus          @centosplus

And, finally, this is the output of saslfinger:

[root@Riprid zeta]# saslfinger -c
saslfinger - postfix Cyrus sasl configuration Wed Mar 14 11:17:38 CET 2018
version: 1.0.2
mode: client-side SMTP AUTH

-- basics --
Postfix: 2.6.6
System: CentOS release 6.9 (Final)

-- smtp is linked to --
        libsasl2.so.2 => /usr/lib64/libsasl2.so.2 (0x00007f79ea3db000)

-- active SMTP AUTH and TLS parameters for smtp --
relayhost = [smtp.sendgrid.net]:587
smtp_sasl_auth_enable = yes
smtp_sasl_mechanism_filter = plain, login
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_type = cyrus
smtp_tls_CAfile = /etc/postfix/gd_bundle-g2-g1.crt
smtp_tls_security_level = may


-- listing of /usr/lib64/sasl2 --
total 640
drwxr-xr-x.  2 root root  4096 Mar 12 22:49 .
dr-xr-xr-x. 68 root root 45056 Mar 14 03:25 ..
-rwxr-xr-x.  1 root root 18776 Mar 25  2015 libanonymous.so
-rwxr-xr-x.  1 root root 18776 Mar 25  2015 libanonymous.so.2
-rwxr-xr-x.  1 root root 18776 Mar 25  2015 libanonymous.so.2.0.23
-rwxr-xr-x.  1 root root 22936 Mar 25  2015 libcrammd5.so
-rwxr-xr-x.  1 root root 22936 Mar 25  2015 libcrammd5.so.2
-rwxr-xr-x.  1 root root 22936 Mar 25  2015 libcrammd5.so.2.0.23
-rwxr-xr-x.  1 root root 52088 Mar 25  2015 libdigestmd5.so
-rwxr-xr-x.  1 root root 52088 Mar 25  2015 libdigestmd5.so.2
-rwxr-xr-x.  1 root root 52088 Mar 25  2015 libdigestmd5.so.2.0.23
-rwxr-xr-x.  1 root root 18808 Mar 25  2015 liblogin.so
-rwxr-xr-x.  1 root root 18808 Mar 25  2015 liblogin.so.2
-rwxr-xr-x.  1 root root 18808 Mar 25  2015 liblogin.so.2.0.23
-rwxr-xr-x.  1 root root 35376 Mar 25  2015 libntlm.so
-rwxr-xr-x.  1 root root 35376 Mar 25  2015 libntlm.so.2
-rwxr-xr-x.  1 root root 35376 Mar 25  2015 libntlm.so.2.0.23
-rwxr-xr-x.  1 root root 18808 Mar 25  2015 libplain.so
-rwxr-xr-x.  1 root root 18808 Mar 25  2015 libplain.so.2
-rwxr-xr-x.  1 root root 18808 Mar 25  2015 libplain.so.2.0.23
-rwxr-xr-x.  1 root root 22784 Mar 25  2015 libsasldb.so
-rwxr-xr-x.  1 root root 22784 Mar 25  2015 libsasldb.so.2
-rwxr-xr-x.  1 root root 22784 Mar 25  2015 libsasldb.so.2.0.23

-- listing of /etc/sasl2 --
total 20
drwxr-xr-x.   2 root root  4096 Sep 19 15:39 .
drwxr-xr-x. 110 root root 12288 Mar 14 03:23 ..
-rw-r--r--.   1 root root    49 Feb 21 16:39 smtpd.conf

-- permissions for /etc/postfix/sasl_passwd --
-rw-------. 1 root root 90 Mar 14 11:17 /etc/postfix/sasl_passwd

-- permissions for /etc/postfix/sasl_passwd.db --
-rw-------. 1 root root 12288 Mar 14 11:17 /etc/postfix/sasl_passwd.db

/etc/postfix/sasl_passwd.db is up to date.

-- active services in /etc/postfix/master.cf --
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
smtp      inet  n       -       n       -       -       smtpd
pickup    fifo  n       -       n       60      1       pickup
cleanup   unix  n       -       n       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
tlsmgr    unix  -       -       n       1000?   1       tlsmgr
rewrite   unix  -       -       n       -       -       trivial-rewrite
bounce    unix  -       -       n       -       0       bounce
defer     unix  -       -       n       -       0       bounce
trace     unix  -       -       n       -       0       bounce
verify    unix  -       -       n       -       1       verify
flush     unix  n       -       n       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       n       -       -       smtp
relay     unix  -       -       n       -       -       smtp
        -o smtp_fallback_relay=
showq     unix  n       -       n       -       -       showq
error     unix  -       -       n       -       -       error
retry     unix  -       -       n       -       -       error
discard   unix  -       -       n       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       n       -       -       lmtp
anvil     unix  -       -       n       -       1       anvil
scache    unix  -       -       n       -       1       scache

-- mechanisms on [smtp.sendgrid.net]:587 --

-- end of saslfinger output --

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.