Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Getting an IP address

Reply
Thread Tools

Getting an IP address

 
 
Sean Berry
Guest
Posts: n/a
 
      05-24-2004
I am fairly new to Perl, doing most of my stuff in Python.

But, I really like Perl's CGI capabilities.

I have a Perl CGI program that I am running that I would like to be
extremely secure. It will require a password, using htaccess. But, I would
also like to limit it to computers on our network as well as a few
individual IP addresses.

I thought of setting up an array of acceptable IP addresses and checking
whether the requesting IP address is in the array. Let them through if they
are. Boot them if they are not.

How can I do this? How can I harvest the IP address of the reuqesting
computer?

Thanks in advance.



 
Reply With Quote
 
 
 
 
Paul Lalli
Guest
Posts: n/a
 
      05-24-2004
On Mon, 24 May 2004, Sean Berry wrote:

> I am fairly new to Perl, doing most of my stuff in Python.
>
> But, I really like Perl's CGI capabilities.
>
> I have a Perl CGI program that I am running that I would like to be
> extremely secure. It will require a password, using htaccess. But, I would
> also like to limit it to computers on our network as well as a few
> individual IP addresses.
>
> I thought of setting up an array of acceptable IP addresses and checking
> whether the requesting IP address is in the array. Let them through if they
> are. Boot them if they are not.
>
> How can I do this? How can I harvest the IP address of the reuqesting
> computer?


Well, from your CGI script, you can use the REMOTE_ADDR key of the %ENV
hash:

print "Your IP Address is: $ENV{REMOTE_ADDR}\n";


However... if you're already using htaccess, might it not be a better idea
to use that to limit the IP addresses, as that functionality is already
built in? Just a suggestion, it may or may not apply to your situation.

Paul Lalli
 
Reply With Quote
 
 
 
 
Sean Berry
Guest
Posts: n/a
 
      05-25-2004
I was thinking about that but I already have programs in the directory that
shoud be able to be accessed from anywhere.

How does it work if I have an .htaccess in ./domain/private and another in
../domain/private/restricted

Are both passwords going to be required to access
../domain/private/restricted?

Many thanks. I know this has turned into a non-perl question, but hate to
start another post on another newsgroup for a simple question like this.


"Paul Lalli" <> wrote in message
news:...
> On Mon, 24 May 2004, Sean Berry wrote:
>
> > I am fairly new to Perl, doing most of my stuff in Python.
> >
> > But, I really like Perl's CGI capabilities.
> >
> > I have a Perl CGI program that I am running that I would like to be
> > extremely secure. It will require a password, using htaccess. But, I

would
> > also like to limit it to computers on our network as well as a few
> > individual IP addresses.
> >
> > I thought of setting up an array of acceptable IP addresses and checking
> > whether the requesting IP address is in the array. Let them through if

they
> > are. Boot them if they are not.
> >
> > How can I do this? How can I harvest the IP address of the reuqesting
> > computer?

>
> Well, from your CGI script, you can use the REMOTE_ADDR key of the %ENV
> hash:
>
> print "Your IP Address is: $ENV{REMOTE_ADDR}\n";
>
>
> However... if you're already using htaccess, might it not be a better idea
> to use that to limit the IP addresses, as that functionality is already
> built in? Just a suggestion, it may or may not apply to your situation.
>
> Paul Lalli



 
Reply With Quote
 
Paul Lalli
Guest
Posts: n/a
 
      05-25-2004
[please post your reply below the original message. See the posting
guidelines]

"Sean Berry" <> wrote:
> "Paul Lalli" <> wrote in message
> news:...
> > However... if you're already using htaccess, might it not be a better idea
> > to use that to limit the IP addresses, as that functionality is already
> > built in? Just a suggestion, it may or may not apply to your situation.
> >
> > Paul Lalli

>
> I was thinking about that but I already have programs in the directory that
> shoud be able to be accessed from anywhere.
>
> How does it work if I have an .htaccess in ./domain/private and another in
> ./domain/private/restricted
>
> Are both passwords going to be required to access
> ./domain/private/restricted?
>
> Many thanks. I know this has turned into a non-perl question, but hate to
> start another post on another newsgroup for a simple question like this.


You should probably read the Apache documentation on the subject.
(http://httpd.apache.org/docs/mod/core.html#files might prove useful).
There are ways to limit .htaccess to apply to only certain
files/directories.

Paul Lalli
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VPN with DMZ IP address NETed to LAN IP address!!! route-map!!! examples20001@gmail.com Cisco 0 02-07-2006 04:05 PM
PIX Firewall MAC address VPN IP address Julian Dragut Cisco 1 02-07-2006 07:57 AM
obtaining the IP ADDRESS of an IP POHNE by its MAC ADDRESS ProgDario Cisco 17 05-06-2005 02:32 PM
Routing to public IP of NAT address from internal NAT address Andrew Albert Cisco 1 02-08-2005 07:05 PM
Re: Hide Address Bar or Encrypt Address?? avnrao ASP .Net 1 05-04-2004 03:46 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57