mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-08-03 17:44:49 +02:00
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:
parent
05fbcf6889
commit
45935f5fb8
7 changed files with 105 additions and 1 deletions
42
target/rspamd/local.d/neural.conf
Normal file
42
target/rspamd/local.d/neural.conf
Normal file
|
@ -0,0 +1,42 @@
|
|||
#https://github.com/rspamd/rspamd/issues/3099
|
||||
rules {
|
||||
"NEURAL_WEEK_1000" {
|
||||
train {
|
||||
max_trains = 1000;
|
||||
max_usages = 50;
|
||||
max_iterations = 25;
|
||||
learning_rate = 0.01,
|
||||
spam_score = 8;
|
||||
ham_score = -2;
|
||||
}
|
||||
symbol_spam = "NEURAL_WEEK_SPAM";
|
||||
symbol_ham = "NEURAL_WEEK_HAM";
|
||||
ann_expire = 300d;
|
||||
}
|
||||
"NEURAL_DAYS_200" {
|
||||
train {
|
||||
max_trains = 200;
|
||||
max_usages = 10;
|
||||
max_iterations = 25;
|
||||
learning_rate = 0.01,
|
||||
spam_score = 8;
|
||||
ham_score = -2;
|
||||
}
|
||||
symbol_spam = "NEURAL_DAYS_SPAM";
|
||||
symbol_ham = "NEURAL_DAYS_HAM";
|
||||
ann_expire = 100d;
|
||||
}
|
||||
"NEURAL_HALF_DAY_50" {
|
||||
train {
|
||||
max_trains = 50;
|
||||
max_usages = 4;
|
||||
max_iterations = 25;
|
||||
learning_rate = 0.01,
|
||||
spam_score = 8;
|
||||
ham_score = -2;
|
||||
}
|
||||
symbol_spam = "NEURAL_HALF_DAY_SPAM";
|
||||
symbol_ham = "NEURAL_HALF_DAY_HAM";
|
||||
ann_expire = 13d;
|
||||
}
|
||||
}
|
26
target/rspamd/local.d/neural_group.conf
Normal file
26
target/rspamd/local.d/neural_group.conf
Normal file
|
@ -0,0 +1,26 @@
|
|||
symbols = {
|
||||
"NEURAL_WEEK_SPAM" {
|
||||
weight = 3.0; # sample weight
|
||||
description = "Neural network spam (long)";
|
||||
}
|
||||
"NEURAL_WEEK_HAM" {
|
||||
weight = -3.0; # sample weight
|
||||
description = "Neural network ham (long)";
|
||||
}
|
||||
"NEURAL_DAYS_SPAM" {
|
||||
weight = 2.5; # sample weight
|
||||
description = "Neural network spam (medium)";
|
||||
}
|
||||
"NEURAL_DAYS_HAM" {
|
||||
weight = -1.5; # sample weight
|
||||
description = "Neural network ham (medium)";
|
||||
}
|
||||
"NEURAL_HALF_DAY_SPAM" {
|
||||
weight = 2.0; # sample weight
|
||||
description = "Neural network spam (short)";
|
||||
}
|
||||
"NEURAL_HALF_DAY_HAM" {
|
||||
weight = -1.0; # sample weight
|
||||
description = "Neural network ham (short)";
|
||||
}
|
||||
}
|
|
@ -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.
|
||||
#
|
||||
|
|
|
@ -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:=}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue