カスタム検索
tomo.gif (1144 ツバツイツト)line.gif (927 ツバツイツト)line.gif (927 ツバツイツト)line.gif (927 ツバツイツト)To previous pageTo home pageMailing to me

PostfixにSMTP Authを設定する
(CentOS3.5)

Modified: 18 August 2006

CentOS3.5には、デフォルトで、Cyrus-SASLがインストールされていますので、設定のみ行えば使えます。

認証には、SASLパスワードによる方法と、UNIXアカウントで行う方式がありますが、SASLパスワードによる方法がうまくいかなかったので、UNIXアカウントで行う方式にしました。

参考になったページ

PostfixによるSMTPサーバの構築(CentOS標準版編)
http://www.aconus.com/~oyaji/centos/smtp-centos.htm

CentOSにインストールされているドキュメントも参考になります。
"/usr/share/doc/postfix-2.1.x/README-Postfix-SASL-RedHat.txt"


CyrusSASLの設定
PostfixでSMTP Authが使えるようにする
動作確認する


 CyrusSASLの設定 

"smtpd.conf"の変更

"/usr/lib/sasl2/smtpd.conf"以下のように追加します。

pwcheck_method: saslauthd


"saslauthd"を起動

# service saslauthd start
saslauthdを起動中:                                         [  OK  ]
#

 PostfixでSMTP Authが使えるようにする

"main.cf"を変更する

broken_sasl_auth_clients = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $mydomain
smtpd_sasl_security_options = noanonymous
smtpd_recipient_restrictions =
    permit_mynetworks,
    permit_sasl_authenticated,
    reject_unauth_destination,
    permit_auth_destination,
    reject

"SMTP Auth"の利用を許可する。

smtpd_sasl_auth_enable = yes

"anonymous"接続を拒否する。

smtpd_sasl_security_options = noanonymous

OutlookExpressから利用する場合には、以下も加えます。

broken_sasl_auth_clients = yes

SMTPを受け付ける条件を指定する。

smtpd_recipient_restrictions =
   
permit_mynetworks,
    permit_sasl_authenticated,
    reject_unauth_destination,
    permit_auth_destination,
    reject
  1. permit_mynetworksは、サーバー内のネットワーク、つまり内部からの利用を許可するものです。
  2. permit_sasl_authenticated は、sasl認証できたものだけ受け入れる。
  3. reject_unauth_destination で、認証できなかったものは、拒否する。
  4. permit_auth_destination で、認証できたものは、受け入れる。
  5. reject で、その他は、拒否する。

以下の変更をしていないとうまくいきませんでした。

myorigin = $myhostname


"Postfix"を再起動します

以下のコマンドで、"Postfix"を再起動します。

# /etc/init.d/postfix restart
Shutting down postfix:                                     [  OK  ]
Starting postfix:                                          [  OK  ]
#

 CyrusSASLのパスワードデータベースの作成

ユーザの作成

以下のコマンドで、SMTP認証のためのユーザを作ります。

# /useradd tomo -s /sbin/nologin
#


パスワードデータベースの作成

以下のコマンドで、SMTP認証のための"/etc/sasldb" にパスワードデータベースが作成されます。

# /usr/sbin/saslpasswd -c tomo
Password: ******
Again (for verification): ******
#

パスワードが簡単すぎる場合は、以下のメッセージが出ますので、もっと複雑にしてやり直します。

saslpasswd: generic failure

登録したユーザを確認します。

# /usr/sbin/sasldblistusers
user: tomo realm: rh73-99-postfix.tomo.ac mech: CRAM-MD5
user: tomo realm: rh73-99-postfix.tomo.ac mech: PLAIN
user: tomo realm: rh73-99-postfix.tomo.ac mech: DIGEST-MD5
#

データベースのアクセス権を変更します。

# chgrp postfix /etc/sasldb
# chmod 640 /etc/sasldb

 動作確認する

実際に、Beckey! で動作確認してみます。

Beckeyの設定

「ツール」メニューから「メールボックスの設定」を選択し、以下のように、「詳細」タブを選択します。

ユーザIDとパスワードは、サーバーに登録してあるアカウントです。

認証に失敗すると、以下のダイアログが出てきます。


To previous pageTo home pageMailing to meJump to Top of pageline.gif (927 ツバツイツト)line.gif (927 ツバツイツト)tomo.gif (1144 ツバツイツト)
カスタム検索


Tweet