Centos 7 + Postfix + Dovecot (without database)
vi /etc/postfix/main.cf
home_mailbox = Maildir/
myhostname = localhost
groupadd -g 5000 vmail
useradd -m -u 5000 -g 5000 -s /bin/bash vmail
vi /etc/postfix/main.cf
virtual_mailbox_domains = /etc/postfix/vhosts
virtual_mailbox_base = /home/vmail
virtual_mailbox_maps = hash:/etc/postfix/vmaps
virtual_minimum_uid = 1000
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
vi /etc/postfix/vhosts
domain1.com
domain2.com
vi /etc/postfix/vmaps
[email protected] domain1.com/info/
[email protected] domain1.com/info/
[email protected] domain1.com/sales/
[email protected] domain2.com/info/
[email protected] domain2.com/sales/
postmap /etc/postfix/vmaps
service postfix restart
vi /etc/postfix/main.cf
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu/GNU)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
myhostname = localhost
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = $myhostname
mynetworks = 127.0.0.0/8, 10.0.0.0/24
mailbox_size_limit = 0
home_mailbox = Maildir/
virtual_mailbox_domains = /etc/postfix/vhosts
virtual_mailbox_base = /home/vmail
virtual_mailbox_maps = hash:/etc/postfix/vmaps
virtual_minimum_uid = 1000
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
recipient_delimiter = +
inet_interfaces = all
mv /etc/dovecot/dovecot.conf /etc/dovecot/dovecot.conf.orig
vi /etc/dovecot/dovecot.conf
# 2.2.10: /etc/dovecot/dovecot.conf
# OS: Linux 3.10.0-327.36.3.el7.x86_64 x86_64 CentOS Linux release 7.2.1511 (Core) ext4
auth_mechanisms = plain cram-md5
auth_verbose = yes
base_dir = /var/run/dovecot/
info_log_path = /var/log/dovecot.info
log_path = /var/log/dovecot
log_timestamp = "%Y-%m-%d %H:%M:%S "
mail_location = maildir:/home/vmail/%d/%n
passdb {
args = /etc/dovecot/passwd
driver = passwd-file
}
passdb {
args = /etc/dovecot/passwd
driver = passwd-file
}
protocols = imap pop3
service auth {
executable = /usr/libexec/dovecot/auth
unix_listener /var/spool/postfix/private/auth-client {
group = postfix
mode = 0660
user = postfix
}
user = root
}
service imap-login {
chroot = login
executable = /usr/libexec/dovecot/imap-login
user = dovecot
}
service imap {
executable = /usr/libexec/dovecot/imap
}
service pop3-login {
chroot = login
executable = /usr/libexec/dovecot/pop3-login
user = dovecot
}
service pop3 {
executable = /usr/libexec/dovecot/pop3
}
ssl = no
userdb {
args = /etc/dovecot/users
driver = passwd-file
}
userdb {
args = /etc/dovecot/users
driver = passwd-file
}
valid_chroot_dirs = /var/spool/vmail
protocol pop3 {
pop3_uidl_format = %08Xu%08Xv
}
service dovecot restart
postconf -e 'smtpd_sasl_type = dovecot'
postconf -e 'smtpd_sasl_auth_enable = yes'
postconf -e 'smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination'
postconf -e 'smtpd_sasl_path = private/auth'
service postfix restart
doveadm pw -s digest-md5 -u [email protected]
Enter new password:
Retype new password:
{DIGEST-MD5}9b9dcb4466233a9307bbc33708dffda0
doveadm pw
Enter new password:
Retype new password:
{CRAM-MD5}913331d8782236a8ecba7764a63aa27b26437fd40ca878d887f11d81245c2c6
Hi, what about the user&pass for virtualusers? This config don’t use TLS, right? Thanks.
Hi,
I found an error:
———————————
service auth {
executable = /usr/libexec/dovecot/auth
unix_listener /var/spool/postfix/private/auth-client {
group = postfix
mode = 0660
user = postfix
}
———————————
unix_listener ends with “auth-client” but when you configure postfix:
“postconf -e ‘smtpd_sasl_path = private/auth'”
It should be : “postconf -e ‘smtpd_sasl_path = private/auth-client'”