]> git.immae.eu Git - perso/Immae/Config/Nix.git/commitdiff
Fix rspamc-dovecot deliver
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Mon, 11 Nov 2019 09:10:06 +0000 (10:10 +0100)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Mon, 11 Nov 2019 09:10:06 +0000 (10:10 +0100)
modules/private/mail/postfix.nix
overlays/environments/immae-eu.nix

index 1386f850a8ddf6fc2da738d75cf6722e2e7983f0..fcb0ce2305d82d522d32ab70e92ce86374f3053a 100644 (file)
             # its checks "per user" (milter is not yet dispatched to
             # users), so we wrap dovecot-lda inside rspamc per recipient
             # here.
-            dovecot_exe = "${pkgs.dovecot}/libexec/dovecot/dovecot-lda -f \${sender} -a \${original_recipient} -d \${user}@\${nexthop}";
+            rspamc_dovecot = pkgs.writeScriptBin "rspamc_dovecot" ''
+              #! ${pkgs.stdenv.shell}
+              sender="$1"
+              original_recipient="$2"
+              user="$3"
+
+              ${pkgs.coreutils}/bin/cat - | \
+                (${pkgs.rspamd}/bin/rspamc -h ${config.myServices.mail.rspamd.sockets.worker-controller} -c bayes -d "$user" --mime || true) | \
+                ${pkgs.dovecot}/libexec/dovecot/dovecot-lda -f "$sender" -a "$original_recipient" -d "$user"
+              '';
           in [
             "flags=DRhu" "user=vhost:vhost"
-            "argv=${pkgs.rspamd}/bin/rspamc -h ${config.myServices.mail.rspamd.sockets.worker-controller} -c bayes -d \${user}@\${nexthop} --mime --exec {${dovecot_exe}}"
+            "argv=${rspamc_dovecot}/bin/rspamc_dovecot \${sender} \${original_recipient} \${user}@\${nexthop}"
           ];
         };
       };
index cc2e5c3f33dd5dbd982b28edeb411c70ef812e61..8a985263c7a9d4f6e1514852d5474df683bd20f2 100644 (file)
@@ -33,6 +33,7 @@ let
     notmuch-python2 notmuch-python3 notmuch-vim
     neomutt mairix notmuch
     bogofilter fetchmail
+    sieve-connect
 
     # git
     vcsh gitRepo gitAndTools.stgit tig ripgrep