• wp-spamfree comments log 403 forbidden fix

    My wordpress blog has wp-spamfree installed and protecting me from spam comments.

    It does a great job and I heartily recommend it.

    One of the features is a log file with the contents of any spam comments so you can check for false positives or to see just how much spam your blog is being protected from.
    The log file defaults to [yourserver]/wp-content/plugins/wp-spamfree/data/temp-comments-log.txt

    I tried to read mine but I got a 403 forbidden error and couldn’t figure out why, I had a standard install.

    I tracked it down to the .htaccess file in /wp-content/plugins/wp-spamfree/data/ which has[code]SetEnvIfNoCase Referer http://labby\.co\.uk/wordpress/wp-admin/ wpsf_access
    SetEnvIf Remote_Addr ^my.ip.address$ wpsf_access


    order deny,allow
    deny from all
    allow from env=wpsf_access
    [/code]Insert the line with my.ip.address above and add your own IP address, save and you should be up and running.



    The following is unaffiliated with labby.co.uk
    • AIM
    • Bebo
    • Delicious
    • Digg
    • Blogger Post
    • BlogMarks
    • Facebook
    • Google Bookmarks
    • Google Buzz
    • Google Gmail
    • Hotmail
    • Identi.ca
    • LiveJournal
    • Linkatopia
    • MySpace
    • Slashdot
    • Shoutwire
    • Sphere
    • StumbleUpon
    • Technorati Favorites
    • TechNet
    • Twitter
    • TypePad Post
    • Webnews
    • Yahoo Bookmarks
    • WordPress
    • Yahoo Buzz
    • Yahoo Mail
    • Yahoo Messenger
    • Share/Bookmark

    Related Posts:

     
  • Apache server logs “GET /w00tw00t.isc.sans.dfind:)” fix

    Seen “GET /w00tw00t.isc.sans.dfind:)” 400 in your server logs?

    This is a vulnerability scan.

    Tired of the little wannabe 1337 teens trying to hack your server?

    Try this little script I wrote to ban them as soon as they try:

    I linked logfunctions in /etc/init.d and ran
    update-rc.d defaults
    to start at bootup

    I put ban in /usr/local/bin
    file logfunctions

    #!/bin/bash
    #
    #This script is a wrapper for a number of other scripts contained inside it.
    #
    #Usage: $0 scriptname [parameters]
    #Allowed scriptnames [parameters]:
    # ban [ip] [text]
    # checkiptables
    # mailovh
    # w00t [stop]

    #error $? returned:
    # 0 no errors
    # 1 no scriptname passed
    # 2 invalid scriptname passed
    # 10 or higher:
    # first value denotes executed script, last number denotes return value
    # example: 17: script 1, return value 7
    # example: 32: script 3, return value 2
    # values higher than 99:
    # example: 154: script 15, return value 4
    # 10: ban: no errors
    # 11: ban: no IP passed
    # 12: ban: whitelisted IP passed
    # 13: ban: localhost|127.0.0.1 passed
    # 14: ban: new IP found to ban
    # 17: ban: IP is already banned
    # 20: checkiptables: no errors
    # 21: checkiptables: unable to delete $OUTFILE
    # 22: checkiptables: IPs are still being banned
    # 23: checkiptables: no IPs are being banned
    # 40: w00t: no errors
    # 41: w00t: shutdown running process
    #100+: exited out of case without exiting the script - unhandled exit, remove 100 to get the actual code

    #systemwide variables:
    BANLENGTH="1 week"
    BANEND=`date +%s --date="$BANLENGTH"`
    D=`date`
    DS=`date +%s`
    DT=`date +%T`
    OVHALL="/var/log/ovh_all.log"
    OVHLOG="/var/log/ovh.log"
    WWWBANNEDIPS="/var/www/bannedips.txt"
    CURRENTBANNEDIPS="/etc/banlist"
    OUTFILE="$CURRENTBANNEDIPS"+".tmp"
    MONITOR="/var/log/apache2/access.log" #inside the "" add any files you wish to monitor eg /var/log/syslog

    WATCHARRAY=(
    "//skin/ggambo6200_board/error\.php?"
    "\"GET //[Pp]hp[Mm]y[Aa]dmin//scripts/setup\.php HTTP/1\.1\""
    "\"GET //pma/"
    "\"GET /pma/"
    "\"GET /w00t.* HTTP/1\.1\" 400 [0-9]* \".*\" \".*\""
    "Toata dragostea mea pentru diavola"
    )
    WATCHLIST=${WATCHARRAY[0]}
    for element in $(seq 1 $((${#WATCHARRAY[@]} - 1))); do
    if [ "$element" != "" ]; then
    WATCHLIST="$WATCHLIST|${WATCHARRAY[$element]}"
    fi
    done

    WOOTLOCK="/var/lock/w00t.lock"
    SERVERIP="example.com (127.0.0.1)" #insert your server name and IP here
    FROMMAIL="exploits@example.com (example.com monitor)" # insert your email address here
    WHITELIST="127.0.0.1" # insert a list of whitelisted (non-bannable) IPs here, separated by ' '

    #program paths, change toi suit your individual system
    GREP="/bin/egrep" # egrep must be egrep, not grep
    CAT="/bin/cat"
    WHOIS="/usr/bin/whois"
    ECHO="/bin/echo"
    IPTABLES="/sbin/iptables"
    WC="/usr/bin/wc"
    AWK="/usr/bin/awk"
    CUT="/usr/bin/cut"
    CP="/bin/cp"
    RM="/bin/rm"
    MV="/bin/mv"
    TAIL="/usr/bin/tail"
    PS="/bin/ps"
    SENDMAIL="/usr/sbin/sendmail"
    KILL="/bin/kill"

    #Main script start
    if [ "$#" -lt 1 ]; then
    #no scriptname passed
    $ECHO "$0 scriptname [parameters]"
    RETVAL=1
    exit $RETVAL
    fi

    case "$1" in
    'ban')
    RETVAL=10
    if [ "$2" == "" ]; then
    $ECHO $0 $1 IP
    $ECHO eg: $0 $1 11.22.33.44
    let RETVAL+=1
    exit $RETVAL
    fi
    IP=$2
    LINE=$3
    #echo "BANCHECK $# 1:$1 2:$IP 3:$3"

    if [ "`$ECHO $WHITELIST | $GREP $IP | $WC -l`" -ne 0 ]; then
    let RETVAL+=2
    exit $RETVAL
    fi
    if [[ "$IP" == "127.0.0.1" || "$IP" == "localhost" ]]; then
    let RETVAL+=3
    exit $RETVAL
    fi

    if [ "`$GREP "$IP" $CURRENTBANNEDIPS | $WC -l`" == "0" ]; then
    $ECHO -ne "\n$DT:IP \"$IP\" not found, banning IP \"$IP\" for $BANLENGTH\n"
    $ECHO "$BANEND $IP" >> $CURRENTBANNEDIPS
    $IPTABLES -A INPUT -s $IP -j DROP
    $ECHO $BANEND $IP $LINE >> $WWWBANNEDIPS
    let RETVAL+=4
    else
    let RETVAL+=7
    $ECHO -ne "D"
    fi
    exit $RETVAL
    ;;
    'checkiptables')
    RETVAL=20
    if [ -e $OUTFILE ]; then
    rm $OUTFILE
    if [ -e $OUTFILE ]; then
    let RETVAL+=1
    exit $RETVAL
    fi
    fi

    if [ -f $CURRENTBANNEDIPS ]; then
    DH=$(( $DS-3600 ))
    $CAT $CURRENTBANNEDIPS | while read line; do
    DA=`$ECHO $line | $AWK '{ print $1 }'`
    DAO=$(( $DA-604800 ))

    IP=`$ECHO $line | $CUT -f2- -d' '`
    $ECHO "Checking $IP"
    $IPTABLES -D INPUT -s "$IP" -j DROP
    $ECHO `date -d "1970-01-01 $DAO sec"`

    if [ $DS -ge $DA ]; then
    # delete rule
    $ECHO "IP $IP released from iptables drop"
    else
    if [ $DAO -gt $DH ]; then
    $ECHO "New IP $IP added in the last hour"
    else
    $ECHO "IP $IP remains banned from this server"
    fi
    # ban ip
    $ECHO $line>>$OUTFILE
    $IPTABLES -A INPUT -s "$IP" -j DROP
    fi
    done
    if [ -e "$OUTFILE" ]; then
    $MV -f "$OUTFILE" "$CURRENTBANNEDIPS"
    let RETVAL+=2
    else
    $RM "$CURRENTBANNEDIPS"
    let RETVAL+=3
    fi
    fi

    exit $RETVAL
    ;;
    'w00t')
    RETVAL=40
    if [ -e "$WOOTLOCK" ]; then
    #w00t may already be running, terminate process
    ls "$WOOTLOCK"
    line=`$CAT "$WOOTLOCK"`

    if [ "$line" != "" ]; then
    $KILL -9 "$line" >> /dev/nul
    $RM $WOOTLOCK
    fi
    fi
    if [ "$2" == "stop" ]; then
    let RETVAL+=1
    exit $RETVAL
    fi
    PID=0
    $TAIL -n +1 -f "$MONITOR" | $GREP --line-buffered "$WATCHLIST" | while read line; do
    IP=$( $ECHO $line | $AWK '{ print $1 }' )
    $0 ban "$IP" "$line"
    if [ "$PID" == "0" ]; then
    PID=`$PS au | $GREP "$TAIL -n +1 -f $MONITOR" | $AWK '{ print $2 }'`
    $ECHO $PID | $AWK '{ print $1 }' > "$WOOTLOCK"
    fi
    done
    exit $RETVAL
    ;;
    *)
    #no scriptname passed
    $ECHO "$0 scriptname [parameters]"
    RETVAL=2
    exit $RETVAL
    ;;
    esac

    # In theory we should never get this far
    let RETVAL+=100
    exit $RETVAL

    Feel free to expand the script but please consider sending me any updates



    The following is unaffiliated with labby.co.uk

    Incoming search terms for the article:

    • AIM
    • Bebo
    • Delicious
    • Digg
    • Blogger Post
    • BlogMarks
    • Facebook
    • Google Bookmarks
    • Google Buzz
    • Google Gmail
    • Hotmail
    • Identi.ca
    • LiveJournal
    • Linkatopia
    • MySpace
    • Slashdot
    • Shoutwire
    • Sphere
    • StumbleUpon
    • Technorati Favorites
    • TechNet
    • Twitter
    • TypePad Post
    • Webnews
    • Yahoo Bookmarks
    • WordPress
    • Yahoo Buzz
    • Yahoo Mail
    • Yahoo Messenger
    • Share/Bookmark

    Related Posts:

     
  • Adding a new IP to apache2 web server

    I have just had a second IP for my web server and wish to use it for a dedicated domain name.

    Here is how you configure apache2 to serve requests on that IP to a specific virtualhost

    assumptions:

    new IP is 192.168.1.2

    new website is called newip.labby.co.uk

    <VirtualHost 192.168.1.2>

    UseCanonicalName Off

    ServerName newip.labby.co.uk

    ServerAlias *.newip.labby.co.uk

    ServerAlias *

    DocumentRoot /var/www/newip.labby.co.uk

    ErrorLog /var/log/apache2/error-newip.labby.co.uk.log

    LogLevel warn

    CustomLog /var/log/apache2/access-newip.labby.co.uk.log

    <Directory /var/www/newip.labby.co.uk>

    Allow From All

    Options +Indexes +FollowSymLinks

    </Directory>

    </virtualhost>



    The following is unaffiliated with labby.co.uk

    Incoming search terms for the article:

    • AIM
    • Bebo
    • Delicious
    • Digg
    • Blogger Post
    • BlogMarks
    • Facebook
    • Google Bookmarks
    • Google Buzz
    • Google Gmail
    • Hotmail
    • Identi.ca
    • LiveJournal
    • Linkatopia
    • MySpace
    • Slashdot
    • Shoutwire
    • Sphere
    • StumbleUpon
    • Technorati Favorites
    • TechNet
    • Twitter
    • TypePad Post
    • Webnews
    • Yahoo Bookmarks
    • WordPress
    • Yahoo Buzz
    • Yahoo Mail
    • Yahoo Messenger
    • Share/Bookmark

    Related Posts:

     
2 visitors online now
2 guests, 0 bots, 0 members
Max visitors today: 3 at 03:16 pm UTC
This month: 3 at 09-02-2010 03:16 pm UTC
This year: 48 at 04-04-2010 10:07 pm UTC
All time: 48 at 04-04-2010 10:07 pm UTC
programming-protein
programming-protein
programming-protein
programming-protein
impressive
impressive
impressive
impressive