Postfix mail service - dovecot service

dovecot is an open source IMAP and POP3 mail server receiving protocol (SMTP transport outgoing).
POP/IMAP is the protocol used by MUA to read mail from mail servers. Among them, POP3 downloads emails from the mail server and stores them, and IMAP directly manages and operates emails by leaving them on the server side.
dovecot can be replaced by other software with the same function, such as: cyrus-imapd.

Install;

yum install dovecot dovecot-devel dovecot-mysql pam-devel -y

  2. dovecot file configuration

dovecot configuration reference

# cat dovecot.conf 
protocols
= imap pop3 listen = * # log directory info_log_path = /var/log/dovecot-info.log debug_log_path = /var/log/dovecot-debug.log dict { #quota = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext #expire = sqlite:/etc/dovecot/dovecot-dict-sql.conf.ext } !include conf.d/*.conf !include_try /etc/dovecot/local.conf
# dovecot-sql.conf.ext Create and edit by yourself below passdb { driver = sql args = /etc/dovecot/dovecot-sql.conf.ext } # wmail is the dedicated email account created earlier userdb { driver = static args = uid=5000 gid=5000 home=/home/wmail/%d/%n } ####Debug log auth_debug_passwords=yes mail_debug=yes auth_verbose=yes auth_verbose_passwords=plain

3. To configure the dovecot log file
, you need to set the permission, otherwise the log permission will report an error
(mail dovecot: lda: Fatal: Can't open log file /var/log/dovecot-info.log: Permission denied)

# chown dovecot /var/log/dovecot-*.log
# chmod 777 /var/log/dovecot-*.log

4. auth authentication configuration reference:

# cat conf.d/10-auth.conf  

disable_plaintext_auth = no
auth_mechanisms = plain login cram-md5
!include auth-system.conf.ext

 

5. 10-ssl.comf configuration reference

The 10-ssl.conf file is mainly about the configuration related to postfix's ssl authentication.
SSL is prohibited first;

# cat conf.d/10-ssl.conf 
ssl
= no

 

6. 10-mail.conf file configuration reference

10-mail.conf file mainly defines where mail users store relevant information

# cat conf.d/10-mail.conf 
mail_location
= maildir:/home/wmail/%d/%n/Maildir mbox_write_locks = fcntl

 

7. 10-master.conf configuration reference

10-master.conf file defines dovecot's pop3 and imap port
settings auth-userdb is the postfix dedicated user wmail created before

# cat conf.d/10-master.conf |grep -v ^$ |grep -v ^#
service imap
-login { inet_listener imap { port = 143 } } service pop3-login { inet_listener pop3 { port = 110 } } service auth { unix_listener auth-userdb { mode = 0600 user = wmail group = wmail } # Postfix smtp-auth unix_listener /var/spool/postfix/private/auth { mode = 0666 } # Auth process is run as this user. #user = $default_internal_user }

 

8. 15-lda.conf file

Modify the 15- lda.conf file to prevent dovecot from abnormally reporting errors.
# cat conf.d/15-lda.conf 
postmaster_address
= [email protected]

 

9. Create the dovecot-sql.conf.ext file under /etc/dovecot/ .

Configure mysql link information.

# cat dovecot-sql.conf.ext 

driver = mysql
connect = host=localhost dbname=postfix user=postfix password=postfix
default_pass_scheme = MD5-CRYPT
password_query = SELECT username AS user,password FROM mailbox WHERE username = '%u' AND active='1' 
user_query = SELECT maildir, 5000 AS uid, 5000 AS gid, CONCAT('dict:storage=',floor(quota/1000),' proxy::quota') as quota FROM mailbox WHERE username = '%u' AND active='1'

10. Start dovecot

/etc/init.d/dovecot start
chkconfig dovecot on
To prevent service conflicts, please close portreserve
 /etc/init.d/ portreserve stop
chkconfig portreserve off

 

11. Test dovecot
can also ss -tln to detect port 110 143 survival


If +Ok Dovecot ready appears on telnet mail.wangxiaojing.com 110 
telnet mail.wangxiaojing.com 143 , it means that dovecot is configured correctly.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325125049&siteId=291194637