forked from msimerson/Mail-Toaster-6
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprovision-rspamd.sh
executable file
·72 lines (59 loc) · 1.38 KB
/
provision-rspamd.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
65
66
67
68
69
70
71
72
#!/bin/sh
# shellcheck disable=1091
. mail-toaster.sh || exit
install_rspamd()
{
tell_status "installing rspamd"
stage_pkg_install rspamd || exit
}
configure_dmarc()
{
if ! zfs_filesystem_exists "$ZFS_DATA_VOL/redis"; then
return
fi
tell_status "add Redis address, for DMARC stats"
echo "dmarc {
servers = \"$(get_jail_ip redis):6379\";
}" | tee -a "$_etc/rspamd/rspamd.conf"
}
configure_logging()
{
tell_status "configuring syslog logging"
sed -i .bak \
-e 's/type = "file"/type = "syslog"/' \
-e 's/filename = ".*/facility = "LOG_MAIL";/' \
"$_etc/rspamd/rspamd.conf"
# mkdir -p "$_etc/newsyslog.conf.d/"
# echo '/var/log/rspamd/rspamd.log nobody:nobody 644 7 * @T00 JC /var/run/rspamd/rspamd.pid 30' \
# > "$_etc/newsyslog.conf.d/rspamd"
}
configure_rspamd()
{
tell_status "configuring rspamd"
local _etc="$STAGE_MNT/usr/local/etc"
configure_logging
configure_dmarc
# configure admin password?
sed -i -e '/^filters/ s/spf/spf,dmarc/' "$_etc/rspamd/options.inc"
echo "done"
}
start_rspamd()
{
tell_status "starting rspamd"
stage_sysrc rspamd_enable=YES
stage_exec service rspamd start
}
test_rspamd()
{
tell_status "testing rspamd"
stage_exec sockstat -l -4 | grep 11334 || exit
echo "it worked"
}
base_snapshot_exists || exit
create_staged_fs rspamd
start_staged_jail
install_rspamd
configure_rspamd
start_rspamd
test_rspamd
promote_staged_jail rspamd