Script pour supprimer facilement du spam sur les MLs lists.crans.org

This commit is contained in:
Vincent Le Gallic 2014-11-11 23:15:46 +01:00
parent cb54cbeeca
commit be1ece3beb

34
mailman/discard_from_domain.sh Executable file
View file

@ -0,0 +1,34 @@
#!/bin/bash
# Pour dropper les spams en provenance d'un domaine identifié
# sur toutes les MLs
if [ "$(hostname)" != "redisdead" ]
then
echo "À exécuter sur redisdead."
exit 1
fi
if [ "$1" = "" ]
then
echo -e "Usage : discard_from_domain.sh domain.tld\n"
echo "Droppe les mails en provenance de domain.tld sur toutes les MLs (demande confirmation)"
exit -1
fi
echo "Recherche…"
targets=$(grep -lRi "$1" /var/lib/mailman/data/heldmsg*)
echo "${targets}"
echo -n "Exterminate ? [y/N] "
read -r ans
case ${ans} in
y|Y|o|O)
echo "${targets}" | xargs /var/lib/mailman/bin/discard
;;
*)
echo "Aborting"
esac