summaryrefslogtreecommitdiffstats
path: root/mail-server
diff options
context:
space:
mode:
authorSymphorien Gibol <symphorien+git@xlumurb.eu>2020-04-03 12:00:00 +0000
committerlewo <lewo@abesis.fr>2020-05-05 19:07:46 +0000
commit9e772d166cb5b9654899e3d70d3006a494fb09b0 (patch)
treef4941fda7e37ca6a9f98b22f3bcaf6c5692dca69 /mail-server
parentac0f5c118f9a92edf30e8a1d899e17f78a8c1858 (diff)
rspamd: configure redis backend
The sqlite backed is deprecated, and the redis backend is the default since rspamd 2.0. Not having redis started results in such errors: rspamd_redis_init: cannot init redis backend for BAYES_SPAM To migrate the sqlite database, run rspamadm statconvert --spam-db /var/lib/rspamd/bayes.spam.sqlite --ham-db /var/lib/rspamd/bayes.ham.sqlite -h 127.0.0.1:6379 --symbol-ham BAYES_HAM --symbol-spam BAYES_SPAM The current module implements the recommended configuration that this utility prints out.
Diffstat (limited to 'mail-server')
-rw-r--r--mail-server/rspamd.nix17
1 files changed, 15 insertions, 2 deletions
diff --git a/mail-server/rspamd.nix b/mail-server/rspamd.nix
index b46b7de..f5a2d20 100644
--- a/mail-server/rspamd.nix
+++ b/mail-server/rspamd.nix
@@ -32,6 +32,16 @@ in
"milter_headers.conf" = { text = ''
extended_spam_headers = yes;
''; };
+ "redis.conf" = { text = ''
+ servers = "${cfg.redis.address}:${toString cfg.redis.port}";
+ '' + (lib.optionalString (cfg.redis.password != null) ''
+ password = "${cfg.redis.password}";
+ ''); };
+ "classifier-bayes.conf" = { text = ''
+ cache {
+ backend = "redis";
+ }
+ ''; };
"antivirus.conf" = lib.mkIf cfg.virusScanning { text = ''
clamav {
action = "reject";
@@ -80,9 +90,12 @@ in
};
};
+
+ services.redis.enable = true;
+
systemd.services.rspamd = {
- requires = (lib.optional cfg.virusScanning "clamav-daemon.service");
- after = (lib.optional cfg.virusScanning "clamav-daemon.service");
+ requires = [ "redis.service" ] ++ (lib.optional cfg.virusScanning "clamav-daemon.service");
+ after = [ "redis.service" ] ++ (lib.optional cfg.virusScanning "clamav-daemon.service");
};
systemd.services.postfix = {