summaryrefslogtreecommitdiffstats
path: root/apache.txr
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2013-11-29 21:38:31 -0800
committerKaz Kylheku <kaz@kylheku.com>2013-11-29 21:38:31 -0800
commit37599023787d2a6d793c6b73ccaa35c5269e27d2 (patch)
tree20bd75731a053c14a1a4a60c72ccfaaaa7c3038e /apache.txr
downloadtxrban-37599023787d2a6d793c6b73ccaa35c5269e27d2.tar.gz
txrban-37599023787d2a6d793c6b73ccaa35c5269e27d2.tar.bz2
txrban-37599023787d2a6d793c6b73ccaa35c5269e27d2.zip
Tracking this stuff.
Diffstat (limited to 'apache.txr')
-rw-r--r--apache.txr21
1 files changed, 21 insertions, 0 deletions
diff --git a/apache.txr b/apache.txr
new file mode 100644
index 0000000..12d6a9f
--- /dev/null
+++ b/apache.txr
@@ -0,0 +1,21 @@
+@(load "txrban")
+@(next @(open-tail "/var/log/apache2/www.kylheku.com.log" "r" nil))
+@#(next "/var/log/apache2/www.kylheku.com.log")
+@(repeat)
+@ (block badguys)
+@ (all)
+@ip - - [@(n day)/@month/@(n year):@(n hour):@(n min):@(n sec) @nil] "@method @uri @proto/@ver" @err @bytes "@ref" "@agent"
+@ (and)
+@ (cases)
+@ (require (search-regex agent #/Googlebot|bingbot|baidu/))
+@ (fail badguys)
+@ (or)
+@ (require (search-regex agent #/[Bb][Oo][Tt]|[Ss]pider|[Cc]rawler|[Yy]andex/))
+@ (end)
+@ (end)
+@ (do
+ (let ((time (make-time year (month-num month) day hour min sec :auto)))
+ (ban ip time 86400)
+ (expire time)))
+@ (end)
+@(end)