Of course you want to adopt it to use a real database and some well defined blocking policies. May be Randal will revise his webtechnique column to use this better phase (CC'ing him).
#file:MyApache/BlockIP2.pm #-------------------------- package MyApache::BlockIP2;
use Apache::Connection ();
use Apache::Const -compile => qw(FORBIDDEN OK);
my %bad_ips = map {$_ => 1} qw(127.0.0.1 10.0.0.4);
sub handler { my Apache::Connection $c = shift;
my $ip = $c->remote_ip; if (exists $bad_ips{$ip}) { warn "IP $ip is blocked\n"; return Apache::FORBIDDEN; }
return Apache::OK; }
1;
Configuration:
PerlPreConnectionHandler MyApache::BlockIP2
You will need mp 1.99_08 or higher for this to work.
__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com