I've got a scripter who is using a proxy to attack a website I'm serving.
I've noticed that they tend to access the site via software with a certain common user agent string (i.e. http://www.itsecteam.com/en/projects/project1_page2.htm "Havij advanced sql injection software" with a user_agent string of Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727) Havij
). I'm aware that any cracking software worth it's salt will probably be able to modify it's user agent string, but I'm fine with the scripter having to deal with that feature at some point.
So, is there any software out there for automatically blocking access & permanently blacklisting by matching user agent strings?
you can deny access by BrowserMatch and Deny from SetEnvIf Example:
To permanenly block them you have to write custom log file and use fail2ban for example to ban them with iptables
For example create LogFormat
Add logging to your vhost/server-wide
/etc/fail2ban/filter.d/baduseragent.conf
/etc/fail2ban/jail.conf
I think i understand your question. I will provide a more detailed explanation should this be what you are looking for. (this will work as a trap for other things as well)
bas_useragent [tab] black
useragent_bad [tab} black
RewriteMap badlist txt:~/bad_useragent_list
RewriteCond %{HTTP_USER_AGENT} .* [NC]
RewriteCond ${badlist:%1|white} ^black$ [NC]
RewriteRule (.*) "/trap.php" [L]