Ok, I couldn't just leave it.
I contacted someone via upwork.com and had the
https://github.com/gautamsi/node-ntlm-client translated into plain JavaScript.
In tests outside ISAM this works fine. It even runs in ISAM, but there is one very last error (at least, I hope it's the last one) that I'm afraid I won't be able to solve myself. I'm using HTTPClient to set up a connection from ISAM to the back-end NTLM server (https://www.stephen-swann.co.uk/javadoc/sam9.0/com.ibm.security.access.common/com/ibm/security/access/httpclient/HttpClient.html).
I took a packet trace on ISAM to see what was going wrong, this is my first (out of 2) NTLM request:
GET /***redacted***
Connection: close
Authorization: NTLM TlRM***redacted***==
Cache-Control: no-cache
Pragma: no-cache
User-Agent: Java/1.8.0_171
Host: ***redacted***
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
The problem is the first header: Connection: close.
If I send a connection: close in my test client outside ISAM, the complete NTLM exchange fails. This is normal: for NTLM there need to be at least two requests and one response. If the server thinks it can disconnect after the first request, then there is an issue.
Is there anyway I can modify this header to 'Connection: keep-alive'?
Michael
update: more info about the necessity for keep-alives when using NTLM:
http://www.benjaminathawes.com/2010/10/14/ntlms-dependency-on-http-keep-alives-another-cause-of-the-dreaded-401-1-error/ (not that this is about the server headers, but it also counts for client headers).
update 2:
------------------------------
Michael
------------------------------
Original Message:
Sent: 01-11-2019 10:47 AM
From: Michael Boey*****
Subject: NTLM workarounds
I tried it using a patched version of the NTLM JS library: https://github.com/hdeshev/nativescript-ntlm-demo/blob/master/app/ntlm.js .
Changes to get it running were minimal, but I did not succeed and my assumption is that it is because that library only seems to support NTLM 56 bit encryption, whereas most modern applications / servers demand the use of NTLM 128 bit encryption. Also, it seems there is something like signing of NTLM, which also does not seem to be supported by that library.
The nodeJS library (https://github.com/beyond-sharepoint/ntlm-remote-auth/blob/master/lib/ntlm.js) seems to include the missing features, but converting that to plain JS seems like a daunting task. Perhaps one day someone will try that :).
Fun experience, too bad I couldn't get it to work.
Kr,
Michael
------------------------------
Michael
Original Message:
Sent: 01-08-2019 11:52 AM
From: Peter Volckaert
Subject: NTLM workarounds
Hi Michael,
Not just any Javascript is ok, it must conform to JavaScript 1.7.
More specs and tips on this link: https://www.ibm.com/support/knowledgecenter/SSPREK_9.0.6/com.ibm.isam.doc/config/task/tsk_managingmappingrules.html
Cheers, Peter.
------------------------------
Peter Volckaert
Sales Engineer
IBM Security
Original Message:
Sent: 01-08-2019 11:13 AM
From: Michael Boey*****
Subject: NTLM workarounds
Hi,
Thanks for the answers.
We wish to investigate the JS option a bit further, just to be sure: is any Javascript supported on ISAM or are there restrictions?
Btw, the previous examples were nodejs modules, this one seems to be plain JS: https://github.com/erlandranvinge/ntlm.js/tree/master
------------------------------
Michael
Original Message:
Sent: 12-20-2018 08:39 AM
From: Jon Harry
Subject: NTLM workarounds
Hi Michael,
A mapping rule containing JavaScript that can implement NTLM is an interesting idea but I wonder how communication between the InfoMap and the backend service would work. An InfoMap doesn't have any direct influence over what is sent over a junction.
One idea might be to have the InfoMap talk directly to the backend server and perform an NTLM login. Once complete, the backend server would (presumably) set a cookie to maintain logged-in state for the session. If you could capture that cookie and get it set in the browser (or in the Reverse Proxy cookie-jar) with path=/ then it might be possible to have that session used for requests via the ntlm-server's junction.
Quite a few "ifs" in the above but given the eventual success with the GSO issue I suggest it in case you want to investigate further.
Cheers... Jon.
------------------------------
Jon Harry
Consulting IT Security Specialist
IBM
Original Message:
Sent: 12-20-2018 03:37 AM
From: Michael Boey*****
Subject: NTLM workarounds
Hi Peter,
That might be a valid alternative indeed. The one downside is of course that we introduce a new component, which we'd have to set up HA and maintain. I'll investigate it a bit futher internally.
Perhaps another alternative is a mapping rule which speaks NTLM? I see some people tried to implement NTLM in JS:
- https://libraries.io/npm/@beyond-sharepoint%2Fntlm-remote-auth
- https://github.com/beyond-sharepoint/ntlm-remote-auth/blob/master/lib/ntlm.js
------------------------------
Michael
Original Message:
Sent: 12-20-2018 12:56 AM
From: Peter Volckaert
Subject: NTLM workarounds
Hi Michael, since WebSEAL does not speak NTLM, I was thinking of a gateway between WebSEAL and the NTLM-capable back-end. There seems to be an Java-based httpclient from Apache that could be useful. See here: https://hc.apache.org/httpcomponents-client-4.5.x/ntlm.html. WebSEAL could then send just about anything to that gateway; anything that contains what NTLM needs: a username and password. It could f.i. be a BA junction using your newly developed GSO web service.
All in all, this looks like an adventure.
Cheers, Peter.
------------------------------
Peter Volckaert
Sales Engineer
IBM Security
Original Message:
Sent: 12-19-2018 11:39 AM
From: Michael Boey*****
Subject: NTLM workarounds
Hello,
Following my (successfully solved) question about Forms-based SSO, we have another legacy technology which we are phasing out, but still exists. Again, I'm fully aware that it might be a better idea to move to other protocols, but it is a reality that some applications still speak NTLM.
So what we'd like to achieve is:
User => Internet ======> ISAM Webseal ===NTLM===> back-end app
We know that NTLM is not supported anymore in ISAM. Is there someone who has a valid alternative in case we cannot get the back-end application to move away from NTLM(v2)?
------------------------------
Michael
------------------------------