verdaccio-ldap icon indicating copy to clipboard operation
verdaccio-ldap copied to clipboard

support secure protocol

Open smelukov opened this issue 7 years ago • 5 comments

When we use ldaps://... in the config then we get an error

 fatal--- uncaught exception, please report this
Error: unable to get local issuer certificate
    at TLSSocket.<anonymous> (_tls_wrap.js:1105:38)
    at emitNone (events.js:106:13)
    at TLSSocket.emit (events.js:208:7)
    at TLSSocket._finishInit (_tls_wrap.js:639:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:469:38)

smelukov avatar Jul 16 '18 12:07 smelukov

The reason is self-signed certificate

smelukov avatar Jul 17 '18 09:07 smelukov

For self signed certificate you can add:

auth:
  ldap:
    type: ldap
    groupNameAttribute: 'cn'
    client_options:
      tlsOptions:
        rejectUnauthorized: false

Alexandre-io avatar Jul 24 '18 12:07 Alexandre-io

@Alexandre-io rejectUnauthorized is deprecated We were passed certificates content instead of rejectUnauthorized

smelukov avatar Jul 24 '18 15:07 smelukov

For anyone wondering, here is a way to tell a Dockerized Node to trust some certificates:

  • Place your certificates (as PEM) into a extra-certs.pem file (on your host)
  • Make sure this file extra-certs.pem gets copied into image's directory /verdaccio/conf (eg. docker run -v /some/path/on/host/my_verdaccio_docker/conf:/verdaccio/conf/).
  • Add --env NODE_EXTRA_CA_CERTS=/verdaccio/conf/extra-certs.pem to the docker run command.

C-Duv avatar Oct 10 '18 13:10 C-Duv

@C-Duv Does this apply only for the Docker-Version or for a general npm setup on bare metal? I tired to debug it myself but when clicking login, the application just sits there and no logfile entry is generated until it says "couldn't log in" after like 30 seconds - even in debug mode. Would appreciate some help from @smelukov or @Alexandre-io on how to fix that, since clear text ldap is a no-go from a security perspective.

EDIT: OK it seems like the port in the URL was causing the problems. I don't know where I got that from but there are so many ldap exmaples for verdaccio out there, that I probably got an outdated example.

jzielke84 avatar Nov 13 '19 08:11 jzielke84