feature: provide initial Rspamd support (#2902)

This commit is contained in:
Georg Lauterbach 2023-01-05 08:39:00 +01:00 committed by GitHub
parent a00cdcdee9
commit 26ac48f34a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 118 additions and 0 deletions

View file

@ -129,6 +129,21 @@ function _install_dovecot
apt-get "${QUIET}" --no-install-recommends install "${DOVECOT_PACKAGES[@]}"
}
function _install_rspamd
{
_log 'trace' 'Adding Rspamd package signatures'
curl -sSfL https://rspamd.com/apt-stable/gpg.key | gpg --dearmor >/etc/apt/trusted.gpg.d/rspamd.gpg
echo "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/rspamd.gpg] http://rspamd.com/apt-stable/ bullseye main" \
>/etc/apt/sources.list.d/rspamd.list
echo "deb-src [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/rspamd.gpg] http://rspamd.com/apt-stable/ bullseye main" \
>>/etc/apt/sources.list.d/rspamd.list
_log 'debug' 'Installing Rspamd'
apt-get "${QUIET}" update
apt-get "${QUIET}" --no-install-recommends install rspamd redis-server
}
function _install_fail2ban
{
local FAIL2BAN_DEB_URL='https://github.com/fail2ban/fail2ban/releases/download/1.0.2/fail2ban_1.0.2-1.upstream1_all.deb'
@ -180,5 +195,6 @@ _pre_installation_steps
_install_postfix
_install_packages
_install_dovecot
_install_rspamd
_install_fail2ban
_post_installation_steps

View file

@ -91,6 +91,7 @@ function _environment_variables_general_setup
VARS[ENABLE_POP3]="${ENABLE_POP3:=0}"
VARS[ENABLE_POSTGREY]="${ENABLE_POSTGREY:=0}"
VARS[ENABLE_QUOTAS]="${ENABLE_QUOTAS:=1}"
VARS[ENABLE_RSPAMD]="${ENABLE_RSPAMD:=0}"
VARS[ENABLE_SASLAUTHD]="${ENABLE_SASLAUTHD:=0}"
VARS[ENABLE_SPAMASSASSIN]="${ENABLE_SPAMASSASSIN:=0}"
VARS[ENABLE_SPAMASSASSIN_KAM]="${ENABLE_SPAMASSASSIN_KAM:=0}"

View file

@ -101,6 +101,7 @@ function _register_functions
[[ ${ENABLE_FAIL2BAN} -eq 1 ]] && _register_setup_function '_setup_fail2ban'
[[ ${ENABLE_DNSBL} -eq 0 ]] && _register_setup_function '_setup_dnsbl_disable'
[[ ${CLAMAV_MESSAGE_SIZE_LIMIT} != '25M' ]] && _register_setup_function '_setup_clamav_sizelimit'
[[ ${ENABLE_RSPAMD} -eq 1 ]] && _register_setup_function '_setup_rspamd'
_register_setup_function '_setup_dkim'
_register_setup_function '_setup_ssl'
@ -165,6 +166,12 @@ function _register_functions
[[ ${SMTP_ONLY} -ne 1 ]] && _register_start_daemon '_start_daemon_dovecot'
[[ ${ENABLE_UPDATE_CHECK} -eq 1 ]] && _register_start_daemon '_start_daemon_update_check'
if [[ ${ENABLE_RSPAMD} -eq 1 ]]
then
_register_start_daemon '_start_daemon_rspamd'
_register_start_daemon '_start_daemon_redis'
fi
# needs to be started before SASLauthd
_register_start_daemon '_start_daemon_opendkim'
_register_start_daemon '_start_daemon_opendmarc'

View file

@ -35,6 +35,8 @@ function _start_daemon_postsrsd { _default_start_daemon 'postsrsd' ;
function _start_daemon_postfix { _default_start_daemon 'postfix' ; }
function _start_daemon_rsyslog { _default_start_daemon 'rsyslog' ; }
function _start_daemon_update_check { _default_start_daemon 'update-check' ; }
function _start_daemon_rspamd { _default_start_daemon 'rspamd' ; }
function _start_daemon_redis { _default_start_daemon 'redis' ; }
function _start_daemon_saslauthd
{

View file

@ -33,6 +33,8 @@ function _misc_save_states
[[ ${ENABLE_FAIL2BAN} -eq 1 ]] && FILES+=('lib/fail2ban')
[[ ${ENABLE_FETCHMAIL} -eq 1 ]] && FILES+=('lib/fetchmail')
[[ ${ENABLE_POSTGREY} -eq 1 ]] && FILES+=('lib/postgrey')
[[ ${ENABLE_RSPAMD} -ne 1 ]] && FILES+=('lib/rspamd')
# [[ ${ENABLE_RSPAMD} -ne 1 ]] && FILES+=('lib/redis')
[[ ${ENABLE_SPAMASSASSIN} -eq 1 ]] && FILES+=('lib/spamassassin')
[[ ${SMTP_ONLY} -ne 1 ]] && FILES+=('lib/dovecot')

View file

@ -89,6 +89,27 @@ function _setup_amavis
fi
}
function _setup_rspamd
{
_log 'warn' 'Rspamd support is under active development, expect breaking changes at any time'
if [[ ${ENABLE_AMAVIS} -eq 1 ]] || [[ ${ENABLE_SPAMASSASSIN} -eq 1 ]]
then
_shutdown 'You cannot run Amavis/SpamAssassin and Rspamd at the same time'
fi
if [[ ${ENABLE_CLAMAV} -eq 1 ]]
then
_log 'debug' 'Rspamd will use ClamAV'
mv /etc/rspamd/local.d/disabled/antivirus.conf /etc/rspamd/local.d/antivirus.conf
else
_log 'debug' 'Rspamd will not use ClamAV (which has not been enabled)'
fi
_log 'warn' 'Only running with default configuration'
_log 'warn' 'You will need to adjust the Postfix configuration yourself to use Rspamd as of now'
}
function _setup_dmarc_hostname
{
_log 'debug' 'Setting up DMARC'