mailcow dockerized
This commit is contained in:
19
data/conf/rspamd/local.d/dkim.conf
Normal file
19
data/conf/rspamd/local.d/dkim.conf
Normal file
@@ -0,0 +1,19 @@
|
||||
sign_condition =<<EOD
|
||||
return function(task)
|
||||
local from = task:get_from('smtp')
|
||||
if from and from[1]['addr'] then
|
||||
lastAtSymbol = from[1]['addr']:find("[^%@]+$")
|
||||
local domain = from[1]['addr']:sub(lastAtSymbol, #from[1]['addr'])
|
||||
local keyfile = io.open("/etc/rspamd/dkim/keys/" .. domain .. ".default")
|
||||
if keyfile then
|
||||
keyfile:close()
|
||||
return {
|
||||
key = "/etc/rspamd/dkim/keys/" .. domain .. ".default",
|
||||
domain = domain,
|
||||
selector = "default"
|
||||
}
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
EOD;
|
14
data/conf/rspamd/local.d/metrics.conf
Normal file
14
data/conf/rspamd/local.d/metrics.conf
Normal file
@@ -0,0 +1,14 @@
|
||||
symbol "MAILCOW_AUTH" {
|
||||
description = "mailcow authenticated";
|
||||
score = -20.0;
|
||||
}
|
||||
group "bayes" {
|
||||
symbol "BAYES_SPAM" {
|
||||
weight = 7.5;
|
||||
description = "Message probably spam, probability: ";
|
||||
}
|
||||
symbol "BAYES_HAM" {
|
||||
weight = -2.5;
|
||||
description = "Message probably ham, probability: ";
|
||||
}
|
||||
}
|
1
data/conf/rspamd/local.d/redis.conf
Normal file
1
data/conf/rspamd/local.d/redis.conf
Normal file
@@ -0,0 +1 @@
|
||||
servers = "redis:6379";
|
59
data/conf/rspamd/local.d/statistic.conf
Normal file
59
data/conf/rspamd/local.d/statistic.conf
Normal file
@@ -0,0 +1,59 @@
|
||||
classifier "bayes" {
|
||||
tokenizer {
|
||||
name = "osb";
|
||||
}
|
||||
|
||||
backend = "redis";
|
||||
servers = "redis:6379";
|
||||
min_tokens = 11;
|
||||
min_learns = 200;
|
||||
autolearn = true;
|
||||
|
||||
per_user = <<EOD
|
||||
return function(task)
|
||||
local rcpt = task:get_recipients(1)
|
||||
|
||||
if rcpt then
|
||||
one_rcpt = rcpt[1]
|
||||
if one_rcpt['domain'] then
|
||||
return one_rcpt['domain']
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
EOD
|
||||
|
||||
statfile {
|
||||
symbol = "BAYES_HAM";
|
||||
spam = false;
|
||||
}
|
||||
statfile {
|
||||
symbol = "BAYES_SPAM";
|
||||
spam = true;
|
||||
}
|
||||
learn_condition =<<EOD
|
||||
return function(task, is_spam, is_unlearn)
|
||||
local prob = task:get_mempool():get_variable('bayes_prob', 'double')
|
||||
|
||||
if prob then
|
||||
local in_class = false
|
||||
local cl
|
||||
if is_spam then
|
||||
cl = 'spam'
|
||||
in_class = prob >= 0.95
|
||||
else
|
||||
cl = 'ham'
|
||||
in_class = prob <= 0.05
|
||||
end
|
||||
|
||||
if in_class then
|
||||
return false,string.format('already in class %s; probability %.2f%%',
|
||||
cl, math.abs((prob - 0.5) * 200.0))
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
EOD
|
||||
}
|
9
data/conf/rspamd/lua/rspamd.local.lua
Normal file
9
data/conf/rspamd/lua/rspamd.local.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
rspamd_config.MAILCOW_AUTH = {
|
||||
callback = function(task)
|
||||
local uname = task:get_user()
|
||||
if uname then
|
||||
return 1
|
||||
end
|
||||
end
|
||||
}
|
||||
|
3
data/conf/rspamd/override.d/logging.inc
Normal file
3
data/conf/rspamd/override.d/logging.inc
Normal file
@@ -0,0 +1,3 @@
|
||||
type = "console";
|
||||
systemd = false;
|
||||
.include "$CONFDIR/logging.inc"
|
2
data/conf/rspamd/override.d/worker-controller.inc
Normal file
2
data/conf/rspamd/override.d/worker-controller.inc
Normal file
@@ -0,0 +1,2 @@
|
||||
bind_socket = "*:11334";
|
||||
enable_password ="$2$ibe1yt89kq5rtb9juy8z7cmkt1yg5d9w$bezuyyo8o4kge13rzj8epasdf6ojsgo1jgojce8msbt5bsq9n3dy";
|
1
data/conf/rspamd/override.d/worker-normal.inc
Normal file
1
data/conf/rspamd/override.d/worker-normal.inc
Normal file
@@ -0,0 +1 @@
|
||||
bind_socket = "*:11333";
|
Reference in New Issue
Block a user