I have tried in vain to do NTLM authentication via LWP. Well, via WWW::Mechanize, but that's just LWP underneath.

As in the message Re^2: More NTLM, I am suspecting Microsoft foul (and possibly fowl) play in augmenting the non-standard a little more.

I tried applying the suggested patch from http://rt.cpan.org/Public/Bug/Display.html?id=9521 but with the same result.

Is anyone currently having success with code connecting to IIS 5 NTLM authenticated pages?

NB: I am not connecting via a proxy and my code looks like this:

my $mech = WWW::Mechanize->new( keep_alive => 1, ); $mech->credentials( 'theserver.com:80', '', $username, $password );
I have also tried with and without specifying an NT domain.

Update: Here is my (sanitized) lwp debug output:

LWP::UserAgent::new: () LWP::UserAgent::proxy: ftp http://**url sanitized*** LWP::UserAgent::request: () HTTP::Cookies::add_cookie_header: Checking **url sanitized*** for cook +ies HTTP::Cookies::add_cookie_header: Checking **url sanitized*** for cook +ies HTTP::Cookies::add_cookie_header: Checking **url sanitized*** for cook +ies HTTP::Cookies::add_cookie_header: Checking .net for cookies LWP::UserAgent::send_request: GET http://**url sanitized*** LWP::UserAgent::_need_proxy: Not proxied LWP::Protocol::http::request: () LWP::Protocol::collect: read 811 bytes LWP::Protocol::collect: read 1736 bytes LWP::Protocol::collect: read 1380 bytes LWP::Protocol::collect: read 504 bytes 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 h +eader: Authorization NTLM TlRMTVNTUA**chop** LWP::UserAgent::request: () HTTP::Cookies::add_cookie_header: Checking **url sanitized*** for cook +ies HTTP::Cookies::add_cookie_header: Checking **url sanitized*** for cook +ies HTTP::Cookies::add_cookie_header: Checking **url sanitized***for cooki +es HTTP::Cookies::add_cookie_header: Checking .net for cookies LWP::UserAgent::send_request: GET http://**url sanitized*** LWP::UserAgent::_need_proxy: Not proxied LWP::Protocol::http::request: () LWP::Protocol::collect: read 566 bytes LWP::Protocol::collect: read 1736 bytes LWP::Protocol::collect: read 1380 bytes LWP::Protocol::collect: read 351 bytes LWP::Protocol::http::request: Keep the http connection to **url saniti +zed***:80 LWP::UserAgent::request: Simple response: Unauthorized LWP::Authen::Ntlm::authenticate: authenticate() has been called LWP::Authen::Ntlm::authenticate: In second phase of NTLM authenticatio +n LWP::Authen::Ntlm::authenticate: Returning response object with auth h +eader: Authorization NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABg**chop** LWP::UserAgent::request: () HTTP::Cookies::add_cookie_header: Checking **url sanitized*** for cook +ies HTTP::Cookies::add_cookie_header: Checking **url sanitized*** for cook +ies HTTP::Cookies::add_cookie_header: Checking **url sanitized*** for cook +ies HTTP::Cookies::add_cookie_header: Checking .net for cookies LWP::UserAgent::send_request: GET http://**url sanitized*** LWP::UserAgent::_need_proxy: Not proxied LWP::Protocol::http::request: () LWP::Protocol::collect: read 811 bytes LWP::Protocol::collect: read 1736 bytes LWP::Protocol::collect: read 1380 bytes LWP::Protocol::collect: read 106 bytes 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 h +eader: Authorization NTLM TlRMTVNTUAA**chop** LWP::UserAgent::request: () HTTP::Cookies::add_cookie_header: Checking **url sanitized*** for cook +ies HTTP::Cookies::add_cookie_header: Checking **url sanitized*** for cook +ies HTTP::Cookies::add_cookie_header: Checking **url sanitized*** for cook +ies HTTP::Cookies::add_cookie_header: Checking .net for cookies LWP::UserAgent::send_request: GET http://**url sanitized*** LWP::UserAgent::_need_proxy: Not proxied LWP::Protocol::http::request: () LWP::Protocol::collect: read 566 bytes LWP::Protocol::collect: read 1736 bytes LWP::Protocol::collect: read 1380 bytes LWP::Protocol::collect: read 351 bytes LWP::Protocol::http::request: Keep the http connection to **url saniti +zed***:80 LWP::UserAgent::request: Simple response: Unauthorized LWP::Authen::Ntlm::authenticate: authenticate() has been called LWP::Authen::Ntlm::authenticate: In second phase of NTLM authenticatio +n LWP::Authen::Ntlm::authenticate: Returning response object with auth h +eader: Authorization NTLM TlRMTVNTUAADAAAAGA**chop** LWP::UserAgent::request: () HTTP::Cookies::add_cookie_header: Checking **url sanitized*** for cook +ies HTTP::Cookies::add_cookie_header: Checking **url sanitized*** for cook +ies HTTP::Cookies::add_cookie_header: Checking **url sanitized*** for cook +ies HTTP::Cookies::add_cookie_header: Checking .net for cookies LWP::UserAgent::send_request: GET http://**url sanitized*** LWP::UserAgent::_need_proxy: Not proxied LWP::Protocol::http::request: () LWP::Protocol::collect: read 811 bytes LWP::Protocol::collect: read 1736 bytes LWP::Protocol::collect: read 1486 bytes 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 h +eader: Authorization NTLM TlRMTVN**chop** LWP::UserAgent::request: () HTTP::Cookies::add_cookie_header: Checking **url sanitized*** for cook +ies HTTP::Cookies::add_cookie_header: Checking **url sanitized***for cooki +es HTTP::Cookies::add_cookie_header: Checking **url sanitized***for cooki +es HTTP::Cookies::add_cookie_header: Checking .net for cookies LWP::UserAgent::send_request: GET http://**url sanitized*** LWP::UserAgent::_need_proxy: Not proxied LWP::Protocol::http::request: () LWP::Protocol::collect: read 566 bytes LWP::Protocol::collect: read 1736 bytes LWP::Protocol::collect: read 1380 bytes LWP::Protocol::collect: read 351 bytes LWP::Protocol::http::request: Keep the http connection to **url saniti +zed***:80 LWP::UserAgent::request: Simple response: Unauthorized LWP::Authen::Ntlm::authenticate: authenticate() has been called LWP::Authen::Ntlm::authenticate: In second phase of NTLM authenticatio +n LWP::Authen::Ntlm::authenticate: Returning response object with auth h +eader: Authorization NTLM TlRMTVNTUA**chop** LWP::UserAgent::request: () HTTP::Cookies::add_cookie_header: Checking **url sanitized***for cooki +es HTTP::Cookies::add_cookie_header: Checking **url sanitized***for cooki +es HTTP::Cookies::add_cookie_header: Checking **url sanitized***for cooki +es HTTP::Cookies::add_cookie_header: Checking .net for cookies LWP::UserAgent::send_request: GET http://**url sanitized*** LWP::UserAgent::_need_proxy: Not proxied LWP::Protocol::http::request: () LWP::Protocol::collect: read 811 bytes LWP::Protocol::collect: read 1736 bytes LWP::Protocol::collect: read 1380 bytes LWP::Protocol::collect: read 106 bytes LWP::UserAgent::request: Simple response: Unauthorized LWP::Authen::Ntlm::authenticate: authenticate() has been called LWP::Authen::Ntlm::authenticate: In first phase of NTLM authentication

In reply to NTLM - Not Telling Linux Much by aufflick

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.