Commit Graph
2 Commits
Author SHA1 Message Date
Lauri Ojansivu 8ab7d46714 Trust the operating system's certificate authorities for TLS.
Since v12.15 the LDAP server's certificate is verified by default, and
Node.js verified it only against the Mozilla list it is built with. A
company root CA installed on the server with update-ca-certificates was
unknown to WeKan, so after upgrading from v12.14 the snap refused LDAPS
logins with UNABLE_TO_VERIFY_LEAF_SIGNATURE.

server/main.js now adds the operating system's CAs to Node's own before any
application code runs: tls.getCACertificates('system'), and the distribution
CA bundle files Go's crypto/x509 reads. The bundle file matters in the snap:
on Debian and Ubuntu snapd keeps the host's /etc/ssl, but the per-CA links
update-ca-certificates makes point into /usr/local/share/ca-certificates,
which the snap sees from its base. Verification is not relaxed - a CA the
system does not have is still refused - and --use-bundled-ca keeps Node's
list only. It covers LDAPS, mail, webhooks and OAuth2 in every launcher.

A refused LDAP certificate now says what to do, in the log and in Admin
Panel's Test connection: install the CA on the server, or set LDAP_CA_CERT.
No hint suggests turning verification off.

tests/systemCaCertificates6762.test.cjs runs a TLS server with a certificate
from a test private CA (its key is not kept) and checks the reported error
without the CA, verification with it in the system bundle, refusal without
it, --use-bundled-ca, and the hints. Two LDAP guards follow the extended
error handling; prune-unreachable-npm.mjs leaves the regex guard's reviewed
list, as it no longer builds a RegExp.

Thanks to fvb-sb and xet7 !

Fixes #6762.
2026-10-12 11:14:34 +03:00
Lauri Ojansivu 9d27f4be4d Make LDAP Test connection prove the directory answered without a service account.
ldapts opens its socket lazily. Test connection connected and then bound only
when LDAP_AUTHENTIFICATION was set, so without a service account no operation
ran and it reported success even for a host that does not resolve. Per the
maintainer decision of 2026-10-08 a test without credentials now does an
anonymous base-scope search of LDAP_BASEDN (no attributes, one entry at most)
and succeeds only when the directory answered; otherwise the directory's own
error is shown. Without a base DN it says nothing could be tested.

Thanks to xet7 !
2026-10-08 10:43:35 +03:00