Make autolearning more aggressive (and functional) and enable fuzzy learning and using upstream fuzzy storage

This commit is contained in:
Alex D. 2021-02-14 01:32:38 +00:00
parent 6d53fd794a
commit 0dd8360b9f
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
6 changed files with 93 additions and 17 deletions

View File

@ -5,8 +5,8 @@ _configpath="/etc/rspamd/redxen"
. ../APKBUILD-config.common
pkgver=2021.02.11
pkgrel=0
pkgver=2021.02.14
pkgrel=2
_baseconf="
rspamd.conf
composites.conf
@ -16,10 +16,12 @@ _baseconf="
workers.conf
"
source="$_baseconf"
depends="rspamd-fuzzy"
_modules="
chartable
dkim
dmarc
fuzzy_check
greylist
maillist
milter_headers
@ -56,12 +58,13 @@ a753d136a21206cdc28a1554a38f51ad55e2eec842a31dbe1d151198bb8d9bb090e0f49b6b50cbc4
932c0dc5ae47ecc470c0a5eb684c5d24f95a75dec09e4ee3e191b0cfa274a4a9e343ed012afeb83d405df802792f9c5a3ad11c73bb933d40210c9e149314c12b milter_headers.conf
08966d0a3c077a12a1113f774e11d51d3c7d04bb45914e295324e8aa51c3d75b55395c256a905c6d9ae1e98a004a9e6b3b37d36fce810a426dd5d90408331c0a maillist.conf
8660fd01589476bbc01bbe75bed392faa55f55fa9b6fea77be79f339cefb43ddbacdbe193ad136c42da91d4ef7f1e1ec40fc5f8f4f398d04bcebf51d5a59ad1f greylist.conf
17fec11d41106909dfb7bd790ff12b4f546d2b1e6c06205ea48ecf2b82ce028710fd6ca636f414c0fe35dda99257c20eaed4d4ff90cdcc0a86d552f98cb26d15 fuzzy_check.conf
e14c3683b48dde5584cbcd0bd5811f6111a201635dd7400d7703003b4c98255d10be9b64ee81784c1fe1df50159e12d6777086c5a18ee9b14be852d233cf6dc5 dmarc.conf
ad3fa5e3c4c3d7b882c9e85bdde3b1949a32f2f2c9dd43e38977d828e7b6740d31002c502f24a0ea2e27105d5a6b1af7b7140c5d8e306f90c3f7d28c1e4607d5 dkim.conf
dcec5c53bd29c345ed5c47727af9a8d11328cc8f69ae61064ba3b053ee306baa79b747067097b2354a1fecd6e6527d56d14c79be22c94531f2a5ddc41ce3ca7e chartable.conf
855c34d265d91555c7946eb388d8f67f15b2bb450567aa67cf23ddcc2aaf52643cbeae674c66fcde0b0dd037fb4b56e1f4a2b9c0596b96fbe1cb29c03136961b rspamd.conf
1afa7428637e7f3a8c2906c5693d25259e1635540a049af3db12becce19d6ea97abf056f97d21e455a83b0a7a723a2aa2a1ea4c0d1f7a4072005a16306525636 rspamd.conf
667ec0331c811730e096e27f5e8659062239f46e3ccd148411984bb4d83b8770cc0d7d3c74dd5a2da71781e9b99d4bcb5a700cbd5f56ae8e17f7c4e50519ffb2 composites.conf
4ea651877607573126a731619801458798c1e8e4de3522462af4c71adc38141d09a0c75c2c83a33698e3c51095d0b7d364e1ceb3aa534a4157106370a7800e4a groups.conf
5f193596d1d9827b194a2ea4a9b06b729450ca7e77e8049ad9c53be99b5e28fc95fd69a2c4b639691bacd6aef099f8c69ee364f1ecd902f256f64c25ad9d3374 groups.conf
78df39cbc6e09cdc5e01d27e123d82aa677a70a6f5d59ba0be8d0ce6af012c5311e4a2527e4fbc586f9cdd8da033e9f05e2371970fa23db60eaa8c16c8e85f05 logging.conf
8ee629e299606e9effa4a55bd029a67d0682a6d5f86a652f5f98fabc915770ed6f3c32738dd38b88ccef2058084026f1ab9fcb48ff2709e6624e70a8bb7bfd15 statistic.conf
61a0da877f34aadb83ceece960e07aabf2312d7105c7574bec6f8bc9e7989bf28806159330e9d47850afa679a9d48b9101fd6b3ba04f0a614b0c66d95ccd6605 workers.conf"
84ee76d9e8cb3a945a0c29876ccad40e1f16399e711c4941f46f89f4c1a7cd80808ea4241da04921c4f916a13ee845e0711e63664ad8d94fdcbb6fb3e9354646 statistic.conf
3e662e1409b789ffdafa82949466f529f789ffafc4cdeb4cdf89068ba033b0ee736a94704edac75d8a9937abe065a23320cd87fd5f23acfdb68a22e871f8f7cb workers.conf"

