diff --git a/data/hooks/conf_regen/22-postgrey b/data/hooks/conf_regen/22-postgrey new file mode 100644 index 00000000..b1f924a0 --- /dev/null +++ b/data/hooks/conf_regen/22-postgrey @@ -0,0 +1,23 @@ +#!/bin/bash +set -e + +force=$1 + +function safe_copy () { + if [[ "$force" == "True" ]]; then + sudo yunohost service safecopy \ + -s postgrey \ + $1 $2 \ + --force + else + sudo yunohost service safecopy \ + -s postgrey \ + $1 $2 + fi +} + +cd /usr/share/yunohost/templates/postgrey + +if [[ "$(safe_copy postgrey.default /etc/default/postgrey)" == "True" ]]; then + sudo service nslcd restart +fi diff --git a/data/hooks/conf_regen/25-dovecot b/data/hooks/conf_regen/25-dovecot new file mode 100644 index 00000000..e8d2187d --- /dev/null +++ b/data/hooks/conf_regen/25-dovecot @@ -0,0 +1,52 @@ +#!/bin/bash +set -e + +force=$1 + +function safe_copy () { + if [[ "$force" == "True" ]]; then + sudo yunohost service safecopy \ + -s dovecot $1 $2 --force + else + sudo yunohost service safecopy \ + -s dovecot $1 $2 + fi +} + +cd /usr/share/yunohost/templates/dovecot + +# Create vmail user +sudo id vmail > /dev/null 2>&1 \ + || sudo adduser --system --ingroup mail --uid 500 vmail + + +# Replace main domain in the main configuration file +main_domain=$(cat /etc/yunohost/current_host) +cat dovecot.conf.sed \ + | sed "s/{{ main_domain }}/$main_domain/g" \ + | sudo tee dovecot.conf + + +# Handle IPv4 only systems +if [ ! -f /proc/net/if_inet6 ]; +then + sudo sed -i 's/^listen.*/listen = \*/' dovecot.conf +fi + + +safe_copy dovecot.conf /etc/dovecot/dovecot.conf +safe_copy dovecot-ldap.conf /etc/dovecot/dovecot-ldap.conf + + +# Setup Sieve +sudo rm -rf /etc/dovecot/global_script +sudo mkdir -p -m 0770 /etc/dovecot/global_script +safe_copy sa-learn-pipe.sh /usr/bin/sa-learn-pipe.sh +sudo chmod 755 /usr/bin/sa-learn-pipe.sh +safe_copy dovecot.sieve /etc/dovecot/global_script/dovecot.sieve +sudo chmod 660 /etc/dovecot/global_script/dovecot.sieve +sudo sievec /etc/dovecot/global_script/dovecot.sieve +sudo chmod 660 /etc/dovecot/global_script/dovecot.svbin + + +service dovecot reload diff --git a/data/templates/dovecot/dovecot-ipv4.conf.j2 b/data/templates/dovecot/dovecot-ipv4.conf.j2 deleted file mode 100644 index 044f0b90..00000000 --- a/data/templates/dovecot/dovecot-ipv4.conf.j2 +++ /dev/null @@ -1,71 +0,0 @@ -# 2.1.7: /etc/dovecot/dovecot.conf -# OS: Linux 3.2.0-3-686-pae i686 Debian wheezy/sid ext4 -listen = * -auth_mechanisms = plain login -login_greeting = Dovecot ready!! -mail_gid = 8 -mail_home = /var/mail/%n -mail_location = maildir:/var/mail/%n -mail_uid = 500 -passdb { - args = /etc/dovecot/dovecot-ldap.conf - driver = ldap -} -protocols = imap sieve -service auth { - unix_listener /var/spool/postfix/private/auth { - group = postfix - mode = 0660 - user = postfix - } - unix_listener auth-master { - group = mail - mode = 0660 - user = vmail - } -} - -protocol sieve { -} - -ssl_ca =