Compare commits

..

No commits in common. "19ddf883ee7c63db26d817a3c24a837ab4e21f74" and "df0f552ef290b6d5f1ad51d1fa4fd348c4950c62" have entirely different histories.

2 changed files with 3 additions and 7 deletions

View File

@ -16,7 +16,7 @@ To deploy:
3. Create the user the scripts will run as:
useradd -s $(which nologin) _forumspam
useradd -s /sbin/nologin _forumspam
4. Set up the firewall program

View File

@ -2,18 +2,14 @@
logf='/var/log/nginx/access.log'
cache='/tmp/forumspam_cache'
case `uname` in
(*"BSD"*) tail_opts='-f';;
(*) tail_opts='-F';;
esac
tail_opts='-F' # set to `-f` on OpenBSD!
test -f $cache || install -m 600 /dev/null $cache
tail $tail_opts $logf | while read line ; do
case $line in (*"POST"*)
ip=`echo $line | awk '{print $1}'`
ip_regex=`echo $ip | sed 's/\./\\./g; s/^/^/; s/$/$/'`
ip_regex=`echo $ip | sed 's/\./\\./g'`
if ! grep -q $ip_regex $cache; then
/usr/local/bin/forumspam.sh "$ip" && echo $ip >> $cache
fi