[Rspamd] Add local fuzzy worker

master
André 2018-07-29 00:34:36 +02:00
parent ff463168d1
commit d8f86ae488
5 changed files with 88 additions and 2 deletions

View File

@ -321,6 +321,29 @@ while ($row = array_shift($rows)) {
<?php <?php
} }
/*
// Start traps
*/
?>
traps {
<?php
foreach (ucl_rcpts('spam@localhost', 'mailbox') as $rcpt) {
?>
rcpt = <?=json_encode($rcpt, JSON_UNESCAPED_SLASHES);?>;
<?php
}
foreach (ucl_rcpts('ham@localhost', 'mailbox') as $rcpt) {
?>
rcpt = <?=json_encode($rcpt, JSON_UNESCAPED_SLASHES);?>;
<?php
}
?>
priority = 9;
want_spam = yes;
}
<?php
// Start additional content // Start additional content
$stmt = $pdo->query("SELECT `id`, `content` FROM `settingsmap` WHERE `active` = '1'"); $stmt = $pdo->query("SELECT `id`, `content` FROM `settingsmap` WHERE `active` = '1'");

View File

@ -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;
}
}
}

View File

@ -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;
}
}

View File

@ -1 +1,16 @@
# rspamd.conf.local # 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;
}

View File

@ -1,10 +1,10 @@
symbols = { symbols = {
"BAYES_SPAM" { "BAYES_SPAM" {
weight = 7.5; weight = 8.5;
description = "Message probably spam, probability: "; description = "Message probably spam, probability: ";
} }
"BAYES_HAM" { "BAYES_HAM" {
weight = -2.5; weight = -12.5;
description = "Message probably ham, probability: "; description = "Message probably ham, probability: ";
} }
} }