Code of the O....rz....hov

Code of the O....rz....hov

PR

×
Sep 3, 2008
XML
カテゴリ: Debian/Ubuntu
http://hisashim.livejournal.com/333206.html


Debian etch上のPostfixでSMTP-AUTHを行い、SASL認証できたクライアントにのみ他ドメインへのリレーを許可する設定。 SASL認証にはsaslauthd + pamを使う。SSL/TLSによる通信路の暗号化は後で。

必要なものをインストール。最近はpostfixでtlsとsaslが使えるようになったので、postfix-tlsでなくてよい。あとsaslauthdを使うならlibsasl2-modulesのインストールを忘れずに。fatal: no SASL authentication mechanismsと言われる。

% sudo apt-get install postfix postfix-doc sasl2-bin libsasl2-modules

saslauthdのREADMEにPostfixから使う際の例が書いてあるので、よく読んで設定。起動を忘れずに。

% sudo vi /etc/default/saslauthd
START=yes
OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd"

% sudo adduser postfix sasl
Adding user `postfix' to group `sasl' ...
Done.

% sudo /etc/init.d/saslauthd start
Starting SASL Authentication Daemon: saslauthd.

PostfixのサーバとしてのSASL設定ファイルを作る。pwcheck_methodとmech_listの両方を指定すること。

% sudo >/etc/postfix/sasl/smtpd.conf
% sudo vi /etc/postfix/sasl/smtpd.conf
pwcheck_method: saslauthd
mech_list: plain login

Postfixのmain.cfにSASLの設定を追加してリロード。



* 設定ファイルのデリミタは空白のみが安全らしい。カンマは避ける。
* Postfixがクライアントとして動作するときの挙動はsmtp_*で、サーバとして動作するときの挙動はsmtpd_*で制御する。
* PostfixのSASL_README.htmlにあるsmtpd_recipient_restrictionsの設定例の右辺は = permit_mynetworks permit_sasl_authenticatedとなっているが、拒否を意味する値を1つは含めないとエラーを吐いて動かない模様。 ただしrejectだと554 5.7.1 johnd@example.org: Recipient address rejected: Access denied; となってまともなユーザまでメールを受け取れなくなるので、reject_unauth_destinationに。

% sudo vi /etc/postfix/main.cf
smtpd_sasl_auth_enable = yes

% sudo postconf -n
% sudo /etc/init.d/postfix reload

% telnet localhost smtp
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 example.org ESMTP Postfix
EHLO foo
250-example.org
...
250-AUTH PLAIN LOGIN
...

% sudo tail /var/log/mail.log

Thunderbirdで試してみるときはログを取るとよい。

notepad C:\Program Files\Mozilla Thunderbird\thunderbird-log.bat
set NSPR_LOG_FILE=.\log.txt
set NSPR_LOG_MODULES=IMAP:5,POP3:5,NNTP:5,SMTP:5
"C:\Program Files\Mozilla Thunderbird\thunderbird.exe"

sshで中継するときも-vで冗長にメッセージを出してもらうとよい。

% slogin -v -L 993:example.org:993 -L 25:example.org:25 jdoe@example.org

資料:

* /usr/share/doc/postfix/README.Debian
* /usr/share/doc/sasl2-bin/README.Debian
* http://www.postfix-jp.info/trans-2.3/jhtml/SASL_README.html
* http://www.postfix-jp.info/trans-2.3/jhtml/SMTPD_ACCESS_README.html
* http://www.postfix-jp.info/origdocs/install-report-sasl.html
* http://www.araki.net/wiki/araki-wiliki.cgi?araki%3apostfix%3apostfix-book-errata1
* http://hurring.com/howto/debian_postfix_sasl/
If you get the "fatal: no SASL authentication mechanisms" error message from postfix, install "libsasl2-modules"
* http://www.mozilla.org/quality/mailnews/mail-troubleshoot.html#imap






お気に入りの記事を「いいね!」で応援しよう

Last updated  Sep 3, 2008 10:13:49 AM


【毎日開催】
15記事にいいね!で1ポイント
10秒滞在
いいね! -- / --
おめでとうございます!
ミッションを達成しました。
※「ポイントを獲得する」ボタンを押すと広告が表示されます。
x
X

© Rakuten Group, Inc.
X
Design a Mobile Website
スマートフォン版を閲覧 | PC版を閲覧
Share by: