Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

LWP request , Proxy Authentication Using Kerberos

by Nir (Initiate)
on Apr 03, 2015 at 00:19 UTC ( [id://1122314]=perlquestion: print w/replies, xml ) Need Help??

Nir has asked for the wisdom of the Perl Monks concerning the following question:

Problem Statement : To successfully visit webpages through a proxy which accepts kerberos tickets using LWP
I have to visit a URL say www.perlmonks.org through a proxy.
Now the proxy authentication has to be done
through a Kerberos ticket.
I keep seeing the following error :

LWP::Authen::Negotiate::authenticate: authenticate() version 0.08 call +ed LWP::Authen::Negotiate::authenticate: target hostname www.perlmonks.or +g LWP::Authen::Negotiate::authenticate: GSSAPI servicename HTTP@www.chas +e.com LWP::Authen::Negotiate::authenticate: Unspecified GSS failure. Minor +code may provide more information LWP::Authen::Negotiate::authenticate: Server not found in Kerberos dat +abase

Following is the code :

use LWP::UserAgent; use LWP::Authen::Negotiate; use LWP::Debug qw(+); my $kut1Password = "password"; my $kut1User = "u1"; my $kut1Domain = "testdomain.com"; my $kut1KerbUser = "$kut1User\@$kut1Domain"; my $kut1Url = "http://www.perlmonks.org"; `echo $kut1Password | kinit $kut1KerbUser`; print (`klist`); my $kut1LwpAgent = LWP::UserAgent->new(keep_alive => 1); push @{$kut1LwpAgent->requests_redirectable}, 'POST'; $ENV{HTTP_PROXY} = "http://<proxy-ip>:<proxy-port>"; print ("PROXY IS " .$kut1LwpAgent->env_proxy."\n"); my $kut1LwpResponse = $kut1LwpAgent->get( $kut1Url ) ; print ("Response is :". $kut1LwpResponse->headers()->as_string); print(`klist`);

In curl , I can achieve this by doing the following after executing a system command for kinit -

"curl --insecure --verbose --proxy-negotiate --proxy-user : --proxy <p +roxy-ip>:<proxy-port> --url http://www.perlmonks.org"

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1122314]
Approved by graff
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-20 02:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found