phantomjs icon indicating copy to clipboard operation
phantomjs copied to clipboard

NTLM auth support

Open arthurva opened this issue 13 years ago • 33 comments

[email protected] commented:

Which version of PhantomJS are you using? Tip: run 'phantomjs --version'. 1.8

Please provide any additional information below. There is currently no support for NTLM authentication. (NTLM is common in the Enterprise field and this is a must in my project)

also see https://groups.google.com/forum/#!topic/phantomjs/EoZ10-9puMk

thanks.

Disclaimer: This issue was migrated on 2013-03-15 from the project's former issue tracker on Google Code, Issue #1037. :star2:   3 people had starred this issue at the time of migration.

arthurva avatar Jan 31 '13 21:01 arthurva

[email protected] commented:

If you can suggest any work-arounds in the interim, please do so, thanks.

sjrosent avatar Jan 31 '13 23:01 sjrosent

Any news on this? I would really like to have NTLM authentication :-)

willemmulder avatar Mar 18 '13 14:03 willemmulder

PhantomJS support NTLMv2 authentication.

Use page.settings to provide values for username/password Doc: https://github.com/ariya/phantomjs/wiki/API-Reference-WebPage#wiki-webpage-settings

vitallium avatar Mar 18 '13 20:03 vitallium

@Vitallium: I would assume the intent of this was for integrated NTLM authentication, i.e. automatically use the credentials of the user that is executing the PhantomJS process.

@willemmulder @sjrosent @arthurva: Can you guys clarify if that was your intent, or is the mechanism that Vitaliy mentioned enough to meet your needs?

JamesMGreene avatar Mar 18 '13 20:03 JamesMGreene

Hmm, I use http://casperjs.org/api.html#casper.setHttpAuth from CasperJS to set the http auth headers. They should do the same as https://github.com/ariya/phantomjs/wiki/API-Reference-WebPage#wiki-webpage-settings (although I did not try that yet)... But what I get is "the requested method is not supported".

I did not necessarily mean for integrated NTLM authentication, but the topic starter might :-)

willemmulder avatar Mar 18 '13 20:03 willemmulder

@JamesMGreene Qt 4.8.4 doesn't support automatic NTLM authentication :(

@willemmulder NTLM authentication doesn't use any of these HTTP headers: HTTP_AUTH_USER or HTTP_AUTH_PW. It uses the Authorization HTTP header.

UPD Never mind, CasperJS sets it in the right way.

UPD2 @willemmulder Did you try to provide the username with the domain value, e.g. mydomain\\username?

vitallium avatar Mar 18 '13 20:03 vitallium

http://darrendev.blogspot.jp/2013/04/phantomjs-post-auth-and-timeouts.html here is a blog said there is a bug when setting username and password with GET request and it suggest use

page.customHeaders={'Authorization': 'Basic '+btoa('username:password')}

to fix it. But the problem is I don't know how to build NTLM encoding string.

raykin avatar Apr 12 '13 05:04 raykin

That might work for Basic authentication, but I assume it doesn't work for NTLM authentication...?

willemmulder avatar Apr 12 '13 08:04 willemmulder

@willemmulder correct. I tested it against NTLM appliaction, it failed. And cant find how to generate NTLM encoding after google.

raykin avatar Apr 12 '13 09:04 raykin

Yeah, too bad... Just wait until it is supported, I guess...!

http://fabricasapiens.nl voor websites

2013/4/12 raykin [email protected]

@willemmulder https://github.com/willemmulder correct. I tested it against NTLM appliaction, it failed. And cant find how to generate NTLM encoding after google.

— Reply to this email directly or view it on GitHubhttps://github.com/ariya/phantomjs/issues/11037#issuecomment-16282767 .

willemmulder avatar Apr 12 '13 09:04 willemmulder

A google for NTLM authentication will give you plenty of resources, but it's not simple.

marksteward avatar Apr 12 '13 09:04 marksteward

Any progress on this? Without NTLM support PhantomJS is a dead end in the enterprise market.

BigBadOwl avatar Jul 11 '13 09:07 BigBadOwl

@BigBadOwl A multi-million-dollar enterprise organization also has another choice: contribute to this project (which is free to use by everyone, including such enterprise entities) to ensure that NTLM works well.

ariya avatar Jul 11 '13 12:07 ariya

@ariya You are of course quite correct. If it meant enough to a big company to have NTLM support, then they could pay a developer with the knowledge and skills to do the work. Unfortunately, I am only using PhantomJS to automate some of my tasks to make my life easier, not something my company would shell out for I'm afraid. Thanks for PhantomJS BTW, it is awesome and most appreciated.

BigBadOwl avatar Jul 11 '13 12:07 BigBadOwl

I have similar requirement where in my enterprise I am behind a firewall with NTLM/Kerberos authentication configured. None of the options --proxy-auth worked for me and I understood there is no NTLM support as of now. I am using PhantomJS 1.9.1. So, I am using a work-around for this by setting a local proxy on my machine (i used OWASP ZAP proxy). I configured my external proxy credentials in the ZAP, and passed my localhost zap proxy url with --proxy=localhost:8080 (i configured zap to run on port 8080 default). It worked like a gem and I am able to connect to external sites as ZAP is capable of doing NTLM authentication. I faced issue with https (SSL) sites later. But I understand the root cause is that the dynamic certificate created by ZAP is not getting validated. So, the moment i put --ignore-ssl-errors=yes, again I got the SSL sites content like a gem. Hope this work around help others too. I am newbie and today is firstday with phantomjs so, I am unaware of any other inbuilt options available to achieve this same instead of taking this workaround.

pkbharigopal avatar Aug 23 '13 18:08 pkbharigopal

@ariya I want to confirm that {"WWW-Authenticate" : "Negotiate [token]"} header is not supported. I tried to manually create a token and set the header, but the http response gives "null" status and empty contents.

Does that mean this header entry is discarded from the request? Thanks.

xinzi avatar Sep 09 '13 07:09 xinzi

For my previous comment, I was wrong. Actually the Kerberos header is accepted. Only the format is: page.customHeaders = {"Authorization": "Negotiate " + [token]};

To test, I accessed a kerberos website using OWASP ZAP to log all the request and response (thanks to @pkbharigopal ), and get the token from request header. Immediately copy the token to phantomjs and it worked!

However, the hard part is to automatically generate the token, you can use following packages: openssl/x509.h gssapi/gssapi.h gssapi/gssapi_krb5.h And a method named: gss_init_sec_context(...);

xinzi avatar Sep 11 '13 18:09 xinzi

Has this been closed? There still does not appear to be NTLM authentication. Thanks

tariqporter avatar Dec 03 '14 02:12 tariqporter

@tariqporter - it is not closed, it is still open. Verkurkie referenced a different issue. That one is closed.

darkroastjava avatar Dec 04 '14 12:12 darkroastjava

@Vitallium, @JamesMGreene, from the follow-up discussion I take it that neither "automatic"/"integrated" NTLM authentication, nor NTML authentication in any form is currently supported. Escpecially after reading @raykin's comments. Is that correct?

darkroastjava avatar Dec 04 '14 13:12 darkroastjava