Add CA certificate for LDAPS on docker image

Nextcloud version (docker image): nextcloud:21-fpm-alpine
Operating system and version (Host): Arch Linux on ARM (Kernel 5.10.44)
Docker version: 1.20.10

Hi everybody,

I recently installed Nextcloud via docker onto my Raspberry Pi. As I run a view other services I have a central user repository via LDAP. I also configured my Nextcloud installation to use that repository, which worked perfectly out of the box.

Now I’m trying to change the connection to LDAPS, which was a bit trickier, but in the end I got it to work almost perfectly. The only problem is, that it only works when i disable server certificate verification within Nextcloud, as it doesn’t know about my ca.crt file. How can I configure it, to use it?

Some more info:

  • The certificate and LDAP server configuration work, as it worked fine when I tested it multiple times via ldapsearch.
  • When I tell Nextcloud to not validate the certificate, everything works.

Things I tried:

  • I followed the instructions from the Nextcloud admin manual. This didn’t work.
  • I tried to follow this thread, using the paths the specify.
  • I tried restarting the server with slightly differently configs to see if there was a typo or something.

Thank you for your help in advance!

1 Like
Try this:

  1. copy ca certs to container docker cp ca.crt nextcloud-app:/path/to/ca/cert
  2. go to container shell docker exec -it -u 82 nextcloud-app sh
  3. add certs to trust ./occ security:certificates:import /path/to/ca/cert
  4. check certs ./occ security:certificates