Browse Source

Dovecot configuration done

old-stable
gau1991 11 years ago
parent
commit
2491058db2
  1. 30
      src/modules/stack/install/mail/ee_mod_setup_dovecot.sh
  2. 8
      src/modules/stack/install/mail/ee_mod_setup_postfix.sh
  3. 26
      templates/mail/10-master.conf
  4. 15
      templates/mail/dovecot-sql.conf.ext
  5. 2
      templates/mail/virtual_alias_maps.cf
  6. 2
      templates/mail/virtual_domains_maps.cf
  7. 2
      templates/mail/virtual_mailbox_maps.cf

30
src/modules/stack/install/mail/ee_mod_setup_dovecot.sh

@ -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
}

8
src/modules/stack/install/mail/ee_mod_setup_postfix.sh

@ -2,6 +2,7 @@
function ee_mod_setup_postfix()
{
ee_lib_echo "Configuring Postfix, please wait..."
#Configure Master.cf
sed -i 's/#submission/submission/' /etc/postfix/master.cf
sed -i 's/#smtps/smtps/' /etc/postfix/master.cf
@ -32,4 +33,11 @@ function ee_mod_setup_postfix()
postconf "virtual_mailbox_domains = mysql:/etc/postfix/mysql/virtual_domains_maps.cf"
postconf "virtual_mailbox_maps = mysql:/etc/postfix/mysql/virtual_mailbox_maps.cf"
#postconf "message_size_limit = 20971520"
# Setting up Postfix MySQL configuration
mkdir -p /etc/postfix/mysql
cp -av /usr/share/easyengine/mail/virtual_alias_maps.cf /etc/postfix/mysql/virtual_alias_maps.cf
cp -av /usr/share/easyengine/mail/virtual_domains_maps.cf /etc/postfix/mysql/virtual_domains_maps.cf
cp -av /usr/share/easyengine/mail/virtual_mailbox_maps.cf /etc/postfix/mysql/virtual_mailbox_maps.cf
}

26
templates/mail/10-master.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
}

15
templates/mail/dovecot-sql.conf.ext

@ -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'

2
templates/mail/virtual_alias_maps.cf

@ -2,4 +2,4 @@ user = vimbadmin
password = password
hosts = 127.0.0.1
dbname = vimbadmin
query = SELECT goto FROM alias WHERE address = '%s' AND active = '1'
query = SELECT goto FROM alias WHERE address = '%s' AND active = '1'

2
templates/mail/virtual_domains_maps.cf

@ -2,4 +2,4 @@ user = vimbadmin
password = password
hosts = 127.0.0.1
dbname = vimbadmin
query = SELECT domain FROM domain WHERE domain = '%s' AND backupmx = '0' AND active = '1'
query = SELECT domain FROM domain WHERE domain = '%s' AND backupmx = '0' AND active = '1'

2
templates/mail/virtual_mailbox_maps.cf

@ -4,4 +4,4 @@ hosts = 127.0.0.1
dbname = vimbadmin
table = mailbox
select_field = maildir
where_field = username
where_field = username

Loading…
Cancel
Save