[インストール環境] » vine linux 4.2 » cyrus-sasl-2.1.18-0vl6 » postfix-2.4.7-2vl5 ※すべてapt-get、rpmを構築してインストールしていきます。 ※postfixにsleepパッチも適用します。 ※smtp認証はpam(システムユーザー)を使用します。 ※お約束ですが”自己責任”で行ってください。 [1] cyrus-sasl、postfix-2.4.7のrpm構築に必要なパッケージのインストール > apt-get install db4-devel cyrus-sasl cyrus-sasl-devel cyrus-sasl-plain cyrus-sasl-md5 openldap-devel pcre-devel MySQL-devel MySQL-shared postgresql-devel [2] postfix-2.4.7の入手 > wget http://ring.riken.jp/archives/linux/Vine/VineSeed/SRPMS.main/postfix-2.4.7-2vl5.src.rpm [3] postfix-2.4.7-2vl5.src.rpmのインストール > rpm -ivh postfix-2.4.7-2vl5.src.rpm [4] postfixにsleepパッチを適用 > cd /usr/src/vine/SOURCES > tar zxvf postfix-2.4.7.tar.gz > wget http://cmf.ohtanz.com/download/postfix-2.4.7-sleep.patch (本家Postfix 2.3 sleep disconnect patchをpostfix-2.4.7用に修正) > patch -p0 < postfix-2.4.7-sleep.patch > tar zcvf postfix-2.4.7.tar.gz postfix-2.4.7 [5] postfix-2.4.7のspecファイルを修正 > cd ../SPECS > vi postfix.spec --------------------------------------------------------- @@ -42,7 +42,7 @@ Provides: smtpdaemon Conflicts: sendmail Prereq: chkconfig -BuildPreReq: db4-devel >= 4.3.29, pam-devel, gdbm-devel +BuildPreReq: db4-devel >= 4.2.52, pam-devel, gdbm-devel BuildPreReq: cyrus-sasl-devel, openssl-devel BuildPreReq: openldap-devel BuildPreReq: pcre-devel @@ -50,7 +50,7 @@ BuildPreReq: postgresql-devel Requires: cyrus-sasl, gdbm, pam, openssl -PreReq: db4 >= 4.3.29 +PreReq: db4 >= 4.2.52 Obsoletes: postfix-beta BuildRoot: %{_tmppath}/%{name}-%{version}-root --------------------------------------------------------- [6] postfix-2.4.7のrpmを構築 > rpm -bb --clean postfix.spec (※なぜかvl4になってしまうが気にしない) [7] postfix-2.4.7-2vl4.i386.rpmのインストール > rpm -ivh postfix-2.4.7-2vl4.i386.rpm [8] cyrus-saslをpam認証で動かす為のconfigファイルを作成 > vi /usr/lib/sasl2/smtpd.conf --------------------------------------------------------- pwcheck_method: saslauthd mech_list: plain login --------------------------------------------------------- [9] smtp認証用のpamを作成 > vi /etc/pam.d/smtp --------------------------------------------------------- #%PAM-1.0 auth required pam_stack.so service=system-auth account required pam_stack.so service=system-auth --------------------------------------------------------- [10] 特定IPからのみsmtp認証を許可するためcheck_smtp_authファイルを作成 > vi /etc/postfix/check_smtp_auth --------------------------------------------------------- 192.168.120.0/24 check_smtp_auth 127.0.0.1/32 check_smtp_auth --------------------------------------------------------- > postmap /etc/postfix/check_smtp_auth [11] main.cfに下記を追加 --------------------------------------------------------- smtpd_sasl_auth_enable = yes smtpd_sasl_security_options = noanonymous broken_sasl_auth_clients = yes smtpd_restriction_classes = check_smtp_auth check_smtp_auth = permit_sasl_authenticated smtpd_recipient_restrictions = permit_mynetworks check_client_access cidr:/etc/postfix/check_smtp_auth --------------------------------------------------------- [12] postfix、cyrus-saslを起動 > service postfix start > service saslauthd start [13] サーバー起動時にpostfix、cyrus-saslを起動するよう設定 > chkconfig postfix on > chkconfig saslauthd on




