1 So I have enabled the [[moderatedcomments]] plugin on my wiki. and good thing that! around 1000 spammy comments showed up in the last 3 months! Awful!
3 It's pretty hard to figure out the ham and the spam in there. One thing I was hoping was to use the power of the commandline to filter through all that stuff. Now, it seems there's only a "ikiwiki-comment" tool now, and nothing to examine the moderated comments.
5 It seems to me it would be great to have some tool to filter through that...
8 So it turns out it was over 3000 comments. The vast majority of those (every one but 42 comments) were from the IP `46.161.41.34` which i recommend null-routing everywhere. I used the following shell magic to figure that out:
11 # locate the transient directory
12 cd $source/.ikiwiki/transient
13 # count the number of comments
14 find . -name '*._comment_pending' | wc
15 # number of comments per IP
16 find . -name '*._comment_pending' | xargs grep -h ip= | sort | uniq -c | sort -n
17 # generate a banlist for insertion in `banusers`, assuming all the pending comments are spam
18 find . -name '*._comment_pending' | xargs grep -h ip= | sort -u| sed 's/ ip="//;s/"//;s/^/- ip(/;s/$/)/'
19 # remove comments from a bad guy
20 find . -name '*._comment_pending' | xargs grep -l 'ip="46.161.41.34"'| xargs rm
21 # flush all pending comments
22 find . -name '*._comment_pending' -delete
25 The remaining 42 comments I reviewed throught the web interface, then flushed using the above command. My final addition to the banlist is: