18 lines
379 B
Bash
Executable File
18 lines
379 B
Bash
Executable File
#!/bin/sh
|
|
|
|
logf='/var/log/nginx/access.log'
|
|
cache='/tmp/forumspam_cache'
|
|
|
|
test -f $cache || install -m 600 /dev/null $cache
|
|
|
|
tail -F $logf | while read line ; do
|
|
case $line in (*"POST"*)
|
|
ip=`echo $line | awk '{print $1}'`
|
|
ip_regex=`echo $ip | sed 's/\./\\./g'`
|
|
if ! grep -q $ip_regex $cache; then
|
|
echo $ip >> $cache
|
|
/usr/local/bin/forumspam.sh "$ip"
|
|
fi
|
|
esac
|
|
done
|