Inconsistent LDAP connection
I'm running two OC instances, one as a virtual appliance (downloaded from ownCloud's website) and the other one on the VMware Workstation 8.0 (CentOS with MySQL). I'm trying to bind andLDAP and getting inconsistent connectivity (tried it with two different LDAP servers as well). In short, sometimes it works when just One Object Class is selected and sometimes it won't. I've yet to have it worked with all three Object Classes selected. Another thing is that once I gain connectivity I can suddenly loose the connection while nothing has been changed (see screenshots). Please let me know if you need the logs. Couldn't seem to upload them here.

@blizzz Any idea?
@sbelov1 could you please add details as given in the issue template?
@blizzz Please check your email and let me know if you need an access to my environment or anything else.
I am seeing this as well: ldap connector is behaving unpredictably. Sometimes it works, sometimes suddenly "Configuration incorrect". (I wish it would give a bit more feedback WHY it's incorrect)
It's hard to reliably reproduce it... For example just now: logged in as owncloud-admin:
- admin menu: ldap connection is green.
- Started the owncloud desktop client, logging on failed: it kept asking for a password
- back to the admin menu: now suddenly "configuration incorrect"
I also saw "GREEN, configuration correct" in combination with "could not determine base DN", which seem contradictory to me..?
I have also seen owncloud actually REPLACE my (valid) bindDN with "oc-admin", and obviously thus invalidating the ldap config.
Sometimes owncloud "Could not determine Base DN", but also often it does fill in in the (correct) baseDN by itself. (so connectivity IS there...) (all with the same user/password/servername)
I have confirmed the server/userDN/password, they are valid and work reliably in other clients.
So all in all, ldap interface seems to behave irradically.
Some other details from issue template:
- debian wheezy 7.6, x64
- php 5.4.4
- owncloud 7.0.1 (updated from late 6 series, via 7.0.0, apt repository)
- no apps installed
- stock mysql
- using external storage smb/cifs with oc-credentials
- no encryption
In data/owncloud.log we see a variety of errors:
- connection could not be established
- bind failed: 49: invalid credentials
@sbelov1 I do not see any related email unfortunately
@heupink
I wish it would give a bit more feedback WHY it's incorrect
Written to the log file. But no question, we can improve here.
I have also seen owncloud actually REPLACE my (valid) bindDN with "oc-admin", and obviously thus invalidating the ldap config.
Sounds like a browser issue where the stored credentials are autocompleted there, but we hacked around it and IIRC it should be released with 7.0.1. Which browser do you use?
It's hard to reliably reproduce it
Which makes it tough to find its root :-/ Sounds very nasty nevertheless.
@blizzz What is your email address? I've sent it to Owncloud/Core distribution list and would be happy to resend it. For the browser, I was using Firefox (running on CentOS 6.5) and Chrome. The same issue was true regardless of the browser. Even today I've logged in with a supposedly working LDAP configuration, but the Users were not immediately shown for awhile. @heupink Very strange indeed. The logging feedback does seem to be a bit too broad..
@sbelov1 [email protected]
Hey @blizzz, Did you happen to get all the info you needed? Was doing another test yesterday and the issue seems to be consistent.
@sbelov1 oh well, the mail client is so huge it makes my mail client lag and when i attempt to select everything to copy away the log it is frozen. Can you please just paste the information here and share the log as file? Thank you.
Hey @blizzz, apologies for not getting back to you yesterday. I actually wasn't able to upload the text file here as its just way too big. Well, since we work for a file sync & share company, I thought it might be a good idea to just share a link with the files with you :) Here it is. Let me know if you can't open it or something: https://presales.owncloud.com/owncloud/public.php?service=files&t=5ababf07cf684b6527b21e654986dbcd
@sbelov1
PHP version: the latest
Can you elaborate, please?
ownCloud version: (see ownCloud admin page) The latest 6.0.4. (with an LDAP fix patch)
Which patch?
List of activated apps: All but Antivirus and External link apps
i.e. including all 3rd party apps out in the wild?
{"reqId":"53e133144a981","app":"user_ldap","message":"LDAP error Can't contact LDAP server (-1) after calling ldap_bind","level":0,"time":"2014-08-05T19:40:04+00:00","method":"POST","url":"/owncloud/index.php/apps/user_ldap/ajax/wizard.php"}
Have Port and Base DN been detected automatically?
{"reqId":"53e1331575016","app":"user_ldap","message":"Turned off SSL certificate validation successfully.","level":2,"time":"2014-08-05T19:40:05+00:00","method":"POST","url":"/owncloud/index.php/apps/user_ldap/ajax/testConfiguration.php"} {"reqId":"53e1331575016","app":"user_ldap","message":"Connection could not be established","level":3,"time":"2014-08-05T19:40:05+00:00","method":"POST","url":"/owncloud/index.php/apps/user_ldap/ajax/testConfiguration.php"}
Possible SSL issues? See http://doc.owncloud.org/server/6.0/admin_manual/configuration/auth_ldap.html#ssl-certificate-verification-ldaps-tls
Maybe you do not want SSL at all? Check in the database, table oc_appconfig what the value is for configkey with configvalue = 'ldap_tls' and appid = 'user_ldap'. If it is 1 you can try to set it to 0 manually. Does it help?
I have the same issue on 7.0.1.1 (using ldaps). The configuration works, everything seems fine, but a day or two later it does not work anymore. In the admin interface and the log we have the "Bind failed: -1: Can't contact LDAP server". It often comes back by editing a random entry in the LDAP admin page.
'ldapsearch' from the command line works fine all the time.
I found that configuring the replica identical to the main server makes it work more often, because it succeeds contacting the replica after trying the master, even though they are both the same server!
By sniffing the TCP/IP stream during failed connections I don't see any trafic.
My prime suspect is the cache logic (with lines like "$this->getFromCache('overrideMainServer')"), this would explain why it changes behavior over time and why there is no network trafic upon failure. LDAP seems to work fine, once it gets the opportunity to run.
Is there any way to turn off the cache to test this?
@blizzz
PHP version: the latest Can you elaborate, please?
- PHP 5.5.15.
ownCloud version: (see ownCloud admin page) The latest 6.0.4. (with an LDAP fix patch) Which patch?
- The one that fixes connection strings.
List of activated apps: All but Antivirus and External link apps i.e. including all 3rd party apps out in the wild?
{"reqId":"53e133144a981","app":"user_ldap","message":"LDAP error Can't contact LDAP server (-1) after calling ldap_bind","level":0,"time":"2014-08-05T19:40:04+00:00","method":"POST","url":"/owncloud/index.php/apps/user_ldap/ajax/wizard.php"} Have Port and Base DN been detected automatically?
- No.
{"reqId":"53e1331575016","app":"user_ldap","message":"Turned off SSL certificate validation successfully.","level":2,"time":"2014-08-05T19:40:05+00:00","method":"POST","url":"/owncloud/index.php/apps/user_ldap/ajax/testConfiguration.php"} {"reqId":"53e1331575016","app":"user_ldap","message":"Connection could not be established","level":3,"time":"2014-08-05T19:40:05+00:00","method":"POST","url":"/owncloud/index.php/apps/user_ldap/ajax/testConfiguration.php"} Possible SSL issues? See http://doc.owncloud.org/server/6.0/admin_manual/configuration/auth_ldap.html#ssl-certificate-verification-ldaps-tls
Maybe you do not want SSL at all? Check in the database, table oc_appconfig what the value is for configkey with configvalue = 'ldap_tls' and appid = 'user_ldap'. If it is 1 you can try to set it to 0 manually. Does it help?
- I actually no longer have an original database, so wouldn't be able to check that. But I'm fairly certain that SSL was turned off.
ownCloud version: (see ownCloud admin page) The latest 6.0.4. (with an LDAP fix patch) Which patch?
The one that fixes connection strings.
? Do you mean https://github.com/owncloud/core/pull/9575 ?
Maybe you do not want SSL at all? Check in the database, table oc_appconfig what the value is for configkey with configvalue = 'ldap_tls' and appid = 'user_ldap'. If it is 1 you can try to set it to 0 manually. Does it help?
Have Port and Base DN been detected automatically?
No.
There's definitely an issue with the connection. If the host name is correct and a standard port is set, this will be found. And most certainly a Base DN would have been found.
I actually no longer have an original database, so wouldn't be able to check that. But I'm fairly certain that SSL was turned off.
I believe that it might have been the issue, IIRC i have seen this once. SSL is detected automatically, not by the user. I think I have once seen strange behaviour in this regard, might have been dependent on the used OS.
OTOH, does it mean we do not have the chance to investigate further and test possible solutions if necessary?
I have an install, and I can test whatever you'd like me to. (however, sbelov1 seems to be running oc6, whereas we're on 7)
Unfortunately the nightlies don't seem to be working (yet?), so testing possible solutions could be a bit more difficult than just apt-get update | apt-get upgrade.
can you verify if this still happens with the latest release?
@karlitschek @heupink @blizzz I have to say that I'm not noticing this issue with 6.0.5 release, except for the connection state being shown as "Configuration Incorrect" whereas connection is actually present. Tested it on two different setups.
Hi Frank,
I can confirm that LDAP app has the exact symptom on last version 7.0.2 (stable) on a fresh install.
I am experiencing this problem as well. It appears to be bind related - it works randomly and is not specific to the ldap server (though I have only tested against AD). Disabling ssl or certificate validation makes no noticeable difference. It will work for a while, stop, work again and when failing leaves nothing very useful in the logs:
Error user_ldap Bind failed: -1: Can't contact LDAP server 2014-11-14T13:34:57+00:00 Debug user_ldap LDAP error Can't contact LDAP server (-1) after calling ldap_bind 2014-11-14T13:34:57+00:00 Warning user_ldap Turned off SSL certificate validation successfully. 2014-11-14T13:34:55+00:00 Error user_ldap Bind failed: -1: Can't contact LDAP server 2014-11-14T13:34:06+00:00 Debug user_ldap LDAP error Can't contact LDAP server (-1) after calling ldap_bind 2014-11-14T13:34:06+00:00
ldap server is pingable from ownlcoud server and bind succeeds from another computer when this happens.
More interesting if ping and bind succeeds from the same machine at the same time.