平成21年1月27日 メールサーバー(Postfix、dovecot)の導入 ------------------------------------------------------- 構築と運用が簡単であると考えられる方法を紹介します。 Postfix(SMTP)、cyrus-sasl(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の自動起動の設定 # yum install cyrus-sasl <- SMTP認証(サービス名:saslauthd インストール済み) # service saslauthd stop # service saslauthd start <- 起動すること確認する # chkconfig --level 35 saslauthd on <- postfixの自動起動の設定 # 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_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 ------------------------------------------------------- /usr/lib/sasl2/smtpd.conf <- 編集する pwcheck_method: saslauthd mech_list: plain login cram-md5 digest-md5 <- 追記する ------------------------------------------------------- <- 変更したら、必ず3つリスタートする # service postfix restart # service saslauthd restart # service dovecot restart ------------------------------------------------------- ユーザの作成 # useradd -s /sbin/nologin test <- noligin でユーザ作成 # userdel -r test <- 削除( -r は/homme も削除) # passwd test ******** ******** ------------------------------------------------------- 上記までの設定が完了したら、利用するドメイン名を知らせて下さい。 パークネットのDNSに設定後、数時間でメールが利用できるようになります。 ※ 新しくドメインを取得する場合には、メールで知らせて下さい。 参考) # yum remove postfix <- postfix を削除 メールの受信データは、/home のユーザのフォルダに届きます。