Forum Moderators: phranque
1.) CULPRITS:
Here are obfuscated examples, with yyy and zzz being numbers --
Troublemaker A, e.g.:
adsl-71-134-yyy-yyy.first.example.pacbell.net
adsl-71-135-zzz-zzz.secondt.example.pacbell.net
Troublemaker B, e.g.:
pool-71-105-yyy-yyy.first.example.verizon.net
pool-71-106-zzz-zzz.second.example.verizon.net
2.) WORKS:
Playing catch-up and rewriting, alas only AFTER each intrusion --
RewriteCond %{REMOTE_HOST} ^adsl-71-134-yyy-yyy\.first\.example\.pacbell\.net$
RewriteRule ^.*$ [private.com...] [R,L]
RewriteCond %{REMOTE_HOST} ^pool-71-105-yyy-yyy\.first\.example\.verizon\.net$
RewriteRule ^.*$ [private.com...] [R,L]
3.) DOESN'T WORK:
The server (Apache/1.3.22) does a reverse look-up (or some such; httpd.conf config) so when there's a valid HOST, the server does NOT block based on REMOTE_ADDR alone, regardless of where I put htaccess instructions. Thus these don't work (presuming I even did them correctly!) --
RewriteCond %{REMOTE_ADDR} ^71\.134\.$
## Troublemaker usually uses:
RewriteCond %{HTTP_USER_AGENT} ^Mozilla.*4322
RewriteCond %{REQUEST_URI} ^(.*)/perlscript(.*)$
RewriteRule ^.*$ [private.com...] [R,L]
RewriteCond %{REMOTE_ADDR} ^71\.105\.$
## Troublemaker usually uses:
RewriteCond %{HTTP_USER_AGENT} ^Mozilla.*98
RewriteCond %{REQUEST_URI} ^(.*)/perlscript(.*)$
RewriteRule ^.*$ [private.com...] [R,L]
4.) HELP, please?
is there any way to turn the examples in (1.) into workable, rewritable REMOTE_HOST ranges? (This Mac person found a few programs claiming to be able to help craft strings and such but they're PC-only.) Thanks in advance for any/all assistance! -Annie
[edited by: Pfui at 7:25 pm (utc) on April 30, 2007]
RewriteCond %{REMOTE_ADDR} ^71\.134\.$
That may be the cause of your problem.
Be aware that you can combine variables in RewriteConds, and so collapse these to a single rule:
RewriteCond %{REMOTE_ADDR}<>%{HTTP_USER_AGENT} ^71\.134\.[^<]+<>Mozilla.*4322 [OR]
RewriteCond %{REMOTE_ADDR}<>%{HTTP_USER_AGENT} ^71\.105\.[^<]+<>Mozilla.*98
RewriteRule perlscript http://www.example.com/redirected.html [R,L]
If fixing the IP address pattern by removing the end-anchor doesn't help, look into setting HostnameLookups off -- See Apache Core documentation.
Jim