-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow you to specify a ca certificate file #118
base: master
Are you sure you want to change the base?
Conversation
jjhoughton
commented
Nov 2, 2019
•
edited
Loading
edited
Didn't mean to do a pull against this repo just yet will reopen once i've tested it |
The intended way of handling a custom root CA is to use the system-wide mechanism to add teh root CA (follow the instructions that accompany all the other libldap tools). If you can get the command line ldapsearch to connect with your LDAP server, then node-ldap will do so as well. |
yes I couldn't get this to work for some reason. Even with a legit (non self signed) cert from go daddy
This was using your library |
Have you ever managed to get this working yourself? Maybe it's the build of node I'm using but certificate validation doesn't seem to be working correctly. I know if I make a https request it works fine. I'm using centos7 and node 8 |
This is the important part of the error above:
You need to install the root CA cert for GoDaddy globally for the machine. This is an openSSL thing - a couple of quick searches will find instructions for doing this. In short, if you can't run This binding uses openldap libraries, which are linked to your openSSL libraries, so openSSL rules are in effect. |
Further, don't get confused: this cert error has nothing to do with node, https, or anything other then libopenldap (which is linked to openssl's libssl). Get openldap working, then this node binding will start working. |
Hi Jeremy Really appreciate your time replying to the ticket. We have tried We also tried
compared with the logs from node-LDAP
We have tried this on a fresh installed box too in case the certs had been tampered with, but we are facing the same issue. It is odd that nobody has reported problems with certs signed by a root CA so we think it is probably something in our environment. Have you had this working yourself? Kind regards Josh |
Been using it for years using global configuration (which is quite valuable as it synchronizes This is new to me: https://fedoraproject.org/wiki/OpenLDAP-and-MozNSS-Compatibility-Layer SO - the trick here is to get the debug output for
I'd try meddling with some env vars to see if you can get the aboive to change:
|
Hi Jeremy, We have previously tried those environment variables plus those listed in the man page for ldap.conf (TLS_*) but none seem to have an effect in node. We just tried it on a fresh install and they still appear as (null). Installed Packages Out of interest how to does compare to the version and operating system you are using? Josh |
FreeBSD/openLDAP I think the main issue is that it's now MozNSS under the hood for you, and the behaviour has changed. I'm always loathe to add multiple ways of doing the same thing, but in this case, since we're backed into a corner, let's do the pull request above. |
So not even Linux! I agree with you it's not ideal. I'd like to do some investigation first as to why it's not working now that I know it's working on BSD. If I can't figure out why I'll test the above pr and get it ready for merging as I still haven't tested it yet. This was why I closed it originally. |
9414ff7
to
72b7457
Compare
A lot of firms will use their own Certificate Authority on their internal network. When using such a setup previously the only option was to turn certificate validation off. reference https://linux.die.net/man/3/ldap_set_option This patch was originall written by James Moxon and was taken from here: jjhoughton/napi-ldap#1 NOTE: The string gets duplicated when calling ldap_set_option so NOTE: there should be no use after free errors. openldap-2.4.48/libraries/libldap/tls2.c: 761 case LDAP_OPT_X_TLS_CACERTFILE: if ( lo->ldo_tls_cacertfile ) LDAP_FREE( lo->ldo_tls_cacertfile ); lo->ldo_tls_cacertfile = (arg && *(char *)arg) ? LDAP_STRDUP( (char *) arg ) : NULL; return 0; Signed-off-by: James Moxon <[email protected]> Signed-off-by: Joshua Houghton <[email protected]> Reviewed-by: SteveJM
72b7457
to
22901ff
Compare
336d145
to
259226f
Compare