Shen created DIRMINA-1165:
-----------------------------

             Summary: HttpNTLMAuthLogicHandler do not authenticate if the first 
response received does not contain NTLM challenge
                 Key: DIRMINA-1165
                 URL: https://issues.apache.org/jira/browse/DIRMINA-1165
             Project: MINA
          Issue Type: Bug
            Reporter: Shen


Hello,

I'm using quickfixj 2.3.1 that internally uses mina-core 2.1.14.  I am trying 
to establish Session using HTTP Proxy that uses NTLM authentication.    As part 
of that when the client initiates the connection, proxy responds with 
"Proxy-Authenticate: NTLM" .  There is no challenge text was present in the 
response.  HttpNTLMAuthLogicHandler failed to do do the handshake further and 
disconnected.   

 

While looking that the source code of HttpNTLMAuthLogicHandler, has a comment 
that says reply type1 message to do Handshake.  But while doingHandshake, it 
throws error as challengePacket is empty.

 

14:27:05.899 [QFJ Message Processor] INFO  quickfix.SocketInitiator - Started 
QFJ Message Processor
14:27:05.937 [NioProcessor-2] DEBUG o.a.mina.proxy.filter.ProxyFilter - Session 
created: (0x00000001: nio socket, client, /10.0.0.42:57284 => 
pxyapp.aus.thenational.com/100.64.1.59:8080)
14:27:05.937 [NioProcessor-2] DEBUG o.a.mina.proxy.filter.ProxyFilter -   get 
proxyIoSession: org.apache.mina.proxy.session.ProxyIoSession@1f3a49b1
14:27:05.942 [NioProcessor-2] DEBUG o.a.m.p.h.http.HttpSmartProxyHandler -  
doHandshake()
14:27:05.942 [NioProcessor-2] DEBUG o.a.m.p.h.http.HttpSmartProxyHandler -   
sending HTTP request
14:27:05.960 [NioProcessor-2] DEBUG o.a.m.p.h.h.AbstractHttpLogicHandler -    
write:
CONNECT 169.33.100.45:13353 HTTP/1.0\r\n
Keep-Alive: 300\r\n
Proxy-Connection: keep-Alive\r\n
\r\n

