CentOS7にsendmail + dovecotをインストール
sendmail
インストール
# yum -y install sendmail (略) (1/3): hesiod-3.2.1-3.el7.x86_64.rpm | 30 kB 00:00 (2/3): procmail-3.22-34.el7.x86_64.rpm | 171 kB 00:00 (3/3): sendmail-8.14.7-4.el7.x86_64.rpm | 722 kB 00:00 (略) # yum -y install sendmail-cf (略)
設定
# ls -al /etc/mail 合計 208 drwxr-xr-x. 2 root root 4096 7月 15 12:09 . drwxr-xr-x. 77 root root 8192 7月 15 12:09 .. -rw-r--r--. 1 root root 92 1月 27 20:36 Makefile -rw-r--r--. 1 root root 469 1月 27 20:36 access -rw-r-----. 1 root root 12288 7月 15 12:09 access.db -rw-r--r--. 1 root root 0 7月 15 12:09 aliasesdb-stamp -rw-r--r--. 1 root root 233 1月 27 20:36 domaintable -rw-r-----. 1 root root 12288 7月 15 12:09 domaintable.db -rw-r--r--. 1 root root 5584 6月 10 05:02 helpfile -rw-r--r--. 1 root root 64 1月 27 20:36 local-host-names -rw-r--r--. 1 root root 997 1月 27 20:36 mailertable -rw-r-----. 1 root root 12288 7月 15 12:09 mailertable.db -rwxr-xr-x. 1 root root 2700 1月 27 20:36 make -rw-r--r--. 1 root root 58498 6月 10 05:02 sendmail.cf -rw-r--r--. 1 root root 7306 1月 27 20:36 sendmail.mc -rw-r--r--. 1 root root 41680 6月 10 05:02 submit.cf -rw-r--r--. 1 root root 1041 6月 10 05:01 submit.mc -rw-r--r--. 1 root root 127 1月 27 20:36 trusted-users -rw-r--r--. 1 root root 1847 1月 27 20:36 virtusertable -rw-r-----. 1 root root 12288 7月 15 12:09 virtusertable.db
/etc/mail/sendmail.mcを変更
- 下記をコメントアウト(dnl = delete through newline)
dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA’)dnl
- sendmail.cfに反映
# m4 /etc/mail/sendmail.mc > /etc/sendmail.cf
/etc/mail/accessを変更
- 許可するIPアドレスを追加
Connect:localhost.localdomain RELAY Connect:localhost RELAY Connect:127.0.0.1 RELAY
# makemap hash /etc/mail/access.db < /etc/mail/access
ファイヤーウォールの設定
# firewall-cmd --add-service=smtp --zone=public --permanent success # firewall-cmd --reload success
sendmail 起動
# systemctl restart sendmail.service
dovecot
インストール
# yum -y install dovecot
設定
# ls -al /etc/dovecot/ 合計 24 drwxr-xr-x. 3 root root 38 7月 15 15:36 . drwxr-xr-x. 78 root root 8192 7月 15 15:36 .. drwxr-xr-x. 2 root root 4096 7月 15 15:36 conf.d -rw-r--r--. 1 root root 4380 5月 20 2013 dovecot.conf
プロトコルの設定
# vi /etc/dovecot/dovecot.conf
# Protocols we want to be serving. protocols = imap pop3 lmtp
メールボックスの設定
# vi /etc/dovecot/conf.d/10-mail.conf
mail_location = mbox:~/mail:INBOX=/var/mail/%u
ファイヤーウォールの設定
# firewall-cmd --add-port=110/tcp --zone=public --permanent success # firewall-cmd --reload success
dovecot起動
# systemctl start dovecot