gau1991
11 years ago
7 changed files with 81 additions and 4 deletions
@ -1,7 +1,35 @@ |
|||
# Setup Postfix |
|||
# Setup Dovecot |
|||
|
|||
function ee_mod_setup_dovecot() |
|||
{ |
|||
ee_lib_echo "Configuring Dovecot, please wait..." |
|||
# Adding mail user with GID 5000 and UID 5000 |
|||
groupadd -g 5000 vmail |
|||
useradd -g vmail -u 5000 vmail -d /var/vmail -m |
|||
|
|||
# Configuring dovecot.conf |
|||
sed -i "s/*.protocol/*.protocol\\nprotocols = imap pop3 lmtp sieve/" /etc/dovecot/dovecot.conf |
|||
|
|||
# Configuring 10-mail.conf |
|||
sed -i "s/mail_location = mbox:~\/mail:INBOX=\/var\/mail\/%u/mail_location = maildir:\/var\/vmail\/%d\/%n/" /etc/dovecot/conf.d/10-mail.conf |
|||
|
|||
# Configuring 10-auth.conf |
|||
sed -i "s/auth_mechanisms = plain/auth_mechanisms = plain login/" /etc/dovecot/conf.d/10-auth.conf |
|||
sed -i "s/\!include auth-system.conf.ext/#\!include auth-system.conf.ext/" /etc/dovecot/conf.d/10-auth.conf |
|||
sed -i "s/#\!include auth-sql.conf.ext/\!include auth-sql.conf.ext/" /etc/dovecot/conf.d/10-auth.conf |
|||
|
|||
# Configuring dovecot-sql.conf.ext |
|||
cat /usr/share/easyengine/mail/dovecot-sql.conf.ext >> /etc/dovecot/dovecot-sql.conf.ext |
|||
|
|||
# Configuring auth-sql.conf.ext |
|||
sed -i "s/#userdb {/userdb {/" /etc/dovecot/conf.d/auth-sql.conf.ext |
|||
sed -i "s/# driver = prefetch/ driver = prefetch\n}/" /etc/dovecot/conf.d/auth-sql.conf.ext |
|||
|
|||
|
|||
# Configuring 10-master.conf |
|||
cp -av /etc/dovecot/conf.d/10-master.conf /etc/dovecot/conf.d/10-master.conf.bak |
|||
cp -av /usr/share/easyengine/mail/10-master.conf /etc/dovecot/conf.d/10-master.conf |
|||
|
|||
# Change Dovecot log location |
|||
sed -i "s/#log_path = syslog/log_path = \/var\/log\/dovecot.log/" /etc/dovecot/conf.d/10-logging.conf |
|||
} |
|||
|
@ -0,0 +1,26 @@ |
|||
service lmtp { |
|||
unix_listener /var/spool/postfix/private/dovecot-lmtp { |
|||
mode = 0600 |
|||
user = postfix |
|||
group = postfix |
|||
} |
|||
} |
|||
|
|||
service auth { |
|||
unix_listener /var/spool/postfix/private/auth { |
|||
mode = 0666 |
|||
user = postfix |
|||
group = postfix |
|||
} |
|||
|
|||
unix_listener auth-userdb { |
|||
mode = 0600 |
|||
user = vmail |
|||
} |
|||
|
|||
user = dovecot |
|||
} |
|||
|
|||
service auth-worker { |
|||
user = vmail |
|||
} |
@ -0,0 +1,15 @@ |
|||
driver = mysql |
|||
|
|||
connect = host=localhost user=vimbadmin password=password dbname=vimbadmin |
|||
default_pass_scheme = MD5 |
|||
|
|||
password_query = SELECT username as user, password as password, \ |
|||
homedir AS home, maildir AS mail, \ |
|||
concat('*:bytes=', quota) as quota_rule, uid, gid \ |
|||
FROM mailbox \ |
|||
WHERE username = '%Lu' AND active = '1' \ |
|||
AND ( access_restriction = 'ALL' OR LOCATE( access_restriction, '%Us' ) > 0 ) |
|||
|
|||
user_query = SELECT homedir AS home, maildir AS mail, \ |
|||
concat('*:bytes=', quota) as quota_rule, uid, gid \ |
|||
FROM mailbox WHERE username = '%u' |
Loading…
Reference in new issue