summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSandro Jäckel <sandro.jaeckel@gmail.com>2024-08-05 19:00:00 +0200
committerSandro Jäckel <sandro.jaeckel@gmail.com>2024-08-05 19:00:00 +0200
commitaf7d3bf5daeba3fc28089b015c0dd43f06b176f2 (patch)
tree3c14b1293ed6dea66ed3e2d2f83d85eb6b668f66
parent059b50b2e729729ea00c6831124d3837c494f3d5 (diff)
Wrap rspamc to avoid having to specific socket manuallyHEADmaster
-rw-r--r--docs/rspamd-tuning.rst9
-rw-r--r--mail-server/rspamd.nix9
2 files changed, 12 insertions, 6 deletions
diff --git a/docs/rspamd-tuning.rst b/docs/rspamd-tuning.rst
index 049858d..3ba8133 100644
--- a/docs/rspamd-tuning.rst
+++ b/docs/rspamd-tuning.rst
@@ -24,17 +24,14 @@ You can run the training in a root shell as follows:
.. code:: bash
- # Path to the controller socket
- export RSOCK="/var/run/rspamd/worker-controller.sock"
-
# Learn the Junk folder as spam
- rspamc -h $RSOCK learn_spam /var/vmail/$DOMAIN/$USER/.Junk/cur/
+ rspamc learn_spam /var/vmail/$DOMAIN/$USER/.Junk/cur/
# Learn the INBOX as ham
- rspamc -h $RSOCK learn_ham /var/vmail/$DOMAIN/$USER/cur/
+ rspamc learn_ham /var/vmail/$DOMAIN/$USER/cur/
# Check that training was successful
- rspamc -h $RSOCK stat | grep learned
+ rspamc stat | grep learned
Tune symbol weight
~~~~~~~~~~~~~~~~~~
diff --git a/mail-server/rspamd.nix b/mail-server/rspamd.nix
index ee1b8a5..8fb9b00 100644
--- a/mail-server/rspamd.nix
+++ b/mail-server/rspamd.nix
@@ -25,6 +25,15 @@ let
in
{
config = with cfg; lib.mkIf enable {
+ environment.systemPackages = lib.mkBefore [
+ (pkgs.runCommand "rspamc-wrapped" {
+ nativeBuildInputs = with pkgs; [ makeWrapper ];
+ }''
+ makeWrapper ${pkgs.rspamd}/bin/rspamc $out/bin/rspamc \
+ --add-flags "-h /var/run/rspamd/worker-controller.sock"
+ '')
+ ];
+
services.rspamd = {
enable = true;
inherit debug;