From 4eaf5b38c89169584cb3910dca35cfab427194b5 Mon Sep 17 00:00:00 2001 From: Alberto Bertogli Date: Thu, 8 Jul 2021 10:18:56 +0100 Subject: [PATCH] hooks: Use chasquid-rspamd if available The chasquid-rspamd utility (https://github.com/Thor77/chasquid-rspamd) provides a better integration with rspamd, by taking envelope and connection information from the environment variables, and communicating with rspamd using its protocol. So if it is available, use it instead of rspamc in the default hook. --- etc/chasquid/hooks/post-data | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/etc/chasquid/hooks/post-data b/etc/chasquid/hooks/post-data index ef23de6..6f4fee5 100755 --- a/etc/chasquid/hooks/post-data +++ b/etc/chasquid/hooks/post-data @@ -5,7 +5,7 @@ # # - greylist (from greylistd) to do greylisting. # - spamc (from Spamassassin) to filter spam. -# - rspamc (from rspamd) to filter spam. +# - rspamc (from rspamd) or chasquid-rspamd to filter spam. # - clamdscan (from ClamAV) to filter virus. # - dkimsign (from driusan/dkim) to do DKIM signing. # @@ -47,7 +47,13 @@ if command -v spamc >/dev/null; then fi -if command -v rspamc >/dev/null; then +# Spam filter through rspamd. +# +# Use chasquid-rspamd (from https://github.com/Thor77/chasquid-rspamd) if +# available, otherwise fall back to rspamc. +if command -v chasquid-rspamd >/dev/null; then + chasquid-rspamd < "$TF" 2>/dev/null +elif command -v rspamc >/dev/null; then # Note the actions emitted by rspamc come from the thresholds # configured in /etc/rspamd/actions.conf. # The ones handled here are common defaults, but they might require