mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-18 14:47:03 +00:00
hooks: Add rspamd integration to the example hook
Rspamd (https://rspamd.com/) is a popular open-source spam filtering system. This patch adds integration with it in the example hook, which uses the rspamc client to get a veredict, similar to what it does for Spamassassin.
This commit is contained in:
@@ -93,7 +93,7 @@ The hook should be at `/etc/chasquid/hooks/post-data`.
|
|||||||
The one installed by default is a bash script supporting:
|
The one installed by default is a bash script supporting:
|
||||||
|
|
||||||
* greylisting using greylistd.
|
* greylisting using greylistd.
|
||||||
* anti-spam using spamassassin.
|
* anti-spam using spamassassin or rspamd.
|
||||||
* anti-virus using clamav.
|
* anti-virus using clamav.
|
||||||
|
|
||||||
To use them, they just need to be available in your system.
|
To use them, they just need to be available in your system.
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#
|
#
|
||||||
# - greylist (from greylistd) to do greylisting.
|
# - greylist (from greylistd) to do greylisting.
|
||||||
# - spamc (from Spamassassin) to filter spam.
|
# - spamc (from Spamassassin) to filter spam.
|
||||||
|
# - rspamc (from rspamd) to filter spam.
|
||||||
# - clamdscan (from ClamAV) to filter virus.
|
# - clamdscan (from ClamAV) to filter virus.
|
||||||
# - dkimsign (from driusan/dkim) to do DKIM signing.
|
# - dkimsign (from driusan/dkim) to do DKIM signing.
|
||||||
#
|
#
|
||||||
@@ -46,6 +47,22 @@ if command -v spamc >/dev/null; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if command -v rspamc >/dev/null; then
|
||||||
|
ACTION=$( rspamc < "$TF" 2>/dev/null | grep Action: | cut -d " " -f 2- )
|
||||||
|
case "$ACTION" in
|
||||||
|
greylist)
|
||||||
|
echo "greylisted, please try again"
|
||||||
|
exit 75 # temporary error
|
||||||
|
;;
|
||||||
|
reject)
|
||||||
|
echo "spam detected"
|
||||||
|
exit 20 # permanent error
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
echo "X-Spam-Action:" "$ACTION"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
if command -v clamdscan >/dev/null; then
|
if command -v clamdscan >/dev/null; then
|
||||||
if ! clamdscan --no-summary --infected - < "$TF" 1>&2 ; then
|
if ! clamdscan --no-summary --infected - < "$TF" 1>&2 ; then
|
||||||
echo "virus detected"
|
echo "virus detected"
|
||||||
|
|||||||
Reference in New Issue
Block a user