平成21年6月25日 Postfix + dovecot(SMTP認証)の導入 ------------------------------------------------------- dovecot の SMTP認証機能を利用するシンプルな構築です。 # postconf -a cyrus dovecot <- Postfix の Verが dovecot SASL をサポートしていることを確認する Postfix(SMTP)、dovecot(SMTP認証)、dovecot(POP/IMAP) ユーザ作成方式(nologin) test@logmail.jpの場合の認証方式) ユーザ名:test (ドメイン名なし) パスワード:xxxxxx 例) ドメイン名(logmail.jp)、ホスト名(mail.logmail.jp) *****@logmail.jp *****@mail.logmail.jp 上記の2つの形式が宛先として利用できる ------------------------------------------------------- # yum install postfix <- psotfixをインストール # service postfix stop # service postfix start <- 起動すること確認する # chkconfig --level 35 postfix on <- postfixの自動起動の設定 # service saslauthd stop <- 利用しない # chkconfig --level 35 saslauthd off <- saslauthd は起動しない # yum install system-switch-mail <- sendmail と postfix の切り替え # system-switch-mail <- sendmail を postfix に切り替える この時点で、postfix がサービス名として出現する # chkconfig --list <- 下記の状態を確認する | postfix 0:off 1:off 2:on 3:on 4:on 5:on 6:off | ------------------------------------------------------- /etc/postfix/main.cf <- WinSCPで転送してWindowsで慎重に編集する #myhostname = host.domain.tld myhostname = mail.logmail.jp <- #はずす、ホスト名 (70行) mydomain = logmail.jp <- #はずす、ドメイン名 (77行) myorigin = $myhostname <- #はずす (92行) #myorigin = $mydomain inet_interfaces = all <- はずす (107行) #inet_interfaces = $myhostname #inet_interfaces = $myhostname, localhost #inet_interfaces = localhost <- #つける #mydestination = $myhostname, localhost.$mydomain, localhost <- #つける (155行) mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain <- #はずす | local_recipient_maps = unix:passwd.byname $alias_maps <- #はずす (199行) | <- 一番最後に下記を追記する # Enable SMTP Auth smtpd_sasl_type = dovecot smtpd_sasl_path = private/auth smtpd_sasl_auth_enable = yes smtpd_sasl_security_options = noanonymous broken_sasl_auth_clients = yes smtpd_recipient_restrictions = permit_mynetworks, permit_auth_destination, permit_sasl_authenticated, reject ------------------------------------------------------- WinSCPで main.cf を転送する (/etc/postfix/main.cf) # service postfix stop # service postfix start ------------------------------------------------------- # yum install dovecot # chkconfig --level 35 dovecot on <- dovecotの自動起動の設定 # service dovecot restart ------------------------------------------------------- /etc/dovecot.conf <- 全面的に書き換え、差し替える auth default { mechanisms = plain login passdb pam { } userdb passwd { } user = root # Poatfix SMTP Auth socket listen { client { path = /var/spool/postfix/private/auth mode = 0660 user = postfix group = postfix } } } ------------------------------------------------------- /etc/postfix/master.cf <- 2箇所のコメントをはずす(submission対応) | smtp inet n - n - - smtpd submission inet n - n - - smtpd # -o smtpd_enforce_tls=yes -o smtpd_sasl_auth_enable=yes # -o smtpd_client_restrictions=permit_sasl_authenticated,reject | ------------------------------------------------------- <- 変更したら、必ず2つリスタートする # service postfix restart # service dovecot restart ------------------------------------------------------- ユーザの作成 # useradd -s /sbin/nologin test <- noligin でユーザ作成 # userdel -r test <- 削除( -r は/homme も削除) # passwd test ******** ******** ------------------------------------------------------- ファイヤーオール、SElinux # yum install system-conifg-securitylevel # system-config-securitylevel ------------------------------------------------------- 参考) # yum remove postfix <- postfix を削除