○ SMTP-AUTHを試す

*postfixで SMTP AUTH を試す
*cyrus-sasl-2.1.22を使用します

**以降はコメントです
*ソースの取得、削除は略します
*エディタ、ファイラーの操作は省略します
*Enterキーを省略します

*ログイン端末で "#" はroot、"$" は一般ユーザのプロンプトの記号です
*設定ファイルで "#" で始まる行はコメントとして解釈されます

○参照ファイル

postfixのインストール

○メール仮設定
:OS CentOS 5.1
:selinux disabled or permissive
:smtpサーバ postfix
:imapサーバ dovecot
:メール専用ユーザ  star,starlight

*メンテナンスの場合は一般ユーザから行います



○cyrus-saslパッケージの確認

*CentOS 5.1ではcyrus-sasl-2.1.22のrpmパッケージがあります
*cyrus-sasl-develをインストールします

*確認

# rpm -qa | grep cyrus-sasl
cyrus-sasl-2.1.22-4
cyrus-sasl-plain-2.1.22-4
cyrus-sasl-devel-2.1.22-4
cyrus-sasl-md5-2.1.22-4
cyrus-sasl-lib-2.1.22-4

○postfixの設定

○postfixでsaslライブラリをリンクしてコンパイル

postfixコンフィグスクリプトを参照

○postfixのmain.cfの修正

main.cfの説明を参照



○sasldbを使う

○sasldb2データベースを作ります

:/etc/sasldb2 (root postfix 640)

*仮設定ドメイン:mail.528p.com ユーザ:star
*最初の登録のみ -c オプションをつけます
*stringsコマンドでパスワードが見えるので注意!
*postfixのgidを変更した場合は再度chgrpを実行します

# saslpasswd2 -u mail.528p.com -c star
Password:← パスワードを入力
Again (for verification):← 再入力

*sasldb2のグループをpostfixにします

# chgrp postfix /etc/sasldb2

*登録の確認

# sasldblistusers2

:登録ユーザ削除の場合

# saslpasswd2 -u mail.528p.com -d star

○/usr/lib/sasl2/smtpd.confを作ります

:/usr/lib/sasl2/smtpd.conf (root root 644)

pwcheck_method:auxprop

○postfixの再起動

# service postfix restart



○saslauthdを使う

*cyrus-saslパッケージとpostfixの設定は省略
*例はshadowパスワード (/etc/passwd) を使う設定です
*# man saslauthd でコマンドの参照

○/usr/lib/sasl2/smtpd.confを修正します

:/usr/lib/sasl2/smtpd.conf (root root 644)

pwcheck_method:saslauthd
mech_list:plain login

○saslauthd起動スクリプト

:/etc/init.d/saslauthd (一部抜粋)

*start()のdaemonで始まる行で変数を読み込んで実行しています

*省略

# Source our configuration file for these variables.
SOCKETDIR=/var/run/saslauthd
MECH=shadow
FLAGS=
if [ -f /etc/sysconfig/saslauthd ] ; then
    . /etc/sysconfig/saslauthd
fi

RETVAL=0

# Set up some common variables before we launch into
# what might be considered boilerplate by now.
prog=saslauthd
path=/usr/sbin/saslauthd

start() {
    echo -n $"Starting $prog: "
    daemon $path -m $SOCKETDIR -a $MECH $FLAGS
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
    return $RETVAL
}

*省略


○postfixの再起動とsaslauthdの起動

# service saslauthd start
# service postfix restart

*自動起動できるようにします

# chkconfig --level 23 saslauthd on

○ Copyright(c) 528p.com All Rights Reserved.