[Melbourne-pm] finding the ip address of the web client

Andrew Dent sgc294 at internode.on.net
Mon Feb 9 17:08:27 PST 2009


  BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px;
}G'day Liegh and Tim
 That works great, thanks. Exactly what I was looking for. 
 None of our clients will be behind remote proxies for internal
traffic. 
 These sites are only visible internally and not to the external
internet. 
 There are multiple internal DNS Servers managed by the corporate IT,
so they "should be" trustworthy for internal reverse lookup. 
 One thing that might break the solution is trying to access these
queries via VPN.   
 Thanks again.
 Andrew Dent
 Tim Hogard and Leigh Sharpe wrote:    

	%ENV{'REMOTE_ADDR '} should contain the IP address of the client.
Try
 this:
 =20
 -----
 =20
 #!/usr/bin/perl
 print "content-type:text/htmlnnn";
 foreach(keys(%ENV))
 {
         print "$_ =3D $ENV{$_}n";
 }
 print "n";
 If the rmote is behind a an honest proxy it may give you this to:
  HTTP_X_FORWARDED_FOR
 Also
	%ENV{'REMOTE_ADDR'} should contain the IP address of the client. Try
	                   ^ no space...
 Other comments...
 reverse DNS is often very slow and may timeout.
 maxmind has a free database and perl module that has IP->country
code
 mappings.
 You can't trust anyones reverse IP.
 You also need to make sure your CGI program framework can't over
write the
 REMOTE_ADDR.
 -tim 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/melbourne-pm/attachments/20090210/62dbb560/attachment.html>


More information about the Melbourne-pm mailing list