Modification : vm_hosted -> etc/sv/*/configure.sh .
[lhc/ateliers.git] / etc / sv / postfix / configure.sh
1 local hint="run vm_remote postfix_key_send before"
2 assert "test -f /etc/postfix/$vm_domainname/smtpd/x509/key.pem" hint
3 #warn "lors de l'installation Debian, ne sélectionner aucune configuration pour postfix"
4 sudo debconf-set-selections <<-EOF
5 postfix postfix/main_mailer_type select No configuration
6 EOF
7 rule apt_get_install postfix procmail
8 rule insserv_remove postfix
9 sudo install -m 640 -o root -g root /dev/stdin /etc/postfix/.gitignore <<-EOF
10 *.db
11 EOF
12 sudo install -d -m 771 -o root -g root \
13 /etc/postfix/ \
14 /etc/postfix/$vm_domainname/ \
15 /etc/postfix/$vm_domainname/smtp \
16 /etc/postfix/$vm_domainname/smtp/x509 \
17 /etc/postfix/$vm_domainname/smtp/x509/ca \
18 /etc/postfix/$vm_domainname/smtpd \
19 /etc/postfix/$vm_domainname/smtpd/x509 \
20 /etc/postfix/$vm_domainname/smtpd/x509/ca
21 sudo ln -fns \
22 ../crt+crl.self-signed.pem \
23 /etc/postfix/$vm_domainname/smtpd/x509/ca/crt.pem
24 sudo install -m 400 -o root -g root \
25 "$tool"/var/pub/x509/smtpd.$vm_domainname/crt+crl.self-signed.pem \
26 /etc/postfix/$vm_domainname/smtpd/x509/crt+crl.self-signed.pem
27 sudo install -m 400 -o root -g root \
28 "$tool"/var/pub/x509/smtpd.$vm_domainname/crt.pem \
29 /etc/postfix/$vm_domainname/smtpd/x509/crt.pem
30 sudo install -m 400 -o root -g root \
31 "$tool"/var/pub/x509/smtpd.$vm_domainname/crt+ca.pem \
32 /etc/postfix/$vm_domainname/smtpd/x509/crt+ca.pem
33 sudo install -m 400 -o root -g root \
34 "$tool"/var/pub/x509/smtpd.$vm_domainname/crt+crl.self-signed.pem \
35 /etc/postfix/$vm_domainname/smtpd/x509/crt+crl.self-signed.pem
36 sudo install -m 640 -o root -g root \
37 "$tool"/etc/postfix/$vm_domainname/header_checks \
38 /etc/postfix/$vm_domainname/header_checks
39 sudo install -m 644 -o root -g root /dev/stdin \
40 /etc/postfix/aliases <<-EOF
41 # See man 5 aliases for format
42 abuse: root
43 admin: root
44 contact: root
45 mailer-daemon: root
46 postmaster: root
47 root: $(getent group sudo | cut -f 4 -d : | tr , ' ')
48 EOF
49 sudo newaliases -oA/etc/postfix/aliases
50 cat /dev/stdin "$tool"/etc/postfix/main.cf <<-EOF |
51 mydomain = $vm_domainname
52 myorigin = \$mydomain
53 myhostname = $vm_hostname.\$mydomain
54 mail_name = \$myhostname
55 mydestination = $vm_hostname \$myhostname \$myorigin
56 EOF
57 sudo install -m 640 -o root -g root /dev/stdin \
58 /etc/postfix/main.cf
59 sudo install -m 640 -o root -g root \
60 "$tool"/etc/postfix/master.cf \
61 /etc/postfix/master.cf
62 sudo install -m 640 -o root -g root \
63 "$tool"/etc/postfix/$vm_domainname/smtp/x509/policy \
64 /etc/postfix/$vm_domainname/smtp/x509/policy
65 sudo postmap hash:/etc/postfix/$vm_domainname/smtp/x509/policy
66 sudo install -m 640 -o root -g root \
67 "$tool"/etc/postfix/$vm_domainname/smtp/header_checks \
68 /etc/postfix/$vm_domainname/smtp/header_checks
69 sudo install -m 640 -o root -g root \
70 "$tool"/etc/postfix/$vm_domainname/smtpd/sender_access \
71 /etc/postfix/$vm_domainname/smtpd/sender_access
72 sudo postmap hash:/etc/postfix/$vm_domainname/smtpd/sender_access
73 sudo install -m 640 -o root -g root \
74 "$tool"/etc/postfix/$vm_domainname/smtpd/client_blacklist \
75 /etc/postfix/$vm_domainname/smtpd/client_blacklist
76 sudo postmap hash:/etc/postfix/$vm_domainname/smtpd/client_blacklist
77 sudo install -m 640 -o root -g root \
78 "$tool"/etc/postfix/$vm_domainname/smtpd/relay_clientcerts \
79 /etc/postfix/$vm_domainname/smtpd/relay_clientcerts
80 sudo postmap hash:/etc/postfix/$vm_domainname/smtpd/relay_clientcerts
81 sudo install -m 640 -o root -g root \
82 "$tool"/etc/postfix/$vm_domainname/transport \
83 /etc/postfix/$vm_domainname/transport
84 sudo postmap hash:/etc/postfix/$vm_domainname/transport
85 sudo install -m 640 -o root -g root \
86 "$tool"/etc/postfix/$vm_domainname/virtual_alias \
87 /etc/postfix/$vm_domainname/virtual_alias
88 sudo postmap hash:/etc/postfix/$vm_domainname/virtual_alias
89 sudo install -d -m 770 -o root -g root \
90 /etc/skel/etc/mail \
91 /etc/skel/var/cache/mail \
92 /etc/skel/var/log/mail \
93 /etc/skel/var/mail
94 sudo install -m 660 -o root -g root \
95 "$tool"/etc/skel/etc/mail/delivery.procmailrc \
96 /etc/skel/etc/mail/delivery.procmailrc