X-Git-Url: https://git.cyclocoop.org/?p=lhc%2Fateliers.git;a=blobdiff_plain;f=etc%2Fsv%2Fdovecot%2Flocal.sh;h=7d11fd2cafb8b16f1cb7fd021c1b5c116081bbcc;hp=7f68365b2dae741b1a556ba618e6d03c4c1d1ca9;hb=b75d4503ef9c919231c0c02daf5a1ed1e57c73af;hpb=3ad6118386977e346d81042e924e5db9c5f15b7d diff --git a/etc/sv/dovecot/local.sh b/etc/sv/dovecot/local.sh index 7f68365..7d11fd2 100644 --- a/etc/sv/dovecot/local.sh +++ b/etc/sv/dovecot/local.sh @@ -1,26 +1,70 @@ -"$tool"/local/apt-get-install dovecot-imapd dovecot-managesieved dovecot-sieve +"$tool"/local/apt-get-install dovecot-imapd dovecot-lmtpd dovecot-managesieved dovecot-pop3d dovecot-sieve "$tool"/local/insserv-remove dovecot -local hint="run before: ./vm_remote runit_configure dovecot" -assert "sudo test -f /etc/dovecot/\"$vm_domainname\"/imap/x509/key.pem" hint -sudo install -m 400 -o root -g root \ - "$tool"/var/pub/x509/imap."$vm_domainname"/crt+crl.self-signed.pem \ - /etc/dovecot/"$vm_domainname"/imap/x509/crt+crl.self-signed.pem -sudo install -d -m 770 -o root -g root \ - /etc/skel/etc/mail \ - /etc/skel/etc/sieve + +hint="run before: remote/runit-configure $sv" +for domain in \ + "$local_domainname" \ + cyclocoop.org + do + assert "sudo test -f /etc/dovecot/$domain/imap/x509/key.pem" hint + sudo install -m 400 -o root -g root \ + "$tool"/var/pub/x509/imap."$domain"/crt+crl.self-signed.pem \ + /etc/dovecot/"$domain"/imap/x509/crt+crl.self-signed.pem + done + +hint="run before: local/runit-configure nginx -- autoconfig" +assert "getent passwd www-autoconfig" hint +sudo install -d -m 750 -o www-autoconfig -g www-autoconfig \ + ~www-autoconfig/mail/ +sudo install -m 640 -o www-autoconfig -g www-autoconfig \ + "$tool"/etc/dovecot/autoconfig.xml \ + ~www-autoconfig/mail/config-v1.1.xml + +sudo usermod --home /home/mail mail +sudo install -d -m 0751 -o mail -g mail \ + ~mail +for dir in \ + /etc/dovecot/acl/global.d \ + ~mail/data \ + ~mail/log \ + /etc/dovecot/sieve \ + /etc/dovecot/sieve/after.d \ + /etc/dovecot/sieve/before.d \ + /etc/dovecot/sieve/global.d + do + sudo install -d -m 3775 -o root -g root "$dir" + done +for dir in \ + after.d \ + before.d \ + global.d + do + if sudo test -e "$tool"/etc/dovecot/sieve/"$dir" + then + sudo find "$tool"/etc/dovecot/sieve/"$dir" \ + -maxdepth 1 -type f \ + -name '*.sieve' \ + -exec install -m 644 -o root -g root \ + -t /etc/dovecot/sieve/"$dir" {} + + fi + sudo sievec /etc/dovecot/sieve/"$dir" + sudo find /etc/dovecot/sieve/"$dir" \ + -maxdepth 1 -type f \ + -exec chmod 664 {} + + done + +#sudo install -d -m 770 -o root -g root \ +# /etc/skel/etc/mail \ +# /etc/skel/etc/sieve sudo install -d -m 1777 -o root -g root \ /var/lib/dovecot-control \ /var/lib/dovecot-index m4 \ - --define=VM_DOMAINNAME=$vm_domainname \ - <"$tool"/etc/dovecot/local.conf.m4 | + --define=LOCAL_DOMAINNAME=$local_domainname \ + <"$tool"/etc/dovecot/dovecot.conf.m4 | sudo install -m 644 -o root -g root /dev/stdin \ - /etc/dovecot/local.conf -sudo install -m 755 -o root -g root /dev/stdin /usr/local/bin/dovecot-passwd <<-EOF - #!/bin/sh -efux - # DESCRIPTION: permet à un-e utilisateurice d'initialiser ellui-même son mot-de-passe dovecot. - install -d -m 770 ~/etc/dovecot - install -m 640 /dev/stdin ~/etc/dovecot/passwd <<_EOF - \$USER:\$(/usr/bin/doveadm pw -s SHA512-CRYPT)::::::: - _EOF - EOF + /etc/dovecot/dovecot.conf +sudo install -m 640 -o root -g postfix \ + "$tool"/etc/dovecot/transport \ + /etc/dovecot/transport +sudo postmap hash:/etc/dovecot/transport