View File

@ -286,22 +286,38 @@ group "statistics" {
group "fuzzy" {
symbols = {
"FUZZY_UNKNOWN" {
"RSPAMDCOM_FUZZY_UNKNOWN" {
weight = 5.0;
description = "Generic fuzzy hash match, bl.rspamd.com";
}
"FUZZY_DENIED" {
"RSPAMDCOM_FUZZY_DENIED" {
weight = 12.0;
description = "Denied fuzzy hash, bl.rspamd.com";
}
"FUZZY_PROB" {
"RSPAMDCOM_FUZZY_PROB" {
weight = 5.0;
description = "Probable fuzzy hash, bl.rspamd.com";
}
"FUZZY_WHITE" {
"RSPAMDCOM_FUZZY_WHITE" {
weight = -2.1;
description = "Whitelisted fuzzy hash, bl.rspamd.com";
}
"LOCAL_FUZZY_UNKNOWN" {
weight = 5.0;
description = "Generic fuzzy hash match, local";
}
"LOCAL_FUZZY_DENIED" {
weight = 12.0;
description = "Denied fuzzy hash, local";
}
"LOCAL_FUZZY_PROB" {
weight = 5.0;
description = "Probable fuzzy hash, local";
}
"LOCAL_FUZZY_WHITE" {
weight = -2.0;
description = "Whitelisted fuzzy hash, local";
}
}
}

View File

@ -0,0 +1,56 @@
fuzzy_check {
min_bytes = 1k; # Since small parts and small attachments causes too many FP
timeout = 2s;
retransmits = 1;
rule "rspamd.com" {
algorithm = "mumhash";
servers = "round-robin:fuzzy1.rspamd.com:11335,fuzzy2.rspamd.com:11335";
encryption_key = "icy63itbhhni8bq15ntp5n5symuixf73s1kpjh6skaq4e7nx5fiy";
symbol = "RSPAMDCOM_FUZZY_UNKNOWN";
mime_types = ["*"];
max_score = 20.0;
read_only = yes;
skip_unknown = yes;
short_text_direct_hash = true; # If less than min_length then use direct hash
min_length = 64; # Minimum words count to consider shingles
fuzzy_map = {
RSPAMDCOM_FUZZY_DENIED {
max_score = 20.0;
flag = 1;
}
RSPAMDCOM_FUZZY_PROB {
max_score = 10.0;
flag = 2;
}
RSPAMDCOM_FUZZY_WHITE {
max_score = 2.0;
flag = 3;
}
}
}
rule "local" {
algorithm = "mumhash";
servers = "localhost:7513";
symbol = "LOCAL_FUZZY_UNKNOWN";
mime_types = ["*"];
max_score = 20.0;
read_only = no;
skip_unknown = yes;
short_text_direct_hash = true; # If less than min_length then use direct hash
min_length = 64; # Minimum words count to consider shingles
fuzzy_map = {
LOCAL_FUZZY_DENIED {
max_score = 20.0;
flag = 1;
}
LOCAL_FUZZY_PROB {
max_score = 10.0;
flag = 2;
}
LOCAL_FUZZY_WHITE {
max_score = 2.0;
flag = 3;
}
}
}
}

View File

@ -1,6 +1,6 @@
options {
pidfile = "$RUNDIR/rspamd.pid";
filters = "chartable,dkim,dmarc,greylist,maillist,milter_headers,phishing,rbl,redis,spf,ratelimit,bayes_expiry,mx_check";
filters = "chartable,dkim,dmarc,greylist,maillist,milter_headers,phishing,rbl,redis,spf,ratelimit,bayes_expiry,mx_check,fuzzy_check";
raw_mode = false;
one_shot = false;
cache_file = "$DBDIR/symbols.cache";

View File

@ -19,8 +19,8 @@ classifier "bayes" {
spam = true;
}
autolearn {
spam_threshold = 10.0;
ham_threshold = -2.5;
spam_threshold = 7;
ham_threshold = 0;
check_balance = true;
min_balance = 0.9;
}

View File

@ -7,7 +7,7 @@ worker "normal" {
worker "controller" {
enabled = false;
count = -1;
bind_socket = "*:7512";
bind_socket = "localhost:7512";
}
worker "rspamd_proxy" {
@ -27,10 +27,11 @@ worker "rspamd_proxy" {
}
worker "fuzzy" {
enabled = false;
count = -1;
enabled = true;
count = 1;
bind_socket = "localhost:7513";
encrypted_only = false;
backend = "redis";
expire = 90d;
allow_update = [];
allow_update = ["127.0.0.1", "::1"];
}