Created
September 25, 2015 16:43
-
-
Save rushipkar90/44db0eb8b785451f8bde to your computer and use it in GitHub Desktop.
spam_sender_block.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Bronco May 2014 | |
# | |
CONF=/etc/exim.conf.local | |
CHANGE=0 | |
main() { | |
if [ -n "$(diff $CONF /tmp/exim.conf.local)" ] && [ -f "/tmp/exim.conf.local" ]; then | |
echo "Replacing the config..." | |
mv $CONF /home/bronco/exim.conf.local.$(date +%s) | |
mv /tmp/exim.conf.local $CONF | |
for F in /etc/deny_senders; do | |
touch $F;chown root:mail $F;chmod 640 $F | |
done | |
/scripts/buildeximconf && /etc/init.d/exim restart && echo "DONE" | |
else | |
echo "Latest file used" | |
fi | |
for U in $(cat /etc/deny_senders); do exiqgrep -r | grep "<"$U">" | awk '{print $3}' | sed '/^$/d' | xargs exim -Mf; exiqgrep -z -i | xargs exim -Mrm; done | |
} | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment