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"

In reply to LWP request , Proxy Authentication Using Kerberos by Nir

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.