0

I have an app built with NodeJS v18 (running on a Debian 11 docker container) that tries to authenticate in an Active Directory running on Windows Server 2008. I'm using ldapjs.

The authentication should run through TLS:

var options = {
    'rejectUnauthorized': false,
    'requestCert': false,
};

var client= ldap.createClient({
    url: 'ldap://my_active_directory:389',
    tlsOptions: options
});

client.starttls(options,[], function(err) {
    console.log('error starttls:', err);

    client.bind('cn=test,dc=my,dc=server', 'password', [], function(err) {
        console.log('bind error:', err);
    });
});

But, this authentication does not work. Besides this project, we have a PHP system which authenticates on the same AD, using the same parameters (it´s a Laravel project using the LdapRecord library. It has an option to enable TLS authentication).

Both projects are running on Debian 11.

The error message is: Client network socket disconnected before secure TLS connection was established.

I tried to force Node to use a lower TLS version such as TLSv1, TLSv1.1 and TLSV1.2. This didn't work.

Victor Leal
  • 1,055
  • 2
  • 12
  • 28

1 Answers1

0

Have you tried:

process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';

This will tell Node to ignore issues with the certificates, this is especially needed if you're using self-signed certs internally.

Michael
  • 21
  • 5