Block IP's via .htaccess after detected by Bad Behavior
-
On a website I manage I found a lot of records detected/blocked by Bad Behavior, so I tried to examine the logs. I found that there were so many records, that it was impossible to oversee.
So I created a script, that lists the IP’s with the number of records (>=10) together with first and last occurence. IP’s that are whitelisted are not shown. I’m using the following query:
SELECT ip, COUNT(id) AS numrecords, MIN(date) AS firstrecord, MAX(date) AS lastrecord FROM wp_bad_behavior GROUP BY ip HAVING numrecords >=10 ORDER BY numrecords DESC
The records are displayed in a table with an option to delete all the records for a certain IP after I blocked the IP via .htaccess.
It’s also possible to display the last 100 records for a certain IP with detailed info via the query:
SELECT date, request_method, request_uri, http_headers, user_agent, request_entity FROM wp_bad_behavior WHERE ip="IPaddress" ORDER BY date DESC LIMIT 0, 100
My questions:
1. Is this blocking via .htaccess the right way to handle this?
2. Can this be done more efficiently?
3. Is it possible to add this functionality to the plugin? Via a dashboard widget perhaps?
- The topic ‘Block IP's via .htaccess after detected by Bad Behavior’ is closed to new replies.