From 9145f9d3b8c8661c5164fe227426d6f3308c1702 Mon Sep 17 00:00:00 2001 From: Marius Burkard Date: Wed, 12 Dec 2018 15:09:41 +0100 Subject: [PATCH] - added rspamd neural network config --- install/lib/installer_base.lib.php | 12 ++++++++ install/tpl/rspamd_neural.conf.master | 31 +++++++++++++++++++++ install/tpl/rspamd_neural_group.conf.master | 18 ++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 install/tpl/rspamd_neural.conf.master create mode 100644 install/tpl/rspamd_neural_group.conf.master diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php index 70e5bbf10b..57df2702e8 100644 --- a/install/lib/installer_base.lib.php +++ b/install/lib/installer_base.lib.php @@ -1337,6 +1337,18 @@ class installer_base { exec('cp tpl/rspamd_options.inc.master /etc/rspamd/local.d/options.inc'); } + if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_neural.conf.master')) { + exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_neural.conf.master /etc/rspamd/local.d/neural.conf'); + } else { + exec('cp tpl/rspamd_neural.conf.master /etc/rspamd/local.d/neural.conf'); + } + + if(file_exists($conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_neural_group.conf.master')) { + exec('cp '.$conf['ispconfig_install_dir'].'/server/conf-custom/install/rspamd_neural_group.conf.master /etc/rspamd/local.d/neural_group.conf'); + } else { + exec('cp tpl/rspamd_neural_group.conf.master /etc/rspamd/local.d/neural_group.conf'); + } + exec('chmod a+r /etc/rspamd/local.d/* /etc/rspamd/override.d/*'); $tpl = new tpl(); diff --git a/install/tpl/rspamd_neural.conf.master b/install/tpl/rspamd_neural.conf.master new file mode 100644 index 0000000000..64b0fa8716 --- /dev/null +++ b/install/tpl/rspamd_neural.conf.master @@ -0,0 +1,31 @@ +servers = 127.0.0.1:6379; +enabled = true; + +rules { + "LONG" { + train { + max_trains = 5000; + max_usages = 200; + max_iterations = 25; + learning_rate = 0.01, + spam_score = 8; + ham_score = -2; + } + symbol_spam = "NEURAL_SPAM_LONG"; + symbol_ham = "NEURAL_HAM_LONG"; + ann_expire = 100d; + } + "SHORT" { + train { + max_trains = 100; + max_usages = 2; + max_iterations = 25; + learning_rate = 0.01, + spam_score = 8; + ham_score = -2; + } + symbol_spam = "NEURAL_SPAM_SHORT"; + symbol_ham = "NEURAL_HAM_SHORT"; + ann_expire = 1d; + } +} \ No newline at end of file diff --git a/install/tpl/rspamd_neural_group.conf.master b/install/tpl/rspamd_neural_group.conf.master new file mode 100644 index 0000000000..c4f59c52e5 --- /dev/null +++ b/install/tpl/rspamd_neural_group.conf.master @@ -0,0 +1,18 @@ +symbols = { + "NEURAL_SPAM_LONG" { + weight = 3.0; # sample weight + description = "Neural network spam (long)"; + } + "NEURAL_HAM_LONG" { + weight = -3.0; # sample weight + description = "Neural network ham (long)"; + } + "NEURAL_SPAM_SHORT" { + weight = 2.0; # sample weight + description = "Neural network spam (short)"; + } + "NEURAL_HAM_SHORT" { + weight = -1.0; # sample weight + description = "Neural network ham (short)"; + } +} -- GitLab