Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: LDAP fails verification when using self-signed certs #35792

Open
7 of 9 tasks
jkman340 opened this issue Dec 15, 2022 · 1 comment
Open
7 of 9 tasks

[Bug]: LDAP fails verification when using self-signed certs #35792

jkman340 opened this issue Dec 15, 2022 · 1 comment
Labels
1. to develop Accepted and waiting to be taken care of enhancement feature: ldap

Comments

@jkman340
Copy link

⚠️ This issue respects the following points: ⚠️

  • This is a bug, not a question or a configuration/webserver/proxy issue.
  • This issue is not already reported on Github (I've searched it).
  • Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
  • Nextcloud Server is running on 64bit capable CPU, PHP and OS.
  • I agree to follow Nextcloud's Code of Conduct.

Bug description

I'm running Nextcloud with Docker:
Nextcloud vs 24.0.5-apache
MariaDB 10.5.16

I have Nextcloud configured for LDAP authentication to OpenLDAP (LDAPS). The LDAP server certificate is signed by an internal/private CA. I have added the CA certificate to Nextcloud using the 'occ security:certificates:import' command and verified the CA certificate exists with 'occ security:certificates' command. However, Nextcloud still fails to connect to the LDAP server with a TLS verification failure.

The only work around I have found is to add the CA certificates to the running container's trusted certificates file '/etc/ssl/certs/ca-certificates.crt'. After the CA is added here, LDAPS succeeds.

This can be done by copying the CA cert to /usr/local/share/ca-certificates and running update-ca-certificates internally on container or by bind mounting the CA cert directly to /etc/ssl/certs/ca-certificates.crt with docker.

Steps to reproduce

Expected behavior

I would expect adding the CA Certificate via the occ:security:certificates interface would be sufficient for LDAPS.

Installation method

Community Docker image

Operating system

Debian/Ubuntu

PHP engine version

None

Web server

Apache (supported)

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

Fresh Nextcloud Server install

Are you using the Nextcloud Server Encryption module?

Encryption is Enabled

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

No response

List of activated Apps

.

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

No response

@jkman340 jkman340 added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Dec 15, 2022
@szaimen szaimen transferred this issue from nextcloud/server Dec 15, 2022
@kesselb
Copy link
Contributor

kesselb commented Dec 15, 2022

Thanks for your bug report 👍

The only work around I have found is to add the CA certificates to the running container's trusted certificates file '/etc/ssl/certs/ca-certificates.crt'.

I believe your "work around" is already the best solution. If you prefer not to trust the certificate "globally" it's possible to overwrite TLS_CACERT via ldap.conf (https://linux.die.net/man/5/ldap.conf).

I have added the CA certificate to Nextcloud using the 'occ security:certificates:import' command and verified the CA certificate exists with 'occ security:certificates' command.

I agree, we should document the applicability of the imported certificates. In my opinion, our own "certificate managment" add unnecessary complexity (c.f. #32963).

Unfortunately, occ security:certificates is here and request to use our certificate bundle for LDAPs connections seems reasonable.

CertificateManager:
https://github.com/nextcloud/server/blob/master/lib/private/Security/CertificateManager.php

CertificateManager.getAbsoluteBundlePath gives you the path to the bundle.

LDAP Connection:

private function doConnect($host, $port) {

Connection.doConnect does the actual connect. I assume we have to inject the CertificateManager here and use a $this->ldap->setOption to set LDAP_OPT_X_TLS_CACERTFILE to the absolute bundle path.

I am afraid that some setups use a self-signed certificate for the LDAP connection. A configuration option to use the bundled certificate should be added to the LDAP app.

@kesselb kesselb transferred this issue from nextcloud/docker Dec 15, 2022
@kesselb kesselb added 1. to develop Accepted and waiting to be taken care of and removed 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop Accepted and waiting to be taken care of enhancement feature: ldap
Projects
None yet
Development

No branches or pull requests

3 participants