dovecotインストール


「dovecot」のインストール、設定を行います。

(1)「dovecot」と認証パッケージをインストールする。
[root@mail1 ~]# yum -y install dovecot cyrus-sasl-plain cyrus-sasl-md5

(2)「dovecot」の設定ファイルを修正する。
[root@mail1 ~]# vi /etc/dovecot.conf
# Protocols we want to be serving: imap imaps pop3 pop3s
# If you only want to use dovecot-auth, you can set this to "none".
#protocols = imap imaps pop3 pop3s
↓ # 変更
protocols = pop3 pop3s ← # ここでは、「pop3」「pop3s」のプロトコルを指定

#mail_location =
↓ # 変更
mail_location = maildir:/home/vuser/%d/%u

# Valid UID range for users, defaults to 500 and above. This is mostly
# to make sure that users can't log in as daemons or other system users.
# Note that denying root logins is hardcoded to dovecot binary and can't
# be done even if first_valid_uid is set to 0.
#first_valid_uid = 500
#last_valid_uid = 0
first_valid_uid = 10000 ←  # 「vuser」の「uid」を追加

# Valid GID range for users, defaults to non-root/wheel. Users having
# non-valid GID as primary group ID aren't allowed to log in. If user
# belongs to supplementary groups with non-valid GIDs, those groups are
# not set.
#first_valid_gid = 1
#last_valid_gid = 0
first_valid_gid = 10000 ← # 「vuser」の「gid」を追加

# passdb pam { ← # 「passdb pam」をコメントアウト
・
・
・
# }

passdb sql {
# Path for SQL configuration file, see doc/dovecot-sql-example.conf
#args = /etc/dovecot-mysql.conf
args = /etc/dovecot-mysql.conf ← # 「dovecot」が使用するSQLファイルを指定
}

#userdb passwd { ← # 「userdb passwd」をコメントアウト
・
・
・
#}

# SQL database <doc/wiki/AuthDatabase.SQL.txt>
userdb sql {
# Path for SQL configuration file, see doc/dovecot-sql-example.conf
#args =
args = /etc/dovecot-mysql.conf ← # 「dovecot」が使用するSQLファイルを指定
}

protocol pop3 {
・
・
・
#pop3_uidl_format = %08Xu%08Xv
↓ # 変更
pop3_uidl_format = %08Xu%08Xv

auth default {
# Space separated list of wanted authentication mechanisms:
# plain login digest-md5 cram-md5 ntlm rpa apop anonymous gssapi
# NOTE: See also disable_plaintext_auth setting.
# mechanisms = plain
↓ # 変更
mechanisms = plain login digest-md5 cram-md5
・
・
・
# It's possible to export the authentication interface to other programs:
#socket listen {
↓ # 変更
socket listen {

#master {
# Master socket provides access to userdb information. It's typically
# used to give Dovecot's local delivery agent access to userdb so it
# can find mailbox locations.
#path = /var/run/dovecot/auth-master
#mode = 0600
# Default user/group is the one who started dovecot-auth (root)
#user =
#group =
#}
client {
# The client socket is generally safe to export to everyone. Typical use
# is to export it to your SMTP server so it can do SMTP AUTH lookups
# using it.
#path = /var/run/dovecot/auth-client
↓ # 変更
path = /var/spool/postfix/private/auth
#mode = 0660
↓ # 変更
mode = 0660
user = postfix ← # 追加
group = postfix ← # 追加
  }
 }
}

(3)「dovecot」用の「MySQL」ファイルを作成する。
[root@mail1 ~]# vi /etc/dovecot-mysql.conf
driver = mysql
default_pass_scheme = MD5-CRYPT
connect = dbname=postfix user=postfixadmin host=/var/lib/mysql/mysql.sock password=postfixadmin
password_query = SELECT password FROM mailbox WHERE username = '%u' AND active = '1'
user_query = SELECT concat('/home/vuser/', maildir) as home, 10000 as uid, 10000 as gid FROM mailbox WHERE username = '%u' AND active = '1'

(4)「dovecot」を起動させる。
[root@mail1 ~]# chkconfig dovecot on
[root@mail1 ~]# /etc/rc.d/init.d/dovecot start
Dovecot Imap を起動中:                                     [  OK  ]

Comments are closed.