Subject: | NTLM 'domain\user' failed before |
I am using NTLM-1.09 to try accessing http server with NTLM
authentication for days, but it doesn’t work so far.
I am just writting the script follow the example on LWP::Authen::Ntlm:
<code>
use LWP::UserAgent;
use HTTP::Request::Common;
use LWP::Debug qw(+);
my $url = ‘http://10.1.1.1’;
my $ua = LWP::UserAgent->new(keep_alive => 1);
$ua->credentials(’10.1.1.1:80’, ‘’, “domain\\user”, ‘passwd’);
$request = GET $url;
$response = $ua->request($request);
If ($response->is_success) {
print “It worked \n”;
} else {
print “It didn’t work!->”. $response->status_line. “\n”;
}
exit 0;
</code>
The output of the executing is following, it seems failed into
‘domain\user’ but I am very sure they are definitely correct. For
understand what’s the header received from serve and what’s the header
send to server, I added some debugs into LWP::Authen::Ntlm.pm.
--Performing request now...-----------
WWW-Authenticate
[DEBUG] CHALLENGE=Negotiate
[DEBUG] CHALLENGE=NTLM
[DEBUG] SCHEME=ntlm
[DEBUG] LWP::Authen::Ntlm
[DEBUG] CLASS=LWP::Authen::Ntlm
[DEBUG] set authentication..
[DEBUG] AUTH_HEADER=Authorization
[DEBUG] AUTH_VALUE=NTLM
TlRMTVNTUAABAAAAB7IAAAgACAAgAAAACAAIACgAAAA5NTA4MzEwMXF1YW50YWNu
WWW-Authenticate
[DEBUG]CHALLENGE=NTLM
TlRMTVNTUAACAAAAEAAQADgAAAAFgoECycnz6FvpzbkAAAAAAAAAAI4AjgBIAAAABQLODgAA
AA9SAFMAUQBVAEEATgBUAEEAAgAQAFIAUwBRAFUAQQBOAFQAQQABAA4AUQBTAE0AQwBIAFIA
NQAEABgAUgBTAFEAdQBhAG4AdABhAC4AYwBvAG0AAwAoAHEAcwBtAGMAaAByADUALgBSAFMA
UQB1AGEAbgB0AGEALgBjAG8AbQAFABgAUgBTAFEAdQBhAG4AdABhAC4AYwvAG0AAAAAAA==
[DEBUG] SCHEME=ntlm
[DEBUG] LWP::Authen::Ntlm
[DEBUG] CLASS=LWP::Authen::Ntlm
[DEBUG] set authentication..
[DEBUG] AUTH_HEADER=Authorization
[DEBUG]AUTH_VALUE=NTLM
TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAABAAEABwAAAAEAAQAIAAAAAQABAAkAAAAAAA
AABgAAAABYKBAggWbxPxIvlzDJ3hiLQuhjmp+8VEU0lieYvoguMXSUmUvQY71mMp7lBXXTBh
JqlKk1IAUwBRAFUAQQBOAFQAQQA5ADUAMAA4ADMAMQAwADEAOQA1ADAAOAAzADEAMAAxAA==
WWW-Authenticate
[DEBUG] CHALLENGE=Negotiate
[DEBUG] CHALLENGE=NTLM
[DEBUG] SCHEME=ntlm
[DEBUG] LWP::Authen::Ntlm
[DEBUG] CLASS=LWP::Authen::Ntlm
[DEBUG] set authentication..
[DEBUG] AUTH_HEADER=Authorization
[DEBUG] AUTH_VALUE=NTLM
TlRMTVNTUAABAAAAB7IAAAgACAAgAAAACAAIACgAAAA5NTA4MzEwMXF1YW50YWNu
WWW-Authenticate
[DEBUG]CHALLENGE=NTLM
TlRMTVNTUAACAAAAEAAQADgAAAAFgoECWRPaIWGggukAAAAAAAAAAI4AjgBIAAAABQLODgAA
AA9SAFMAUQBVAEEATgBUAEEAAgAQAFIAUwBRAFUAQQBOAFQAQQABAA4AUQBTAE0AQwBIAFIA
NQAEABgAUgBTAFEAdQBhAG4AdABhAC4AYwBvAG0AAwAoAHEAcwBtAGMAaAByADUALgBSAFMA
UQB1AGEAbgB0AGEALgBjAG8AbQAFABgAUgBTAFEAdQBhAG4AdABhAC4AYwBvAG0AAAAAAA==
[DEBUG] SCHEME=ntlm
[DEBUG] LWP::Authen::Ntlm
[DEBUG] CLASS=LWP::Authen::Ntlm
[DEBUG] set authentication..
[DEBUG] AUTH_HEADER=Authorization
[DEBUG]AUTH_VALUE=NTLM
TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAABAAEABwAAAAEAAQAIAAAAAQABAAkAAAAAAA
AABgAAAABYKBApvnwms/l/oSG7QYwxDH9VtkT+mnvZk//aMD39V1fDNEA2a0x203q0YrkGeD
gGEsdVIAUwBRAFUAQQBOAFQAQQA5ADUAMAA4ADMAMQAwADEAOQA1ADAAOAAzADEAMAAxAA==
WWW-Authenticate
[DEBUG] CHALLENGE=Negotiate
[DEBUG] CHALLENGE=NTLM
[DEBUG] SCHEME=ntlm
[DEBUG] LWP::Authen::Ntlm
[DEBUG] CLASS=LWP::Authen::Ntlm
[DEBUG] set authentication..
[DEBUG] AUTH_HEADER=Authorization
[DEBUG] AUTH_VALUE=NTLM
TlRMTVNTUAABAAAAB7IAAAgACAAgAAAACAAIACgAAAA5NTA4MzEwMXF1YW50YWNu
WWW-Authenticate
[DEBUG]CHALLENGE=NTLM
TlRMTVNTUAACAAAAEAAQADgAAAAFgoECEQHd33XvZEkAAAAAAAAAAI4AjgBIAAAABQLODgAA
AA9SAFMAUQBVAEEATgBUAEEAAgAQAFIAUwBRAFUAQQBOAFQAQQABAA4AUQBTAE0AQwBIAFIA
NQAEABgAUgBTAFEAdQBhAG4AdABhAC4AYwBvAG0AAwAoAHEAcwBtAGMAaAByADUALgBSAFMA
UQB1AGEAbgB0AGEALgBjAG8AbQAFABgAUgBTAFEAdQBhAG4AdABhAC4AYwBvAG0AAAAAAA==
[DEBUG] SCHEME=ntlm
[DEBUG] LWP::Authen::Ntlm
[DEBUG] CLASS=LWP::Authen::Ntlm
[DEBUG] set authentication..
[DEBUG] AUTH_HEADER=Authorization
[DEBUG]AUTH_VALUE=NTLM
TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAABAAEABwAAAAEAAQAIAAAAAQABAAkAAAAAAA
AABgAAAABYKBAqI0gmLHcwsVZ3yOGHWxQT3j92LAZ7UuGAbjRGP4KgMf9pCCLiAIIUAMEm+l
pFbwIVIAUwBRAFUAQQBOAFQAQQA5ADUAMAA4ADMAMQAwADEAOQA1ADAAOAAzADEAMAAxAA==
WWW-Authenticate
[DEBUG] CHALLENGE=Negotiate
[DEBUG] CHALLENGE=NTLM
[DEBUG] SCHEME=ntlm
[DEBUG] LWP::Authen::Ntlm
[DEBUG] CLASS=LWP::Authen::Ntlm
[DEBUG] set authentication..
--Done with request-------------------
It didn't work!->401 Unauthorized
Date: Wed, 12 Oct 2011 09:55:38 GMT
Server: Microsoft-IIS/6.0
WWW-Authenticate: Negotiate
WWW-Authenticate: NTLM
Content-Length: 1251
Content-Type: text/html
Client-Date: Wed, 12 Oct 2011 09:59:31 GMT
Client-Peer: 10.1.1.1:80
Client-Response-Num: 7
Client-Warning: Credentials for 'domain\user' failed before
Title: Äúδ±»ÊÚȨ²é¿´¸ÃÒ³
X-Powered-By: ASP.NET
I also posted it at http://perlmonks.org/?node-id=930728
I am wondering if the type3 header send to server is wrong.