14:27:05.966 [NioProcessor-2] DEBUG o.a.m.p.AbstractProxyLogicHandler -    
session write: HeapBuffer[pos=0 lim=87 cap=87: 43 4F 4E 4E 45 43 54 20 31 36 39 
2E 33 33 2E 31]
14:27:05.969 [NioProcessor-2] DEBUG o.a.mina.proxy.filter.ProxyFilter -    
handshake data: HeapBuffer[pos=0 lim=87 cap=87: 43 4F 4E 4E 45 43 54 20 31 36 
39 2E 33 33 2E 31]
14:27:05.973 [NioProcessor-2] DEBUG o.a.m.p.event.IoSessionEventQueue - ??? >> 
Enqueue IoSessionEvent@2afcfd8 - [ (0x00000001: nio socket, client, 
/10.0.0.42:57284 => pxyapp.aus.thenational.com/100.64.1.59:8080), - CREATED 
event -]
14:27:05.974 [NioProcessor-2] DEBUG o.a.m.p.event.IoSessionEventQueue - 
Enqueuing event: IoSessionEvent@2afcfd8 - [ (0x00000001: nio socket, client, 
/10.0.0.42:57284 => pxyapp.aus.thenational.com/100.64.1.59:8080), - CREATED 
event -]
14:27:05.974 [NioProcessor-2] DEBUG o.a.m.p.event.IoSessionEventQueue - ??? >> 
Enqueue IoSessionEvent@5fc6fd03 - [ (0x00000001: nio socket, client, 
/10.0.0.42:57284 => pxyapp.aus.thenational.com/100.64.1.59:8080), - OPENED 
event -]
14:27:05.974 [NioProcessor-2] DEBUG o.a.m.p.event.IoSessionEventQueue - 
Enqueuing event: IoSessionEvent@5fc6fd03 - [ (0x00000001: nio socket, client, 
/10.0.0.42:57284 => pxyapp.aus.thenational.com/100.64.1.59:8080), - OPENED 
event -]
14:27:05.975 [NioProcessor-2] DEBUG o.a.mina.proxy.event.IoSessionEvent - 
Delivering event IoSessionEvent@5fc6fd03 - [ (0x00000001: nio socket, client, 
/10.0.0.42:57284 => pxyapp.aus.thenational.com/100.64.1.59:8080), - OPENED 
event -]
14:27:05.976 [NioProcessor-2] DEBUG o.a.m.proxy.AbstractProxyIoHandler - 
Filtered session opened event !
14:27:06.012 [NioProcessor-2] DEBUG o.a.mina.proxy.filter.ProxyFilter -  Data 
Read: org.apache.mina.proxy.handlers.http.HttpSmartProxyHandler@342a98c 
(HeapBuffer[pos=0 lim=2048 cap=2048: 48 54 54 50 2F 31 2E 30 20 34 30 37 20 61 
75 74])
14:27:06.013 [NioProcessor-2] DEBUG o.a.mina.proxy.filter.ProxyFilter -  
Pre-handshake - passing to handler
14:27:06.013 [NioProcessor-2] DEBUG o.a.m.p.h.h.AbstractHttpLogicHandler -  
messageReceived()
14:27:06.016 [NioProcessor-2] DEBUG o.a.m.p.h.h.AbstractHttpLogicHandler -   
response header received:
HTTP/1.0 407 authenticationrequired\r\n
Date: Fri, 13 May 2022 04:27:05 GMT\r\n
Content-Type: text/html\r\n
Cache-Control: no-cache\r\n
Content-Length: 4150\r\n
X-Frame-Options: deny\r\n
Proxy-Connection: Keep-Alive\r\n
Proxy-Authenticate: NTLM\r\n
Proxy-Authenticate: Basic realm="AUR Domain"\r\n
\r\n

14:27:06.017 [NioProcessor-2] DEBUG o.a.m.p.h.h.AbstractHttpLogicHandler -   
parseResponse()
14:27:06.019 [NioProcessor-2] DEBUG o.a.mina.proxy.filter.ProxyFilter -  Data 
Read: org.apache.mina.proxy.handlers.http.HttpSmartProxyHandler@342a98c 
(HeapBuffer[pos=0 lim=2375 cap=4096: 6E 74 2E 77 72 69 74 65 28 22 3C 74 72 3E 
3C 74])
14:27:06.019 [NioProcessor-2] DEBUG o.a.mina.proxy.filter.ProxyFilter -  
Pre-handshake - passing to handler
14:27:06.019 [NioProcessor-2] DEBUG o.a.m.p.h.h.AbstractHttpLogicHandler -  
messageReceived()
14:27:06.019 [NioProcessor-2] DEBUG o.a.m.p.h.h.AbstractHttpLogicHandler -   
end of response received:
HTTP/1.0 407 authenticationrequired
Date: Fri, 13 May 2022 04:27:05 GMT
Content-Type: text/html
Cache-Control: no-cache
Content-Length: 4150
X-Frame-Options: deny
Proxy-Connection: Keep-Alive
Proxy-Authenticate: NTLM
Proxy-Authenticate: Basic realm="AUR Domain"

14:27:06.024 [NioProcessor-2] DEBUG o.a.m.p.h.http.HttpSmartProxyHandler -  
doHandshake()
14:27:06.024 [NioProcessor-2] DEBUG o.a.m.p.h.h.n.HttpNTLMAuthLogicHandler -  
doHandshake()
14:27:06.025 [NioProcessor-2] DEBUG o.a.m.p.event.IoSessionEventQueue - ??? >> 
Enqueue IoSessionEvent@4544524f - [ (0x00000001: nio socket, client, 
0.0.0.0/0.0.0.0:57284 => null), - CLOSED event -]
14:27:06.026 [NioProcessor-2] DEBUG o.a.m.p.event.IoSessionEventQueue - Event 
queue CLEARED



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to