====== Postfix DovecotでPOP before SMTP ======
最近ほとんどsmtp authで設定しちゃってるので、\\
PostfixでPOP before SMTPの設定方法忘れちゃってたんでメモ
====== pop-before-smtpインストール ======
[[https://sourceforge.net/project/showfiles.php?group_id=5017|Pop-before-smtp]]から最新版をダウンロード
今の最新は2007-06-06更新の
[[http://downloads.sourceforge.net/project/popbsmtp/Source%20tar/1.42/pop-before-smtp-1.42.tar.gz|pop-before-smtp-1.42.tar.gz]]でした。
# tar xvfz pop-before-smtp-1.42.tar.gz \\
# cd pop-before-smtp-1.42/ \\
# cp pop-before-smtp.init /etc/rc.d/init.d/pop-before-smtp \\
# cp pop-before-smtp /usr/sbin/ \\
# cp pop-before-smtp-conf.pl /etc
====== pop-before-smtp-conf.pl修正 ======
**赤**の部分のコメントアウトを外す
32 **#**$logto = '/var/log/pop-before-smtp'; \\
44 **#**$file_tail{'name'} = '/var/log/maillog'; \\
\\
254 **#** For Dovecot POP3/IMAP when using syslog. \\
255 **#**$pat = '^[LOGTIME] \S+ (?:dovecot: )?(?:imap|pop3)-login: ' . \\
256 **#** 'Login: .*? (?:\[|rip=)[:f]*(\d+\.\d+\.\d+\.\d+)[],]'; \\
257 **#**$out_pat = '^[LOGTIME] \S+ (?:dovecot: )?(?:imap|pop3)-login: ' . \\
258 **#** 'Disconnected.*? (?:\[|rip=)[:f]*(\d+\.\d+\.\d+\.\d+)[],]'; \\
\\
353 **=cut** #====================== Postfix BerkeleyDB =======================START= \\
378 **=cut** #====================== Postfix BerkeleyDB =========================END= \\
====== perlのモジュールをインストール ======
# perl -MCPAN -e shell
cpan> install Time::HiRes
cpan> install File::Tail
cpan> install Date::Parse
cpan> install Net::Netmask
cpan> install BerkeleyDB
====== Postfixのmain.cf修正 ======
main.cfに下記を追加する。
# vi /etc/postfix/main.cf \\
\\
smtpd_recipient_restrictions = \\
permit_mynetworks,reject_non_fqdn_recipient, \\
check_client_access hash:/etc/postfix/pop-before-smtp, \\
reject_unauth_destination \\
\\
===== pop before smtpとsmtp auth両方有効にする場合 =====
# vi /etc/postfix/main.cf \\
smtpd_sasl_auth_enable = yes \\
smtpd_sasl_type = dovecot \\
smtpd_sasl_path = private/auth \\
smtpd_sasl_local_domain = $myhostname \\
smtpd_recipient_restrictions = \\
permit_mynetworks,reject_non_fqdn_recipient \\
permit_sasl_authenticated, \\
check_client_access hash:/etc/postfix/pop-before-smtp, \\
reject_unauth_destination
====== 自動起動の設定 ======
# chkconfig --add pop-before-smtp
# chkconfig pop-before-smtp on
====== 起動 ======
# service pop-before-smtp start
===== 確認 =====
popアクセスをしてみて、/etc/postfix/pop-before-smtp.dbに \\
該当IPが登録されていれば成功です。
# /usr/lib/rpm/rpmdb_dump -p /etc/postfix/pop-before-smtp.db VERSION=3 \\
format=print \\
type=hash \\
db_pagesize=4096 \\
HEADER=END \\
183.77.255.225 \\
ok \\
DATA=END