- 先启用fuzzy,默认是禁用的
# rspamd.conf
worker "fuzzy" {
bind_socket = "localhost:11335";
#count = 1; # Disable by default # 注释这行,启用fuzzy
.include "$CONFDIR/worker-fuzzy.inc"
.include(try=true; priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/worker-fuzzy.inc"
.include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/worker-fuzzy.inc"
}
- 默认是保存到sqlite,改成redis
# worker-fuzzy.inc
backend = "redis";
servers = "127.0.0.1:6379";
password = "myredispass";
db = "1";
- 设置本地规则,参考原来rspamd.com规则修改servers、symbol等配置
# modules.d/fuzzy_check.conf
rule "local" {
algorithm = "mumhash";
servers = "127.0.0.1:11335";
symbol = "FUZZY_UNKNOWN_LOCAL";
mime_types = ["*"];
max_score = 20.0;
read_only = yes;
skip_unknown = yes;
short_text_direct_hash = true;
fuzzy_map = {
FUZZY_DENIED_LOCAL {
max_score = 20.0;
flag = 1;
}
FUZZY_PROB_LOCAL {
max_score = 10.0;
flag = 2;
}
FUZZY_WHITE_LOCAL {
max_score = 2.0;
flag = 3;
}
}
}
- 重启rspamd查看stat
[root@webmail rspamd]# rspamc stat
Results for command: stat (0.318 seconds)
Messages scanned: 100
Messages with action reject: 59, 59.00%
Messages with action soft reject: 0, 0.00%
Messages with action rewrite subject: 0, 0.00%
Messages with action add header: 0, 0.00%
Messages with action greylist: 2, 2.00%
Messages with action no action: 39, 39.00%
Messages treated as spam: 59, 59.00%
Messages treated as ham: 41, 41.00%
Messages learned: 0
Connections count: 0
Control connections count: 0
Pools allocated: 28
Pools freed: 0
Bytes allocated: 18.74M
Memory chunks allocated: 138
Shared chunks allocated: 17
Chunks freed: 0
Oversized chunks: 1
Fuzzy hashes in storage "local": 0
Fuzzy hashes in storage "rspamd.com": 307127975
Fuzzy hashes stored: 307127975
Statfile: BAYES_SPAM type: redis; length: 0; free blocks: 0; total blocks: 0; free: 0.00%; learned: 0; users: 0; languages: 0
Statfile: BAYES_HAM type: redis; length: 0; free blocks: 0; total blocks: 0; free: 0.00%; learned: 0; users: 0; languages: 0
Total learns: 0
已经正常配置。