-
Notifications
You must be signed in to change notification settings - Fork 458
LDAPS (ldap over ssl) working with ssl certificates #307
Comments
Because ldapjs uses the tls.TLSSocket/tls.TLSServer API for TLS sockets, I would suggest looking to that documentation in order to interpret any errors you may be observing. |
Thanks prmooney. can you please give some examples how to start TLS in ldap. Because i spent much time starting TLS but i was not successful. But LDAP with SSL was successfully working for me. That's why i chose ssl. |
And also it was working fine with the above code snippet on same machines. |
I'm stuck at this problem for days. Please guide me |
I would suggest starting with the node.js documentation on TLS. |
yes i have followed the documentation https://nodejs.org/api/tls.html Also tried following code snippet and other combinations as well var tls = require('tls'); var options = { // This is necessary only if using the client certificate authentication. // This is necessary only if the client uses the self-signed certificate. var server = tls.createServer(options, function(socket) { But get the exception i.e., |
I'm continuously getting below error: events.js:72 Following is my server-side code: var tlsOptions= { var server = tls.createServer(tlsOptions, function(socket) { Following is my client-side code: var server = tls.connect(8001,tlsOptions, function() {
} server.setEncoding('utf8'); |
Hi pfmooney! I have spent a lot of time discovering the solution. The following code works fine in my case. Just wanted a little bit guidance. Please have a look on following code and tell me is it the correct approach? //Server.js file var fs = require('fs'); var tlsOptions = { var server = tls.createServer(tlsOptions, function(socket) { //Client.js file var fs = require('fs'); var tlsOptions = { var server = tls.connect(8002,tlsOptions,function() {
//Perform LDAP search operation
}); server.on('secureConnect',function(data){ server.on('error', function(error) { |
Hi @aneelaSaleem @pfmooney Were you able to get a final solution for this? I am also facing a similar issue. |
Please use backticks for syntax highlighting, it's much easier to read ```js |
I'm sorry to bump this, but I am still unable to use the createClient to connect to an OpenLDAP server using a certificate key:crt pair. I've been looking for days and trying so many ways of doing this, and I still am unable to get anything to work. Can someone please give a concrete example of how this works using this API? The documentation doesn't even cover the basics. I've also looked at the source code and I can't really make out how it is handled either. I'm out of options here... |
Had a similar issue here but solved it by #229 Unsure though if that's satisfactory for you, since it doesn't involve actually using certificates, though it does connect to a secure LDAPS server successfully with
The LDAPS server I am talking to seems to accept this. |
If you've come here looking for an implementation of SASL ldapts has an implementation on v3.2.0 |
👋 On February 22, 2023, we released version 3 of this library. As a result, we are closing this issue/pull request. Please see issue #839 for more information, including how to proceed if you feel this closure is in error. |
hi all,
i have generated self-signed certificate and i have used following code snippet to access certificates on same machine while using ldaps:///
var tlsOptions = {
// This is necessary only if the server uses the self-signed certificate
ca: [ fs.readFileSync('/etc/ldap/cacert.pem') ]
};
var ldap = require('ldapjs');
var client = ldap.createClient({url: 'ldaps://plat.com:636',tlsOptions: tlsOptions});
this works fine if the ldap server and certificate are on same machine, but it fails if the ldap server is on remote machine.
any help/guidance regarding such issue?
The text was updated successfully, but these errors were encountered: