Ask a Question related to PERL Modules, Design and Development.
-
Bo Johanson #1
LWP::Authen:Ntlm fails in "second phase"
A reasonably experienced perl and web programmer, but by no means an expert
on OOperl and modules nor the HTTP intricacies, I hope for someone to point
towards the light at the end of the tunnel. I've struggled through long
hours of LWP documentation, mail archives, trials and errors. I've hesitated
to post a question here, but now I feel I've RTFM, updated and completed my
perl libraries and done the homework. I'm stuck and out of ideas. Basically
I wonder if anyone has actually been successful using perl on a Windows XP
client GETting HTTP from Microsoft IIS5 (or 6) with NTLM.
My attempts to request (get) NTLM-authenticated pages fail. Apparently
LWP::Authen::Ntlm::authenticate responds incorrectly in the "second phase"
of the NTLM handshake where it's supposed to encrypt and return the
"challenge token" sent by the server. The web server (IIS 5) apparently
rejects LWP's response and returns to square one - "Unauthorized".
Below is one "cycle" of the debug trace generated by LWP debug (use
LWP::Debug qw(+);). This cycle is repeated 3 times before LWP gives up and
returns failure. Could it be that the decryption and encryption of "tokens"
are unsuccessful? Any ideas at all?
Trace from LWP debug:
LWP::UserAgent::new: ()
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: GET [url]http://my.domain.com:80/search/[/url]
LWP::UserAgent::_need_proxy: Not proxied
LWP::Protocol::http::request: ()
LWP::Protocol::collect: read 796 bytes
LWP::Protocol::collect: read 860 bytes
LWP::Protocol::http::request: Keep the http connection to my.domain.com:80
LWP::UserAgent::request: Simple response: Unauthorized
LWP::Authen::Ntlm::authenticate: authenticate() has been called
LWP::Authen::Ntlm::authenticate: In first phase of NTLM authentication
LWP::Authen::Ntlm::authenticate: Returning response object with auth header:
Authorization NTLM TlRMTVNTUAABAAAAB7IAAAMAAwAgAAAABQAFACMAAABCR0p2ZX JpdA==
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: GET [url]http://my.domain.com:80/search/[/url]
LWP::UserAgent::_need_proxy: Not proxied
LWP::Protocol::http::request: ()
LWP::Protocol::collect: read 568 bytes
LWP::Protocol::collect: read 971 bytes
LWP::Protocol::http::request: Keep the http connection to my.domain.com:80
LWP::UserAgent::request: Simple response: Unauthorized
LWP::Authen::Ntlm::authenticate: authenticate() has been called
LWP::Authen::Ntlm::authenticate: In second phase of NTLM authentication
LWP::Authen::Ntlm::authenticate: Returning response object with auth header:
Authorization NTLM
TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAoACgBwAAAABg AGAHoAAAAGAAYAgAAAAAAAAABG
AAAABYKBAqFOpfa4g+mSE0powzDQrNZEcYTAhcI5hc/LQ1+mXuMdG1oHex2ctFVQRF8vBJiElgUC
zg4AAAAPVgBCAEcASgBCAEcASgA=
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: GET [url]http://my.domain.com:80/search/[/url]
LWP::UserAgent::_need_proxy: Not proxied
LWP::Protocol::http::request: ()
LWP::Protocol::collect: read 796 bytes
LWP::Protocol::collect: read 743 bytes
LWP::Protocol::http::request: Keep the http connection to my.domain.com:80
LWP::UserAgent::request: Simple response: Unauthorized
LWP::Authen::Ntlm::authenticate: authenticate() has been called
LWP::Authen::Ntlm::authenticate: In first phase of NTLM authentication
# Back to square one!!!
(repeated 3 times)
----
Here's the code, MOL copied from the samples found in documentation and on
the net:
use LWP::UserAgent;
use LWP::Authen::Ntlm;
use LWP::Debug qw(+);
my $ua = LWP::UserAgent->new(
agent=>'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) ',
keep_alive=>'1'
);
# note the empty '' is required.
$ua->credentials('my.domain.com:80', '', 'domain\\uID' => 'pwd');
#$ua->proxy(http => 'http://proxy.domain.com:8080'); # Makes no difference
my $req = new HTTP::Request GET => 'http://my.domain.com:80/';
my $res = $ua->request( $req );
if ( $res->is_success() ) {
# Success !
}
else {
# Failure
}
--
[email]bo_johanson_nojunkmail@hotmail.com[/email]
Bo Johanson Guest
-
Why is the "capturing" phase so named?
I believe I've got a reasonable understanding of the Flex event flow but I don't understand why the capturing phase is so named. Perhaps it is so... -
ASP.Net calling SSL Web Service (PayPal) fails: "Could not establish secure channel for SSL/TLS"
This is one of those cases where it works (calling the Web Service) in a WinForm app but not in ASP.Net. Localhost is a Windows Server 2003 with... -
#25348 [Csd]: "make install" fails with --enable-short-tags
ID: 25348 Updated by: sniper@php.net Reported By: rjmooney at lsb dot syr dot edu Status: Closed Bug Type: ... -
LWP::Authen::Ntlm Error when often used
Hi I have here a strange Problem, I monitor with a script our hosting enviroment, so far my script works very well, but unfortunately some of our... -
Mail::Audit (removing attachment fails on "broken path")
On Mon, 25 Aug 2003 12:47:34 GMT "Ian.H " <ian@WINDOZEdigiserv.net> wrote: Yes - but if you want to be sure that you are getting all the worms...



Reply With Quote

