SMTP-AUTH対応にする
(CentOS5)Modified: 24 February 2008
Created: 11 February 2008CentOS5 で、SMTP-AUTHは、cyrus-sasl によって簡単に設定できるようになっています。
基本的な設定をする (11 February 2008)
認証方法を制限する (11 February 2008)
認証に関する実験 (11 February 2008)
"/etc/postfix/main.cf"に、以下を追加します。
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_unauth_destination,
permit_auth_destination,
reject
smtpd_sasl_security_options = noanonymous
メールクライアントで、OutlookExpressを使うなら以下も設定します。
これは、OutlookExpressのバグ回避のための設定だそうです。
broken_sasl_auth_clients = yes Postfixを再起動します。
# service postfix restart saslauthdを起動します。
# service saslauthd start
OutlookExpressの場合、以下のエラーが出ます。
pFeb 24 11:26:33 mail52 postfix/smtpd[22741]: warning: SASL authentication failure: no secret in database
Feb 24 11:26:33 mail52 postfix/smtpd[22741]: warning: unknown[203.140.77.26]: SASL NTLM authentication failed: authentication failure
Feb 24 11:26:51 mail52 postfix/smtpd[22741]: warning: unknown[203.140.77.26]: SASL NTLM authentication aborted"/usr/lib/sasl2/smtpd.conf"に、"mech_list" を追加します。
pwcheck_method: saslauthd
mech_list: login
plain認証や、login認証を禁止して、さらにセキュリティを強化するなら "/etc/postfix/main.cf"に、以下を追加します。
smtpd_sasl_security_options = noanonymous, noplaintext
- noanonymous: 匿名認証を禁止する
- noplaintext: plain認証とlogin認証を禁止する
いろいろな認証を試してみる
まず、認証用のパスワードを設定する。
# saslpasswd2 -u good-stream.com tomo
Password: ********
Again (for verification): ********
#以下のコマンドで、アクセス権の設定をします。
# chgrp postfix /etc/sasldb2 設定をしない場合、以下のエラーが出て認証が通りません。
Feb 11 11:42:07 baimail5 postfix/smtpd[2524]: warning: SASL authentication problem: unable to open Berkeley db /etc/sasldb2: Permission denied "/usr/lib/sasl/smtpd.conf"を確認します。
pwcheck_method: saslauthd
saslauthd_version: 2
クライアントで、CRAM-MD5 を指定した場合
Feb 11 12:36:21 baimail5 postfix/smtpd[3050]: warning: SASL authentication failure: no secret in database
Feb 11 12:36:21 baimail5 postfix/smtpd[3050]: warning: unknown[203.140.77.26]: SASL CRAM-MD5 authentication failed: authentication failure
Feb 11 12:36:21 baimail5 postfix/smtpd[3050]: warning: unknown smtpd restriction: "reject_unauth_detination"
"/etc/sasldb2"が参照されています。
クライアントで、LOGIN を指定した場合
Feb 11 12:36:48 baimail5 postfix/smtpd[3050]: warning: unknown[203.140.77.26]: SASL LOGIN authentication failed: authentication failure
Feb 11 12:36:48 baimail5 postfix/smtpd[3050]: warning: unknown smtpd restriction: "reject_unauth_detination"
"/etc/sasldb2"を参照していません。
クライアントで、PLAIN を指定した場合
Feb 11 12:37:27 baimail5 postfix/smtpd[3050]: warning: SASL authentication failure: Password verification failed
Feb 11 12:37:27 baimail5 postfix/smtpd[3050]: warning: unknown[203.140.77.26]: SASL PLAIN authentication failed: authentication failure
Feb 11 12:37:27 baimail5 postfix/smtpd[3050]: warning: unknown smtpd restriction: "reject_unauth_detination"
"/etc/sasldb2"を参照していません。