From d8f86ae488c109900cdc6a093a3deaa48296b09d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= Date: Sun, 29 Jul 2018 00:34:36 +0200 Subject: [PATCH] [Rspamd] Add local fuzzy worker --- data/conf/rspamd/dynmaps/settings.php | 23 +++++++++++++ data/conf/rspamd/local.d/fuzzy_check.conf | 34 +++++++++++++++++++ data/conf/rspamd/local.d/fuzzy_group.conf | 14 ++++++++ data/conf/rspamd/local.d/rspamd.conf.local | 15 ++++++++ .../conf/rspamd/local.d/statistics_group.conf | 4 +-- 5 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 data/conf/rspamd/local.d/fuzzy_check.conf create mode 100644 data/conf/rspamd/local.d/fuzzy_group.conf diff --git a/data/conf/rspamd/dynmaps/settings.php b/data/conf/rspamd/dynmaps/settings.php index a1a515ec..5f83da81 100644 --- a/data/conf/rspamd/dynmaps/settings.php +++ b/data/conf/rspamd/dynmaps/settings.php @@ -321,6 +321,29 @@ while ($row = array_shift($rows)) { + traps { + + rcpt = ; + + rcpt = ; + + priority = 9; + want_spam = yes; + } + +query("SELECT `id`, `content` FROM `settingsmap` WHERE `active` = '1'"); diff --git a/data/conf/rspamd/local.d/fuzzy_check.conf b/data/conf/rspamd/local.d/fuzzy_check.conf new file mode 100644 index 00000000..9635adb9 --- /dev/null +++ b/data/conf/rspamd/local.d/fuzzy_check.conf @@ -0,0 +1,34 @@ +rule "local" { + # Fuzzy storage server list + servers = "localhost:11445"; + # Default symbol for unknown flags + symbol = "LOCAL_FUZZY_UNKNOWN"; + # Additional mime types to store/check + mime_types = ["application/*"]; + # Hash weight threshold for all maps + max_score = 20.0; + # Whether we can learn this storage + read_only = no; + # Ignore unknown flags + skip_unknown = yes; + # Hash generation algorithm + algorithm = "mumhash"; + + # Map flags to symbols + fuzzy_map = { + LOCAL_FUZZY_DENIED { + max_score = 20.0; + flag = 11; + } + LOCAL_FUZZY_PROB { + max_score = 10.0; + flag = 12; + } + LOCAL_FUZZY_WHITE { + max_score = 2.0; + flag = 13; + } + } +} + + diff --git a/data/conf/rspamd/local.d/fuzzy_group.conf b/data/conf/rspamd/local.d/fuzzy_group.conf new file mode 100644 index 00000000..abf6e6cf --- /dev/null +++ b/data/conf/rspamd/local.d/fuzzy_group.conf @@ -0,0 +1,14 @@ +symbols = { + "LOCAL_FUZZY_UNKNOWN" { + weight = 2.0; + } + "LOCAL_FUZZY_DENIED" { + weight = 12.0; + } + "LOCAL_FUZZY_PROB" { + weight = 5.0; + } + "LOCAL_FUZZY_WHITE" { + weight = -3.0; + } +} diff --git a/data/conf/rspamd/local.d/rspamd.conf.local b/data/conf/rspamd/local.d/rspamd.conf.local index 9f2f8f1d..0662c47d 100644 --- a/data/conf/rspamd/local.d/rspamd.conf.local +++ b/data/conf/rspamd/local.d/rspamd.conf.local @@ -1 +1,16 @@ # rspamd.conf.local + +worker "fuzzy" { + # Socket to listen on (UDP and TCP from rspamd 1.3) + bind_socket = "*:11445"; + allow_update = ["127.0.0.1", "::1"]; + # Number of processes to serve this storage (useful for read scaling) + count = 2; + # Backend ("sqlite" or "redis" - default "sqlite") + backend = "redis"; + # Hashes storage time (3 months) + expire = 90d; + # Synchronize updates to the storage each minute + sync = 1min; +} + diff --git a/data/conf/rspamd/local.d/statistics_group.conf b/data/conf/rspamd/local.d/statistics_group.conf index 74e84421..160c65fa 100644 --- a/data/conf/rspamd/local.d/statistics_group.conf +++ b/data/conf/rspamd/local.d/statistics_group.conf @@ -1,10 +1,10 @@ symbols = { "BAYES_SPAM" { - weight = 7.5; + weight = 8.5; description = "Message probably spam, probability: "; } "BAYES_HAM" { - weight = -2.5; + weight = -12.5; description = "Message probably ham, probability: "; } }