PASSPORT-LDAPAUTH:Error: Client network socket disconnected before secure TLS connection was established at connResetException

Viewed 273

Good evening, I have an authentication problem with the "passport-ldapauth" module. When I authenticate, an error message appears: "Error: Client network socket disconnected before the secure TLS connection was established at connResetException".

Here is my code:

Config.js

var express      = require('express'),
    passport     = require('passport'),
    bodyParser   = require('body-parser'),
    LdapStrategy = require('passport-ldapauth'),
    fs = require('fs');
var conf = { 
  GARDIAN : {
    server: {
      url: 'ldaps://server.com:636',
      bindDN: 'uid=..,ou=...,dc=...',
      bindCredentials: 'mdpadmin',
      searchBase: 'ou=...,dc=...',
      searchFilter: '(uid={{username}})',
      tlsOptions: {
        ca: [fs.readFileSync('/chemin vers certificat.crt')],
      }
    }
 } 

var app = express();

  passport.use(new LdapStrategy(conf.GARDIAN));
  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({extended: false}));
  app.use(passport.initialize());

app.post('/login', passport.authenticate('ldapauth', {session: false}), function(req, res) {
  res.send({status: 'ok'});
});

Version

 node: '12.13.0',
  v8: '7.7.299.13-node.12',
  uv: '1.32.0',
  zlib: '1.2.11',
  brotli: '1.0.7',
  ares: '1.15.0',
  modules: '72',
  nghttp2: '1.39.2',
  napi: '5',
  llhttp: '1.1.4',
  http_parser: '2.8.0',
  openssl: '1.1.1d',
  cldr: '35.1',
  icu: '64.2',
  tz: '2019a',
  unicode: '12.1'

ERROR:

Error: Client network socket disconnected before secure TLS connection was established at connResetException (internal/errors.js:570:14) at TLSSocket.onConnectEnd (_tls_wrap.js:1361:19) at Object.onceWrapper (events.js:299:28) at TLSSocket.emit (events.js:215:7) at TLSSocket.EventEmitter.emit (domain.js:476:20) at endReadableNT (_stream_readable.js:1183:12) at processTicksAndRejections (internal/process/task_queues.js:80:21)

0 Answers
Related