rspamd: add neural module config (#3833)

Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
This commit is contained in:
Hans-Cees Speel 2024-02-01 17:34:33 +01:00 committed by GitHub
parent 05fbcf6889
commit 45935f5fb8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 105 additions and 1 deletions

View file

@ -20,6 +20,7 @@ function _setup_rspamd() {
__rspamd__setup_learning
__rspamd__setup_greylisting
__rspamd__setup_hfilter_group
__rspamd__setup_neural
__rspamd__setup_check_authenticated
_rspamd_handle_user_modules_adjustments # must run last
@ -186,7 +187,6 @@ function __rspamd__setup_default_modules() {
local DISABLE_MODULES=(
clickhouse
elastic
neural
reputation
spamassassin
url_redirector
@ -283,6 +283,23 @@ function __rspamd__setup_hfilter_group() {
fi
}
# This function handles setup of the neural module (see
# https://www.rspamd.com/doc/modules/neural.html). This module is experimental
# but can enhance anti-spam scoring possibly.
function __rspamd__setup_neural() {
if _env_var_expect_zero_or_one 'RSPAMD_NEURAL' && [[ ${RSPAMD_NEURAL} -eq 1 ]]; then
__rspamd__log 'debug' 'Enabling Neural module'
__rspamd__log 'warn' 'The Neural module is still experimental (in Rspamd) and hence not tested in DMS'
else
__rspamd__log 'debug' 'Neural module is disabled'
rm -f "${RSPAMD_LOCAL_D}/neural.conf"
rm -f "${RSPAMD_LOCAL_D}/neural_group.conf"
__rspamd__helper__enable_disable_module 'neural' 'false'
fi
}
# If 'RSPAMD_CHECK_AUTHENTICATED' is enabled, then content checks for all users, i.e.
# also for authenticated users, are performed.
#

View file

@ -71,6 +71,7 @@ function __environment_variables_general_setup() {
VARS[RSPAMD_GREYLISTING]="${RSPAMD_GREYLISTING:=0}"
VARS[RSPAMD_HFILTER]="${RSPAMD_HFILTER:=1}"
VARS[RSPAMD_HFILTER_HOSTNAME_UNKNOWN_SCORE]="${RSPAMD_HFILTER_HOSTNAME_UNKNOWN_SCORE:=6}"
VARS[RSPAMD_NEURAL]="${RSPAMD_NEURAL:=0}"
VARS[RSPAMD_LEARN]="${RSPAMD_LEARN:=0}"
VARS[SA_KILL]=${SA_KILL:="10.0"}
VARS[SPAM_SUBJECT]=${SPAM_SUBJECT:=}