package Acme::Apache::ThereCastle; use strict; use Apache::Constants qw(:common); use IP::Country::Fast; use vars qw($VERSION); $VERSION = '1.00'; sub handler { my $r = shift; my $castle = $r->dir_config('CastleHome'); my $whois = IP::Country::Fast->new(); my $country = $whois->inet_atocc($r->get_remote_host); return FORBIDDEN unless $country eq $castle; return OK; } =head1 NAME Acme::Apache::ThereCastle =head1 SYNOPSIS PerlAccessHandler Acme::Apache::ThereCastle PerlSetVar CastleHome RO =head1 DESCRIPTION This mod_perl handler performs the important function of only allowing people to access a directory from the right part of the world. =head1 USAGE In your configuration file, put the following configuration PerlAccessHandler Acme::Apache::ThereCastle PerlSetVar CastleHome RO Set the CastleHome variable to match the country which should have access to your protected directory. This will keep the peasants from storming your castle. =head1 AUTHOR Michael Kellen idsfa@visi.com http://www.visi.com/~idsfa/ =head1 COPYRIGHT This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. =head1 SEE ALSO Acme::Apache::Werewolf IP::Country Young Frankenstein (1974) =cut 1;