Forum Moderators: coopster & phranque

Message Too Old, No Replies

Script Proctection

         

nahmed

6:01 pm on Oct 18, 2004 (gmt 0)

10+ Year Member



I am trying to protect a Perl script which has to sit is a www accessible cgi-bin dir.

The .htaccess file within this dir is as follows:

<Files "test.pl">
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Files>

I'm using another Perl script called test2.pl to call test.pl using the following code:

$ua = LWP::UserAgent->new;
$request = HTTP::Request->new(GET => "test.pl");
$request->header(referer => '127.0.0.1');
$response = $ua->request($request);

Only problem is I get a 403 Error when trying to access test.pl. As you can see above I even tried adding the appropriate HTTP Referer but no luck.

Some help with configuring Perl/Apache to allow local access to Perl scripts using LWP (but denying all outside access) would be handy?

Thanks.

Nasser

SeanW

2:52 am on Oct 19, 2004 (gmt 0)

10+ Year Member



Firstly, setting the referrer doesn't make a whiff of difference to Apache, it's looking at the address of the socket.

I'd also change "test.pl" to "http://127.0.0.1/cgi-bin/test.pl"

Sean

nahmed

5:35 am on Oct 19, 2004 (gmt 0)

10+ Year Member



Thanks for the response.

>Firstly, setting the referrer doesn't make a whiff of difference to Apache, it's looking at the address of the socket.

That's fine so how do I get it working? What would I need to put in the .htaccess, or is this doomed as the socket address isn't something that can be verified through apache?

>I'd also change "test.pl" to "http://127.0.0.1/cgi-bin/test.pl"

This was example code, I didn't want to include the real code which has the correct syntax.

Nasser

SeanW

11:46 am on Oct 19, 2004 (gmt 0)

10+ Year Member



Look at the log generated for the hit... The IP address you see there is the address that the limit directive acts on.

Also, check the error_log file, it should tell you why the 403 was there. It might be that you have to set some options in httpd.conf to allow yourself to use those .htaccess comands.

Sean