forked from msimerson/Mail-Toaster-6
-
Notifications
You must be signed in to change notification settings - Fork 0
/
provision-postfix.sh
executable file
·64 lines (53 loc) · 1.29 KB
/
provision-postfix.sh
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
#!/bin/sh
# shellcheck disable=1091
. mail-toaster.sh || exit
export JAIL_START_EXTRA=""
export JAIL_CONF_EXTRA=""
install_postfix()
{
tell_status "installing postfix"
stage_pkg_install postfix opendkim dialog4ports || exit
}
configure_postfix()
{
stage_sysrc postfix_enable=YES
stage_sysrc sshd_enable=YES
stage_sysrc milteropendkim_enable=YES
stage_sysrc milteropendkim_cfgfile=/data/etc/opendkim.conf
if [ -n "$TOASTER_NRPE" ]; then
stage_sysrc nrpe3_enable=YES
stage_sysrc nrpe3_configfile="/data/etc/nrpe.cfg"
fi
for _f in master main
do
if [ -f "$ZFS_DATA_MNT/postfix/etc/$_f.cf" ]; then
cp "$ZFS_DATA_MNT/postfix/etc/$_f.cf" "$STAGE_MNT/usr/local/etc/postfix/"
fi
done
if [ -f "$ZFS_JAIL_MNT/postfix/etc/aliases" ]; then
tell_status "preserving /etc/aliases"
cp "$ZFS_JAIL_MNT/postfix/etc/aliases" "$STAGE_MNT/etc/aliases"
stage_exec newaliases
fi
}
start_postfix()
{
tell_status "starting postfix"
stage_exec service milter-opendkim start
stage_exec service postfix start || exit
}
test_postfix()
{
tell_status "testing postfix"
stage_test_running postfix
stage_listening 25
echo "it worked."
}
base_snapshot_exists || exit
create_staged_fs postfix
start_staged_jail postfix
install_postfix
configure_postfix
start_postfix
test_postfix
promote_staged_jail postfix