SASL authentication failure: No worthy mechs found
Dovecotは自前でSASL持っててCyrus SASLいらないんじゃ?
という認識が間違っていて、強烈にハマった件。
■環境
CentOS6
postfix-2.6.6-2.2.el6_1.i686
dovecot-2.0.9-2.el6_1.1.i686
dovecot-mysql-2.0.9-2.el6_1.1.i686
Postfix+Dovecot+MySQLのバーチャルドメイン環境で
一応SMTP AUTH+SSL/TLS化している環境。
■背景
KDDIひかりユーザなので、以下の対応を使用としてハマった。
【重要】中継リレーサーバ提供終了にともなうメールソフト設定変更のお願い
http://www.auone-net.jp/news/111215.html
「Outbound Port25 Blocking」の救済処置である25番ポートで自鯖できる
『中継リレーサーバ (relay-mta.auone-net.jp/relay-mta.dion.ne.jp)』が
2012年7月下旬に終了ということで、サブミッションポートへの変更を
そろそろやっとくかと思いついた。
$ telnet ISP-SMTP 587 220 ISP-SMTP ESMTP ehlo localhost 250-ISP-SMTP 250-PIPELINING 250-SIZE 20971520 250-ETRN 250-STARTTLS 250-AUTH CRAM-MD5 DIGEST-MD5 PLAIN LOGIN # ISPの認証方式 250-AUTH=CRAM-MD5 DIGEST-MD5 PLAIN LOGIN
■アカウント格納
# echo [ISP-SMTP]:587 username:passwd >/etc/postfix/isp_acnt # chmod 640 /etc/postfix/isp_acnt # postmap /etc/postfix/isp_acnt
■設定
設定はざっくり以下のような感じ。ポイントはDovecotでsasl使用しているところ。
# SASL Authentication smtpd_sasl_auth_enable = yes smtpd_sasl_security_options = noanonymous smtpd_sasl_type = dovecot smtpd_sasl_path = private/auth smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination # OP25B relayhost = [ISP-SMTP]:587 #relayhost = [relay-mta.auone-net.jp] smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:$config_directory/isp_acnt smtp_sasl_security_options = smtp_sasl_mechanism_filter = CRAM-MD5, DIGEST-MD5, PLAIN, LOGIN
■動作確認
Gmailにメール飛ばした時のログが本件。
warning: SASL authentication failure: No worthy mechs found
postfixの「smtp_sasl_mechanism_filter」
を大文字にしたり、小文字にしたり順番変えたり。
dovecotの「auth_mechanisms」をイジクリ倒しても全部同じログ。
ちょっとおおおおおおおおお。なんでやねん。とかイライラMAX。
■解決
cyrus-saslライブラリを入れた。
# yum -y install cyrus-sasl-plain cyrus-sasl-md5
■原因
結果的には必要なパッケージがなかったということになる。
もちろん確証はないけど、SASLに関する誤った認識が原因。
smtpd_sasl_type = dovecot smtpd_sasl_path = private/auth
Postfixは自メールサーバのSMTP-AUTHにDovecotのSASLを使用してて、
クライアントとしてSASL認証する場合は、cyrus-saslを使用するってことか?
■補足
ちなみにDebianな環境は以下で対応出来る模様。
apt-get install cyrus-sasl-plain
or
apt-get install libsasl2-modules