-
Notifications
You must be signed in to change notification settings - Fork 1
/
alternc-sympa-install
executable file
·123 lines (104 loc) · 4.59 KB
/
alternc-sympa-install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/bash
# ----------------------------------------------------------------------
# AlternC - Web Hosting System
# Copyright (C) 2000-2022 by the AlternC Development Team.
# https://alternc.org/
# ----------------------------------------------------------------------
# LICENSE
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# To read the license please visit http://www.gnu.org/copyleft/gpl.html
# ----------------------------------------------------------------------
# Purpose of file: Install sympa conf files in sympa/postfix etc.
# ----------------------------------------------------------------------
# called with startup, upgrade, templates, apache2, before-reload, end
if [ "$1" = "upgrade" ]
then
# deploy wwsympa & sympasoap init scripts
update-rc.d wwsympa defaults
update-rc.d sympasoap defaults
# we remove the sympa apache configuration: we will use vhosts configuration instead
rm /etc/apache2/conf-enabled/sympa.conf
# we configure sympa
sed -i -e "/^sendmail\s/d" -e "/^sendmail_aliases\s/d" -e "/^aliases_program\s/d" -e "/^aliases_db_type\s/d" -e "/^dmarc_protection_mode\s/d" /etc/sympa/sympa/sympa.conf
echo "sendmail /usr/sbin/sendmail
sendmail_aliases /etc/mail/sympa/virtual_aliases
aliases_program postmap
aliases_db_type hash
dmarc_protection_mode dmarc_reject
" >> /etc/sympa/sympa/sympa.conf
# we configure postfix :
for file in /etc/postfix/main.cf /etc/alternc/templates/alternc/postfix/postfix.cf
do
if grep -q "^transport_maps.*hash:/etc/mail/sympa/virtual_aliases.*hash:/etc/sympa/robots.aliases" "$file"
then
echo "$file transport_maps OK"
else
echo "Configuring transport_maps in $file"
sed -i -e 's#transport_maps\(.*\)#transport_maps\1 hash:/etc/mail/sympa/virtual_aliases hash:/etc/sympa/robots.aliases#' "$file"
fi
if grep -q "^virtual_mailbox_maps.*hash:/etc/mail/sympa/virtual_aliases.*hash:/etc/sympa/robots.aliases" "$file"
then
echo "$file virtual_mailbox_maps OK"
else
echo "Configuring virtual_mailbox_maps in $file"
sed -i -e 's#virtual_mailbox_maps\(.*\)#virtual_mailbox_maps\1 hash:/etc/mail/sympa/virtual_aliases hash:/etc/sympa/robots.aliases#' "$file"
fi
done
if grep -q "^sympa_destination_recipient_limit" /etc/postfix/main.cf
then
echo "main.cf sympa_destination_recipient_limit OK"
else
echo "Configuring sympa_destination_recipient_limit in main.cf"
echo "sympa_destination_recipient_limit = 1" >> /etc/postfix/main.cf
fi
if grep -q "^sympabounce_destination_recipient_limit" /etc/postfix/main.cf
then
echo "main.cf sympabounce_destination_recipient_limit OK"
else
echo "Configuring sympabounce_destination_recipient_limit in main.cf"
echo "sympabounce_destination_recipient_limit = 1" >> /etc/postfix/main.cf
fi
for file in /etc/postfix/master.cf /etc/alternc/templates/postfix/master.cf
do
# now postfix master.cf:
if grep -q "^sympa\s" $file
then
echo "$file sympa transport OK"
else
echo "adding sympa transport to $file"
echo 'sympa unix - n n - - pipe flags=R user=sympa argv=/usr/lib/sympa/bin/queue ${recipient}' >> $file
fi
if grep -q "^sympabounce\s" $file
then
echo "$file sympaboune transport OK"
else
echo "adding sympabounce transport to $file"
echo 'sympabounce unix - n n - - pipe flags=R user=sympa argv=/usr/lib/sympa/bin/bouncequeue ${recipient}' >> $file
fi
done
touch /etc/mail/sympa/virtual_aliases
postmap /etc/mail/sympa/virtual_aliases
chown sympa:sympa /etc/mail/sympa/virtual_aliases*
touch /etc/sympa/robots.aliases
postmap /etc/sympa/robots.aliases
fi # $1=upgrdae
if [ "$1" = "before-reload" ]
then
# we restart all services
service sympa stop
service wwsympa stop
service sympasoap stop
service sympa start
service wwsympa start
service sympasoap start
fi # $1=before-reload