diff --git a/Linux/Messagerie/mail.sh b/Linux/Messagerie/mail.sh index 9aed409..138d918 100644 --- a/Linux/Messagerie/mail.sh +++ b/Linux/Messagerie/mail.sh @@ -176,13 +176,21 @@ then echo "" > /etc/dovecot/conf.d/auth-sql.conf.ext echo -e "passdb {\n\tdriver = sql\n\targs = /etc/dovecot/dovecot-sql.conf\n}\nuserdb {\n\tdriver = sql\n\targs = /etc/dovecot/dovecot-sql.conf\n}" >> /etc/dovecot/conf.d/auth-sql.conf.ext echo "" > /etc/dovecot/dovecot-sql.conf - echo -e "driver = mysql\nconnect = host=127.0.0.1 dbname=postfix user=postfixuser password=$MARIADB_POSTFIX_PASSWORD\ndefault_pass_scheme = SHA512-CRYPT\nuser_query = SELECT CONCAT('/var/mail/vhosts/',maildir) as home, CONCAT('maildir:/var/mail/vhosts/',maildir,'mail/') as mail, CONCAT('*:bytes=', IF(mailbox.quota = -1, domain.maxquota*1048576, mailbox.quota)) as quota_rule FROM mailbox, domain WHERE username = '%u' AND mailbox.active = '1' AND domain.domain = '%d' AND domain.active = '1'\npassword_query = SELECT username as user, password, CONCAT('/var/mail/vhosts/',maildir) AS userdb_home, CONCAT('maildir:/var/mail/vhosts/',maildir,'mail/') AS userdb_mail FROM mailbox WHERE username = '%u' AND active = '1'" >> /etc/dovecot/dovecot-sql.conf + echo -e "driver = mysql\nconnect = host=127.0.0.1 dbname=postfix user=postfix password=$MARIADB_POSTFIX_PASSWORD\ndefault_pass_scheme = SHA512-CRYPT\nuser_query = SELECT CONCAT('/var/mail/vhosts/',maildir) as home, CONCAT('maildir:/var/mail/vhosts/',maildir,'mail/') as mail, CONCAT('*:bytes=', IF(mailbox.quota = -1, domain.maxquota*1048576, mailbox.quota)) as quota_rule FROM mailbox, domain WHERE username = '%u' AND mailbox.active = '1' AND domain.domain = '%d' AND domain.active = '1'\npassword_query = SELECT username as user, password, CONCAT('/var/mail/vhosts/',maildir) AS userdb_home, CONCAT('maildir:/var/mail/vhosts/',maildir,'mail/') AS userdb_mail FROM mailbox WHERE username = '%u' AND active = '1'" >> /etc/dovecot/dovecot-sql.conf chown -R vmail:dovecot /etc/dovecot chmod -R o-rwx /etc/dovecot echo "" > /etc/dovecot/conf.d/10-master.conf echo -e "service imap-login {\n\tinet_listener imap {\n\t\tport = 143\n\t}\n\tinet_listener imaps {\n\t\tport = 993\n\t\tssl = yes\n\t}\n\tservice_count = 0\n}\nservice lmtp {\n\tunix_listener /var/spool/postfix/private/dovecot-lmtp {\n\t\tmode = 0600\n\t\tuser = postfix\n\t\tgroup = postfix\n\t}\n}\nservice auth {\n\tunix_listener auth-userdb {\n\t\tmode = 0600\n\t\tuser = vmail\n\t\tgroup = vmail\n\t}\n\tunix_listener /var/spool/postfix/private/auth {\n\t\tmode = 0666\n\t\tuser = postfix\n\t\tgroup = postfix\n\t}\n\tuser = dovecot\n}\nservice auth-worker {\n\tuser = vmail\n}" >> /etc/dovecot/conf.d/10-master.conf echo "" > /etc/dovecot/conf.d/10-ssl.conf echo -e "ssl = required\nssl_cert = > /etc/dovecot/conf.d/10-ssl.conf + touch /etc/dovecot/dovecot-dict-sql-user.conf + echo -e "connect = host=127.0.0.1 dbname=postfix user=postfix password=$MARIADB_POSTFIX_PASSWORD\n\nmap {\n\tpattern = priv/quota/storage\n\ttable = quota2\n\tusername_field = username\n\tvalue_field = bytes\n}\nmap {\n\tpattern = priv/quota/messages\n\ttable = quota2\n\tusername_field = username\n\tvalue_field = messages\n}" >> /etc/dovecot/dovecot-dict-sql-user.conf + touch /etc/dovecot/dovecot-dict-sql-domain.conf + echo -e "connect = host=127.0.0.1 dbname=postfix user=postfix password=$MARIADB_POSTFIX_PASSWORD\n\nmap {\n\tpattern = priv/quota/storage\n\ttable = domain\n\tusername_field = domain\n\tvalue_field = quota\n}\n\nmap {\n\tpattern = priv/quota/messages\n\ttable = quota2\n\tusername_field = username\n\tvalue_field = messages\n}" >> /etc/dovecot/dovecot-dict-sql-domain.conf + echo "" > /etc/dovecot/conf.d/20-imap.conf + echo -e "protocol imap {\n\tmail_plugins = \$mail_plugins imap_quota\n}" >> /etc/dovecot/conf.d/20-imap.conf + echo "" > /etc/dovecot/conf.d/90-quota.conf + echo -e "service dict {\n\tunix_listener dict {\n\t\tmode = 0600\n\t\tuser = vmail\n\t}\n}\nplugin {\n\tquota = dict:Quota:%d:proxy::sqldomainquota\n\tquota = dict:User Quota::proxy::sqluserquota\n\n\tquota_rule2 = Trash:storage=+10%%\n}\n\ndict {\n\tsqluserquota = mysql:/etc/dovecot/dovecot-dict-sql-user.conf\n\tsqldomainquota = mysql:/etc/dovecot/dovecot-dict-sql-domain.conf\n}" >> /etc/dovecot/conf.d/90-quota.conf echo "#################################" echo "# Configuration de SpamAssassin #" @@ -277,6 +285,8 @@ then sed -i -e "s/\$CONF\[\x27domain_path\x27\] =.*/\$CONF['domain_path'] = 'YES';/" /var/www/postfixadmin/config.local.php sed -i -e "s/\$CONF\[\x27domain_in_mailbox\x27\] =.*/\$CONF['domain_in_mailbox'] = 'NO';/" /var/www/postfixadmin/config.local.php sed -i -e "s/\$CONF\[\x27fetchmail\x27\] =.*/\$CONF['fetchmail'] = 'NO';/" /var/www/postfixadmin/config.local.php + sed -i -e "s/\$CONF\[\x27quota\x27\] =.*/\$CONF['quota'] = 'YES';/" /var/www/postfixadmin/config.local.php + sed -i -e "s/\$CONF\[\x27used_quotas\x27\] =.*/\$CONF['used_quotas'] = 'YES';/" /var/www/postfixadmin/config.local.php echo "-- Paramètres appliqués !" chown -R www-data:www-data postfixadmin echo "-- Droits sur le répertoire appliqués !"