On 09/15/2014 12:22 AM, Ruben Safir wrote:
> 
> I added a perl handler to my apache setup and I can't understand why I'm
> losing the directory listings in my image and doc directories.  I need
> to both squelch  rougue web querries
> 
> The apache conf looks like this:
> 
> <VirtualHost *:80>
>     ServerAdmin ru...@mrbrklyn.com
>     DocumentRoot "/usr/local/apache/htdocs/brooklyn"
>     ServerName brooklyn-living.com
>     DirectoryIndex index.html
>     PerlModule Embperl
>     Embperl_UseEnv        on
>     ErrorLog logs/brooklyn_error_log
>     CustomLog logs/brooklyn_access_log common
>     <Directory /usr/local/apache/htdocs/brooklyn>
>            Options     Indexes ExecCGI
>            DirectoryIndex index.html
>            <Files *.html>
>            SetHandler  perl-script
>            PerlResponseHandler URL_BLOCK
>            PerlHandler Embperl
>            </Files>
>            AllowOverride None
>            Order allow,deny
>            Allow from all
>     </Directory>
>  <Directory /usr/local/apache/htdocs/brooklyn/images>
>         Options Indexes FollowSymLinks
>         SetHandler  perl-script
>         PerlResponseHandler URL_BLOCK
>     </Directory>
> </VirtualHost>
> 
> 
> and the URL_BLOCK script looks like this:
> package URL_BLOCK;
> 
> use strict;
> use Apache2::RequestRec ();
> use Apache2::RequestIO ();
> use Apache2::Const -compile => qw(:common);
> 
> sub handler{
>         my $r = shift;
>         my $gate = $r->unparsed_uri;
>         print STDERR "YO $gate\n";
>         return Apache2::Const::DECLINED unless defined $gate;
>         if ($gate =~ m{///}){
>                 print STDERR "I have a match\n";
>                 $r->log_reason("Access Forbidden", $r->filename);
>                 return Apache2::Const::FORBIDDEN;
>         }
>         return Apache2::Const::DECLINED;
> 
> }
> 
> 1;
> 
> 

Oh yeah --

Server version: Apache/2.2.23 (Unix)
Server built:   Dec  9 2012 17:26:38


Reply via email to