■OS CentOS 6.5
■ソフト
パッケージ | バージョン |
---|---|
dovecot | 2.0.9 |
postfix | 2.6.6 |
dovecot postfixのインストール、設定
yum install epel-release yum install dovecot postfix vim
cp -frp /etc/dovecot{,.default} cp -frp /etc/postfix{,.default}
vim /etc/postfix/main.cf
... inet_interfaces = all #inet_interfaces = $myhostname #inet_interfaces = $myhostname, localhost #inet_interfaces = localhost ... #末尾に下記を追加 smtpd_sasl_type = dovecot smtpd_sasl_path = private/auth smtpd_sasl_auth_enable = yes smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination virtual_mailbox_domains = virtual_mailbox_maps = hash:/etc/postfix/virtual-mailbox virtual_uid_maps = static:10000 virtual_gid_maps = static:10000 virtual_mailbox_base = /var/spool/virtual
vim /etc/dovecot/dovecot.conf
# Protocols we want to be serving. protocols = pop3
vim /etc/dovecot/conf.d/10-auth.conf
auth_mechanisms = cram-md5 plain !include auth-passwdfile.conf.ext !include auth-static.conf.ext disable_plaintext_auth = no
vim /etc/dovecot/conf.d/10-master.conf
service auth { ... # Postfix smtp-auth unix_listener /var/spool/postfix/private/auth { mode = 0666 user = postfix group = postfix } ... }
vim /etc/dovecot/conf.d/auth-passwdfile.conf.ext
passdb { driver = passwd-file args = scheme=CRAM-MD5 username_format=%u /etc/dovecot/passwd } userdb { driver = passwd-file args = uid=10000 gid=10000 username_format=%u /etc/dovecot/passwd }
vim /etc/dovecot/conf.d/10-mail.conf
#mail_location = mail_location = maildir:/var/spool/virtual/%d/%n
vim /etc/dovecot/conf.d/auth-static.conf.ext
userdb { driver = static args = uid=10000 gid=10000 home=/var/spool/virtual/%d/%n }
groupadd -g 10000 mailuser useradd -s /sbin/nologin -M -u 10000 -g mailuser mailuser
ユーザーとドメインの追加
vim /etc/dovecot/passwd
user2@yourhost1.com:{CRAM-MD5}5101460cd0013e0d79945c734e048176d135b473766ff3ae18e5254432adc0e9 user3@yourhost1.com:{CRAM-MD5}5101460cd0013e0d79945c734e048176d135b473766ff3ae18e5254432adc0e9 user1@yourhost2.com:{CRAM-MD5}5101460cd0013e0d79945c734e048176d135b473766ff3ae18e5254432adc0e9 user2@yourhost2.com:{CRAM-MD5}5101460cd0013e0d79945c734e048176d135b473766ff3ae18e5254432adc0e9
ここでのパスワードは下記コマンドで取得します
doveadm pw
vim /etc/postfix/main.cf
virtual_mailbox_domains = yourhost1.com yourhost2.com
vim /etc/postfix/virtual-mailbox
user2@yourhost1.com yourhost1.com/user2/ user3@yourhost1.com yourhost1.com/user3/ user1@yourhost2.com yourhost2.com/user1/ user2@yourhost2.com yourhost2.com/user2/
postmap /etc/postfix/virtual-mailbox mkdir -p /var/spool/virtual/{yourhost1.com/,yourhost2.com}/{user1,user2} chown -R mailuser: /var/spool/virtual service postfix restart service dovecot restart
参考サイト:
- http://qiita.com/dribble13/items/36847b944caed440d714
- http://www.unix-power.net/linux/centos_postfix_virtual.html
そもそもつながらない場合は一時的にSelinuxとFirewallを無効にして確認してみる。