Dovecot

Table of Contents

Postfix+Dovecot+MySQL+Postfixadminで仮想サーバ対応のメールサーバを構築
Postfix,MySQL,Postfixadminは別記事で参照
インストールの前提条件は、MySQLがインストール済み

インストール

# dnf install dovecot dovecot-mysql mailx

設定

dovecot.conf
# cp /etc/dovecot/dovecot.conf /etc/dovecot/dovecot.conf.org
# vi /etc/dovecot/dovecot.conf
-----------------------------------------------
protocols = imap
listen = *
login_greeting = ready.
-----------------------------------------------
10-mail.conf
# cp /etc/dovecot/conf.d/10-mail.conf /etc/dovecot/conf.d/10-mail.conf.org
# vi /etc/dovecot/conf.d/10-mail.conf
-----------------------------------------------
mail_location = maildir:/home/vuser/%d/%n
first_valid_uid = 10000
first_valid_gid = 10000
-----------------------------------------------
10-master.conf
# cp /etc/dovecot/conf.d/10-master.conf /etc/dovecot/conf.d/10-master.conf.org
# vi /etc/dovecot/conf.d/10-master.conf
-----------------------------------------------
service imap-login {
  inet_listener imap {
    port = 143
  }
  inet_listener imaps {
    port = 993
    ssl = yes
  }
  inet_listener pop3 {
    port = 0
  }
  inet_listener pop3s {
    port = 0
    #ssl = yes
  }
}
-----

  # Postfix smtp-auth
  unix_listener /var/spool/postfix/private/auth {
    mode = 0666
    user = postfix
    group = postfix
  }
-----------------------------------------------
10-auth.conf
# cp /etc/dovecot/conf.d/10-auth.conf /etc/dovecot/conf.d/10-auth.conf.org
# vi /etc/dovecot/conf.d/10-auth.conf
-----------------------------------------------
auth_mechanisms = plain login

disable_plaintext_auth = no
#!include auth-system.conf.ext
!include auth-sql.conf.ext
-----------------------------------------------
10-ssl.conf
# cp /etc/dovecot/conf.d/10-ssl.conf /etc/dovecot/conf.d/10-ssl.conf.org
# vi /etc/dovecot/conf.d/10-ssl.conf
-----------------------------------------------
ssl_cert = </etc/pki/tls/certs/server.crt
ssl_key = </etc/pki/tls/certs/server.key
-----------------------------------------------
auth-sql.conf.ext
# cp /etc/dovecot/conf.d/auth-sql.conf.ext /etc/dovecot/conf.d/auth-sql.conf.ext.org
# vi /etc/dovecot/conf.d/auth-sql.conf.ext
-----------------------------------------------
へんこうなし
-----------------------------------------------
dovecot-sql.conf.ext
# vi /etc/dovecot/dovecot-sql.conf.ext
-----------------------------------------------
driver = mysql
default_pass_scheme = MD5-CRYPT
connect = host=localhost dbname=postfix user=postfix password=postfixadmin
password_query = SELECT username as user, 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'
iterate_query = SELECT userid AS username, domain FROM users
-----------------------------------------------

設定ファイルのチェック

# doveconf -n

起動設定

# systemctl disable dovecot
# systemctl start dovecot

ポートのオープン

# firewall-cmd --zone=external --add-service=pop3 --permanent
# firewall-cmd --zone=external --add-service=pop3s --permanent
# firewall-cmd --zone=external --add-service=imap --permanent
# firewall-cmd --zone=external --add-service=imaps --permanent
# firewall-cmd --zone=internal --add-service=pop3 --permanent
# firewall-cmd --zone=internal --add-service=pop3s --permanent
# firewall-cmd --zone=internal --add-service=imap --permanent
# firewall-cmd --zone=internal --add-service=imaps --permanent
# firewall-cmd --reload

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です