2017-06-22 17:12:13 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-05-06 12:18:37 +02:00
|
|
|
mkdir -p /etc/rspamd/plugins.d \
|
|
|
|
/etc/rspamd/custom
|
|
|
|
|
|
|
|
touch /etc/rspamd/rspamd.conf.local \
|
|
|
|
/etc/rspamd/rspamd.conf.override
|
|
|
|
|
2019-05-18 22:44:30 +02:00
|
|
|
chmod 755 /var/lib/rspamd
|
|
|
|
|
2019-10-29 08:39:57 +01:00
|
|
|
addgroup --system --gid 82 www-access
|
|
|
|
|
2019-07-08 07:56:41 +02:00
|
|
|
[[ ! -f /etc/rspamd/override.d/worker-controller-password.inc ]] && echo '# Autogenerated by mailcow' > /etc/rspamd/override.d/worker-controller-password.inc
|
2019-05-18 22:44:30 +02:00
|
|
|
|
|
|
|
DOVECOT_V4=
|
|
|
|
DOVECOT_V6=
|
|
|
|
until [[ ! -z ${DOVECOT_V4} ]]; do
|
|
|
|
DOVECOT_V4=$(dig a dovecot +short)
|
|
|
|
DOVECOT_V6=$(dig aaaa dovecot +short)
|
|
|
|
[[ ! -z ${DOVECOT_V4} ]] && break;
|
|
|
|
echo "Waiting for Dovecot"
|
|
|
|
sleep 3
|
|
|
|
done
|
|
|
|
echo ${DOVECOT_V4}/32 > /etc/rspamd/custom/dovecot_trusted.map
|
|
|
|
if [[ ! -z ${DOVECOT_V6} ]]; then
|
|
|
|
echo ${DOVECOT_V6}/128 >> /etc/rspamd/custom/dovecot_trusted.map
|
|
|
|
fi
|
|
|
|
|
2019-05-06 12:18:37 +02:00
|
|
|
chown -R _rspamd:_rspamd /var/lib/rspamd \
|
|
|
|
/etc/rspamd/local.d \
|
|
|
|
/etc/rspamd/override.d \
|
|
|
|
/etc/rspamd/custom \
|
|
|
|
/etc/rspamd/rspamd.conf.local \
|
|
|
|
/etc/rspamd/rspamd.conf.override \
|
|
|
|
/etc/rspamd/plugins.d
|
|
|
|
|
2019-10-25 08:31:31 +02:00
|
|
|
# Fix missing default global maps, if any
|
|
|
|
# These exists in mailcow UI and should not be removed
|
|
|
|
touch /etc/rspamd/custom/global_mime_from_blacklist.map \
|
|
|
|
/etc/rspamd/custom/global_rcpt_blacklist.map \
|
|
|
|
/etc/rspamd/custom/global_smtp_from_blacklist.map \
|
|
|
|
/etc/rspamd/custom/global_mime_from_whitelist.map \
|
|
|
|
/etc/rspamd/custom/global_rcpt_whitelist.map \
|
|
|
|
/etc/rspamd/custom/global_smtp_from_whitelist.map \
|
|
|
|
/etc/rspamd/custom/sa-rules \
|
|
|
|
/etc/rspamd/custom/dovecot_trusted.map \
|
|
|
|
/etc/rspamd/custom/ip_wl.map \
|
|
|
|
/etc/rspamd/custom/fishy_tlds.map \
|
|
|
|
/etc/rspamd/custom/bad_words.map \
|
|
|
|
/etc/rspamd/custom/bad_asn.map \
|
|
|
|
/etc/rspamd/custom/bad_words_de.map
|
|
|
|
|
|
|
|
# www-data (82) group needs to write to these files
|
2019-10-29 08:39:57 +01:00
|
|
|
chown root:root /etc/rspamd/custom/
|
|
|
|
chmod 0755 /etc/rspamd/custom/
|
|
|
|
chown -R _rspamd:www-access /etc/rspamd/custom/*
|
|
|
|
chmod -R 664 /etc/rspamd/custom/*
|
2019-10-25 08:31:31 +02:00
|
|
|
|
2019-10-18 12:01:47 +02:00
|
|
|
# Run hooks
|
|
|
|
for file in /hooks/*; do
|
|
|
|
if [ -x "${file}" ]; then
|
|
|
|
echo "Running hook ${file}"
|
|
|
|
"${file}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2018-07-13 12:04:32 +02:00
|
|
|
exec "$@"
|