Wrap rspamc to avoid having to specific socket manually

This commit is contained in:
Sandro Jäckel 2024-08-05 19:00:00 +02:00
parent 059b50b2e7
commit af7d3bf5da
No known key found for this signature in database
GPG Key ID: 3AF5A43A3EECC2E5
2 changed files with 12 additions and 6 deletions

View File

@ -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
~~~~~~~~~~~~~~~~~~

View File

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