Modification : vm_hosted -> etc/sv/*/configure.sh .
[lhc/ateliers.git] / etc / sv / postfix / configure.sh
diff --git a/etc/sv/postfix/configure.sh b/etc/sv/postfix/configure.sh
new file mode 100644 (file)
index 0000000..e17af10
--- /dev/null
@@ -0,0 +1,96 @@
+local hint="run vm_remote postfix_key_send before"
+assert "test -f /etc/postfix/$vm_domainname/smtpd/x509/key.pem" hint
+#warn "lors de l'installation Debian, ne sélectionner aucune configuration pour postfix"
+sudo debconf-set-selections <<-EOF
+       postfix postfix/main_mailer_type        select  No configuration
+       EOF
+rule apt_get_install postfix procmail
+rule insserv_remove  postfix
+sudo install -m 640 -o root -g root /dev/stdin /etc/postfix/.gitignore <<-EOF
+       *.db
+       EOF
+sudo install -d -m 771 -o root -g root \
+ /etc/postfix/ \
+ /etc/postfix/$vm_domainname/ \
+ /etc/postfix/$vm_domainname/smtp \
+ /etc/postfix/$vm_domainname/smtp/x509 \
+ /etc/postfix/$vm_domainname/smtp/x509/ca \
+ /etc/postfix/$vm_domainname/smtpd \
+ /etc/postfix/$vm_domainname/smtpd/x509 \
+ /etc/postfix/$vm_domainname/smtpd/x509/ca
+sudo ln -fns \
+ ../crt+crl.self-signed.pem \
+ /etc/postfix/$vm_domainname/smtpd/x509/ca/crt.pem
+sudo install -m 400 -o root -g root \
+ "$tool"/var/pub/x509/smtpd.$vm_domainname/crt+crl.self-signed.pem \
+    /etc/postfix/$vm_domainname/smtpd/x509/crt+crl.self-signed.pem
+sudo install -m 400 -o root -g root \
+ "$tool"/var/pub/x509/smtpd.$vm_domainname/crt.pem \
+    /etc/postfix/$vm_domainname/smtpd/x509/crt.pem
+sudo install -m 400 -o root -g root \
+ "$tool"/var/pub/x509/smtpd.$vm_domainname/crt+ca.pem \
+    /etc/postfix/$vm_domainname/smtpd/x509/crt+ca.pem
+sudo install -m 400 -o root -g root \
+ "$tool"/var/pub/x509/smtpd.$vm_domainname/crt+crl.self-signed.pem \
+    /etc/postfix/$vm_domainname/smtpd/x509/crt+crl.self-signed.pem
+sudo install -m 640 -o root -g root \
+ "$tool"/etc/postfix/$vm_domainname/header_checks \
+        /etc/postfix/$vm_domainname/header_checks
+sudo install -m 644 -o root -g root /dev/stdin \
+ /etc/postfix/aliases <<-EOF
+       # See man 5 aliases for format
+       abuse: root
+       admin: root
+       contact: root
+       mailer-daemon: root
+       postmaster: root
+       root: $(getent group sudo | cut -f 4 -d : | tr , ' ')
+       EOF
+sudo newaliases -oA/etc/postfix/aliases
+cat /dev/stdin "$tool"/etc/postfix/main.cf <<-EOF |
+       mydomain      = $vm_domainname
+       myorigin      = \$mydomain
+       myhostname    = $vm_hostname.\$mydomain
+       mail_name     = \$myhostname
+       mydestination = $vm_hostname \$myhostname \$myorigin
+       EOF
+sudo install -m 640 -o root -g root /dev/stdin \
+ /etc/postfix/main.cf
+sudo install -m 640 -o root -g root \
+ "$tool"/etc/postfix/master.cf \
+        /etc/postfix/master.cf
+sudo install -m 640 -o root -g root \
+ "$tool"/etc/postfix/$vm_domainname/smtp/x509/policy \
+        /etc/postfix/$vm_domainname/smtp/x509/policy
+sudo postmap hash:/etc/postfix/$vm_domainname/smtp/x509/policy
+sudo install -m 640 -o root -g root \
+ "$tool"/etc/postfix/$vm_domainname/smtp/header_checks \
+        /etc/postfix/$vm_domainname/smtp/header_checks
+sudo install -m 640 -o root -g root \
+ "$tool"/etc/postfix/$vm_domainname/smtpd/sender_access \
+        /etc/postfix/$vm_domainname/smtpd/sender_access
+sudo postmap hash:/etc/postfix/$vm_domainname/smtpd/sender_access
+sudo install -m 640 -o root -g root \
+ "$tool"/etc/postfix/$vm_domainname/smtpd/client_blacklist \
+        /etc/postfix/$vm_domainname/smtpd/client_blacklist
+sudo postmap hash:/etc/postfix/$vm_domainname/smtpd/client_blacklist
+sudo install -m 640 -o root -g root \
+ "$tool"/etc/postfix/$vm_domainname/smtpd/relay_clientcerts \
+        /etc/postfix/$vm_domainname/smtpd/relay_clientcerts
+sudo postmap hash:/etc/postfix/$vm_domainname/smtpd/relay_clientcerts
+sudo install -m 640 -o root -g root \
+ "$tool"/etc/postfix/$vm_domainname/transport \
+        /etc/postfix/$vm_domainname/transport
+sudo postmap hash:/etc/postfix/$vm_domainname/transport
+sudo install -m 640 -o root -g root \
+ "$tool"/etc/postfix/$vm_domainname/virtual_alias \
+        /etc/postfix/$vm_domainname/virtual_alias
+sudo postmap hash:/etc/postfix/$vm_domainname/virtual_alias
+sudo install -d -m 770 -o root -g root \
+ /etc/skel/etc/mail \
+ /etc/skel/var/cache/mail \
+ /etc/skel/var/log/mail \
+ /etc/skel/var/mail
+sudo install -m 660 -o root -g root \
+ "$tool"/etc/skel/etc/mail/delivery.procmailrc \
+        /etc/skel/etc/mail/delivery.procmailrc