This is a continuation of “Configuring postfix virtual mail domain”
We need to update dovecot configuration files so that the pop3 server can locate the mailbox files and the password files. Edit the following files, so that the listed below options are present.
Edit the dovecot configuration file
- vi /etc/dovecot/dovecot.conf
Un-comment the line
- protocols = imap pop3 lmtp
Update the file /etc/dovecot/conf.d/10-auth.conf
===========
disable_plaintext_auth = no
auth_mechanisms = plain login
#!include auth-system.conf.ext
!include auth-passwdfile.conf.ext
!include auth-checkpassword.conf.ext
Note: The ! is not to write comments.
Update the file /etc/dovecot/conf.d/10-logging.conf
===========
- log_path = /var/log/dovecot
- debug_log_path = /var/log/dovecot
- auth_verbose = yes
- auth_debug = yes
- auth_debug_passwords = yes
- verbose_ssl = yes
Create the log file
============
]# touch /var/log/dovecot
Update the file /etc/dovecot/conf.d/10-mail.conf
===========
mail_location = maildir:/home/<user created for postfix mailbox>/<%d – If following my previous posts>/%n
mail_uid = <UID of the user created for postfix mailbox>
mail_gid = <GID of the user created for postfix mailbox>
/etc/dovecot/conf.d/10-master.conf
===========
#service lmtp {
# unix_listener lmtp {
# #mode = 0666
# }
#
# # Create inet listener only if you can’t use the above UNIX socket
# #inet_listener lmtp {
# # Avoid making LMTP visible for the entire internet
# #address =
# #port =
# #}
#}
unix_listener /var/spool/postfix/private/auth {
mode = 0666
user = <username created for postfix mailbox>
group = <username created for postfix mailbox>
}
========== =
The next step is to create the password file, and define the location of password file in dovecot configuration.
- ]# su – <user created for postfix mailbox>
- ]# touch /home/<user created for postfix mailbox>/vpasswords
- ]# exit
Edit the file /etc/dovecot/conf.d/auth-passwdfile.conf.ext
update the following info:
- passdb {
driver = passwd-file
args = /home/<user created for postfix mailbox>/vpasswords
} - userdb {
driver = static
#driver = passwd-file
args = uid=<username created for postfix mailbox> gid=<username created for postfix mailbox> home=/home/<user created for postfix mailbox>/%d/%u
#args = /etc/dovecot/passwd
}
Note: In the above line starting with “args”, has full line including home parameter.
Restart the Dovecot server now
- systemctl restart dovecot
Assuming there is a user user1 with a mailbox in <domain1> enter the following :
- ]$ echo “<user1>@<domain1>:{PLAIN}thepass” >> /home/<user created for postfix mailbox>/vpasswords
Restart dovecot
- systemctl restart dovecot
Give the required permissions to dovecot user to the vpassword file
- ]# chown -R <user created for postfix mailbox>.dovecot /home/<user created for postfix mailbox>/
- ]# chmod -R 750 /home/<user created for postfix mailbox>/
Verify if you can access mails of user1@domain1 using a telnet session
- telnet localhost 110
=============== ===============
Now it is time to create the password using SSHA encryption
- ]$ doveadm pw -s SSHA
- Enter new password: samplepassword
- Retype new password: samplepassword
- {SSHA}DzrarxQD+RCal6Hu4LzlBGqp4awuqHgl
Now we need to update the password file mapping the username to the password:
- ]$ echo “<user1>@<domain1>:{SSHA}DzrarxQD+RCal6Hu4LzlBGqp4awuqHgl” >> /home/<user created for postfix mailbox>/vpasswords
========= ============== =======
Be the first to comment on "Configuring pop3 server Dovecot to access postfix virtual domains"