Nextcloud 24 patch 12 has just been released which is the last patch for this version so definitely time to upgrade. And since I'm building a Nextcloud 26 trial and have already found some nice improvements it seems even more reason to. So I restart my test instance only to be greeting with an error message on login. Oh...
Checking the nextcloud.log in the data directory (/srv/nextcloud/data for me) I find the following message:
{"reqId":"YDi58WVBLd9xfHRMUTqx","level":3,"time":"2023-04-23T08:36:47+00:00","remoteAddr":"192.168.x.x","user":"--","app":"index","method":"POST","url":"/index.php/login","message":"Lost connection to LDAP server.",
Which is odd since the LDAP servers are definitely running and I can log in as well. So my next thought it to check the LDAP config in Nextcloud, but that's on the Administration panel which I can't reach as I cannot log in. Chicken v Egg, round 2.
After a bit of searching and several references to the Nextcloud forums at https://help.nextcloud.com I find a that LDAP can also be configured via the command line, but it's late so one for the morning.
After breakfast I return to the problem at hand. The first step is to show the current configuration and two lines immediately jump out
user@tnextcloud1:~$ sudo -u www-data php /srv/nextcloud/www/occ ldap:show-config
+-------------------------------+-----------------------------------------------------------------+
| Configuration | s03 |
+-------------------------------+-----------------------------------------------------------------+
| ... | |
| ldapHost | ldaps://testdc1.s4test.bostoncube.com |
| ... | |
| ldapPort | 636 |
| ... | |
+-------------------------------+-----------------------------------------------------------------+
Which is odd as I don't have a host by that name. Then I remember a few months ago II was having a play with Samba 4 running in domain controller mode, and Nextcloud was part of that testing. At least I still had the VM and as soon as it was restarted Nextcloud was perfectly happy once more.
So there's two lessons from this:
- The occ command line tool has a whole bunch of useful features - it can also reconfigure LDAP too.
- A failure of the LDAP connection breaks Nextcloud login for users defined locally too.
Once I've upgraded this to Nextcloud 26 I will re-test this failure scenario as local users should still be able to access the system.
Update: Still an issue in Nextcloud 26 and 27...