I am trying to connect to an IMAP email server through a proxy using desproxy and Cntlm Authentication Proxy.
cntlm.exe -c cntlm.ini -v
desproxy imap.gmail.com 993 127.0.0.1 3128 1080
openssl s_client -connect 127.0.0.1:1080
Please note in the desproxy output that in the error webpage that the username is blank. (In Internet Explorer, whenever I go to a webpage that does not exist, in the error webpage I can see my username, however in Firefox, I do not. In Internet Explorer, my username is TREE\user@ntlm )
cntlm.ini
Username user
Domain tree
Password my_password
Proxy 5.10.15.20:8080
Listen 3128
C:\>cntlm.exe -c cntlm.ini -M http://www.example.com
Config profile 1/11... Auth request ignored (HTTP code: 1)
Config profile 2/11... Auth request ignored (HTTP code: 1)
Config profile 3/11... Auth request ignored (HTTP code: 1)
Config profile 4/11... Auth request ignored (HTTP code: 1)
Config profile 5/11... Auth request ignored (HTTP code: 1)
Config profile 6/11... Auth request ignored (HTTP code: 1)
Config profile 7/11... Auth request ignored (HTTP code: 1)
Config profile 8/11... Auth request ignored (HTTP code: 1)
Config profile 9/11... Auth request ignored (HTTP code: 1)
Config profile 10/11... Auth request ignored (HTTP code: 1)
Config profile 11/11... Auth request ignored (HTTP code: 1)
You have used wrong credentials, bad URL or your proxy is quite insane,
in which case try submitting a Support Request.
C:\>cntlm.exe -c cntlm.ini -v
cntlm: Proxy listening on 127.0.0.1:3128
cntlm: Resolving proxy 5.10.15.20...
cntlm: Workstation name used: PC
cntlm: Using following NTLM hashes: NTLMv2(1) NT(0) LM(0)
cntlm: PID 4512: Cntlm ready, staying in the foreground
cntlm: PID 4512: Connection accepted from 127.0.0.1:51563
Thread processing...
******* Round 1 C: 4, S: 5 *******!
Reading headers...
HEAD: CONNECT imap.gmail.com:993 HTTP/1.1
Host => imap.gmail.com:993
User-Agent => Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)
NTLM Request:
Domain: tree
Hostname: PC
Flags: 0xA208B205
Sending auth request...
Host => imap.gmail.com:993
User-Agent => Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)
Proxy-Connection => Keep-Alive
Proxy-Authorization => NTLM TlRMTVNTUAABAAAABbIIogMAAwAmAAAABgAGACAAA
ABMU0YwMTFVRFM=
Reading auth response...
HEAD: HTTP/1.1 407 Proxy Authentication Required
Mime-Version => 1.0
Date => Thu, 01 Sep 2011 12:36:33 BST
Content-Type => text/html
Proxy-Authenticate => NTLM TlRMTVNTUAACAAAABgAGADAAAAAFgomiAycbhm2QB
3gAAAAAAAAAAGAAYAA2AAAAVQBEAFMAAgAGAFUARABTAAEACgBJAFcAUwBBADEABAAYAG4AdQBpAGcAY
QBsAHcAYQB5AC4AaQBlAAMAJABpAHcAcwBhADEALgBuAHUAaQBnAGEAbAB3AGEAeQAuAGkAZQAAAAAA
Connection => keep-alive
Proxy-Connection => keep-alive
Content-Length => 0
NTLM Challenge:
Challenge: 03271B866D900778 (len: 150)
Flags: 0xA2898205
NT domain: TREE
Server: SERVER
Domain: example.com
FQDN: server.example.com
TBofs: 54
TBlen: 96
ttype: 0
NTLM Response:
Hostname: 'PC'
Domain: 'tree'
Username: 'user'
Response: '19EDCAAF14E174781DF7614A514E68AD010100000000000080B627669B68
CC011F30327B6EB20917000000000200060055024400530001000A00490057005300410031000400
18006E0075006900670061006C007700610079002E00690065000300240069007700730061003100
2E006E0075006900670061006C007700610079002E00690065000000000000000000' (144)
Response: '3A238618A402160C83EB0D67200D7C5F1F30327B6EB20917' (24)
Sending headers...
Host => imap.gmail.com:993
User-Agent => Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)
Proxy-Connection => Keep-Alive
Proxy-Authorization => NTLM TlRMTVNTUAADAAAAGAAYAGIAAACQAJAAegAAAAYAB
gBAAAAAEAAQAEYAAAAMAAwAVgABAAAAAAAKAQAABYKJolUARABTADAAOQAyADMAMgA1ADYAOQBMAFMAR
gAwADEAMQA6I4YYpAIWDIPrDWcgDXxfHzAye26yCRcZ7cqvFOF0eB9zYUpRTmitAQEAAAAAAACAtidmm
2jMAR8wMntusgkXAAAAAAIABgBVAEQAUwABAAoASQBXAFMAQQAxAAQAGABuAHUAaQBnAGEAbAB3AGEAe
QAuAGkAZQADACQAaQB3AHMAYQAxAC4AbgB1AGkAZwBhAGwAdwBhAHkALgBpAGUAAAAAAAAAAAA=
No body.
******* Round 2 C: 4, S: 5 *******!
Reading headers...
HEAD: HTTP/1.1 407 Proxy Authentication Required
Mime-Version => 1.0
Date => Thu, 01 Sep 2011 12:36:33 BST
Content-Type => text/html
Proxy-Authenticate => NTLM
Connection => close
Proxy-Connection => close
Content-Length => 1659
Sending headers...
Body included. Lenght: 1659
data_send: read 1659 of 1659 / 1659 of 1659 (errno = ok)
data_send: wrote 1659 of 1659
Body sent.
PROXY CLOSED CONNECTION
Thread finished.
Joining thread 14425248; rc: 0
cntlm: PID 4512: Signal 2 received, issuing clean shutdown
cntlm: PID 4512: Terminating with 0 active threads
C:\>desproxy imap.gmail.com 993 127.0.0.1 3128 1080
-----------------------------------
desproxy 0.1.0-pre3
(C) 2003 Miguelanxo Otero Salgueiro
-----------------------------------
TCP port 1080 Bound & Listening
Press <Control+C> to Quit
Connection request from 127.0.0.1, port 51528
Connecting to http proxy (127.0.0.1:3128)
Mime-Version: 1.0
Date: Thu, 01 Sep 2011 12:36:19 BST
Content-Type: text/html
Proxy-Authenticate: NTLM
Connection: close
Proxy-Connection: close
Content-Length: 1659
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Notification: Proxy Authorization Required</title>
</head>
<body>
<img src="http://www.example.com/logo.png" border="0">
<h1>This Page Cannot Be Displayed</h1>
<hr>
<p>
Authentication is required to access the Internet using this system.
A valid user ID and password must be entered when prompted.
</p>
<hr>
<p>If you have any queries about access to this webpage, please contact the <a h
ref="<a href="http://www.example.com/information-solutions-and-services/">ISS">http://www.example.com/information-solutions-and-services/">ISS</a> Service Desk </a> ( <a href="mailto:servicedesk@example.com">servicedesk@example.com </a>) and provide the following details:</p>
<p> Username << >>, IP address << 1.2.3.4 >> and URL << imap.gmail.com >> </p>
</body>
</html>
connect_host_to_proxy: ERROR
Connection #0: end of connection