postfix と saslauthd で SMTP-AUTH
						
							最終更新日 2007-05-05 16:46:09															(1年以上前の記事です)								
						
						CentOS-4.4 で Postfix と saslauthd で SMTP 認証環境を構築したときのメモ。
とりあえずは SPAM 防止ということで、全ユーザに共通のパスワードを発行してる。それぞれのユーザに IMAP と UNIX 、 SMTP-AUTH 共通の 独自パスワードを発行したいんだけど、やり方は調査してない。					
 
					
					
					
						インストール
まずはインストール。どちらも yum レポジトリにパッケージなので、以下のコマンドを実行するだけ。
# yum install postfix cyrus-sasl cyrus-sasl-md5
SASL の設定
まずは SASL から設定してしまいます。 SMTP 認証に sasldb を使用するように /usr/lib/sasl2/ 配下にある smtpd.conf を編集します。
#vi /usr/lib/sasl2/smtpd.conf 
pwcheck_method: sasldb
次に saslpasswd2 コマンドを使用して、 SMTP-AUTH 用のユーザとパスワードを設定します。
# saslpasswd2 -c -u domain.name user_name
上記例は domain.name ドメインに user_name というユーザを追加する例。
Postfix の設定
次に Postfix の設定です。 /etc/postfix/ の main.cf を編集します。ここで設定するルールは以下のとおりです。
- ホスト名は host.domain.name
- 自分のネットワーク宛の配送(リレー)は許可
- ホスト名宛の配送は許可
- 他ホストやネットワークでも SASL 認証されていれば許可
実際の設定です。
# vi /etc/postfix/main.conf
myhostname = host.domain.name
mydomain = domain.name
mynetworks = 192.168.0.0/24 127.0.0.0/8 218.219.xxx.xxx/32
...
broken_sasl_auth_clients = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions =
        permit_mynetworks,
        permit_sasl_authenticated,
        permit_auth_destination,
        reject
smtpd_sasl_security_options = noanonymous,noplaintext
ここで注意が必要なのは mydomain の設定値と saslpasswd2 で指定した domain.name は一致していなければいけません。
起動
最後に saslauthd と postfix を再起動して終了です。
# service saslauthd restart
# service postfix reload
						最終更新日 2007-05-05 16:46:09
						
							コメント							 
													
						
					 
									 
				
					
					
					
					
					
						todo メモ
						facebook 対応
						ページ処理
						RSS feed
						検索機能
						認証いる?
						更新日表示
						実はカテゴリ機能
						多言語
						実はユーザ機能
						ソースその内公開
					
					
						動作環境メモ
						php-5.1.6 with PDO
						SQLite-3.3
						IE6
						FireFox-1.5