core icon indicating copy to clipboard operation
core copied to clipboard

Unable to update private key password when using correct old password and new password - "The current log-in password was not correct, please try again"

Open Elethiomel opened this issue 12 years ago • 18 comments

We're running ownCloud 7.0.3 on Debian Wheezy backended by LDAP.

When a user changes password and logs in to ownCloud, they're prompted with a yellow banner reading "Invalid private key for Encryption App. Please update your private key password in your personal settings to recover access to your encrypted files.". We then attempt to update the key using the old password and new password and receive the error message "The current log-in password was not correct, please try again". We have created test accounts and are definitely using the correct old password and correct new password.

All that appears in the owncloud.log is

{"reqId":"546f533b158ba","app":"core","message":"Login failed: '66817f50-9a9e-1032-94dc-0d3a7aa055a3' (Remote IP: 'xxx.yyy.zzz.aaa', X-Forwarded-For: '')","level":2,"time":"2014-11-21T14:59:07+00:00","method":"POST","url":"/index.php/apps/files_encryption/ajax/updatePrivateKeyPassword.php"}

Elethiomel avatar Nov 21 '14 15:11 Elethiomel

We've had the dame issue. objectGUID won't match the ldap-search against Active Directory. As it's a binary field.

We've had to make a fresh install and configured LDAP to use samaccountname field for username.

For the meanwhile you could circumvent password-verification: https://github.com/uni-halle/ownCloud/commit/893010273f88aeec318d17d9df996ad9de6c9b53

rjaeckel avatar Nov 21 '14 15:11 rjaeckel

Our problem doesn't seem to be related to binary fields. Our LDAP setup is OpenLDAP. User filter is set to use a raw filter of

"(objectclass=person)"

Login filter is set to a raw filter of

(|(&(uid=%uid)(objectClass=noLoginShellAccount)(owncloudUser=yes))(&(uid=%uid)(objectClass=localPerson)))

Your hack works perfectly though. The user receives no error message and the files are now decrypting properly Thanks!

Elethiomel avatar Nov 21 '14 15:11 Elethiomel

have you defined a specific field for the usernames coming from ldap? OC uses a list to pick one from if not set manually. That's the reason i wrote about objectguid. these fields are defined somewhere in apps/user_ldap/lib/ ... how do the uid-fields look like in yourr ldap? are they similar to 66817f50-9a9e-1032-94dc-0d3a7aa055a3? i guess thats the objectguid-property.

the part %uid is being replaced with the users oc-name to check against. if your may have luck by extending the user-login filter to the following: (&(|(uid=%uid)(objectguid=%uid))(|(&(objectClass=noLoginShellAccount)(owncloudUser=yes))(objectClass=localperson))) but this did not work against AD maybe openldap does better ;-)

rjaeckel avatar Nov 21 '14 18:11 rjaeckel

@blizzz @schiesbn

PVince81 avatar Nov 24 '14 10:11 PVince81

uid fields in our LDAP are usernames as per POSIX. We don't run AD so we don't have fields like objectGUID

Elethiomel avatar Nov 24 '14 10:11 Elethiomel

There are different UUID fields in different implementations, objectGUID is typical for AD, entryUUID for OpenLDAP, and then there are others too :)

@schiesbn the problem is here: https://github.com/owncloud/core/blob/master/apps/files_encryption/ajax/updatePrivateKeyPassword.php#L28

You need to get the loginname via \OC\Session::getLoginName()

blizzz avatar Nov 24 '14 12:11 blizzz

You need to get the loginname via \OC\Session::getLoginName()

Shouldn't getUser() return the login name in contrast to getDisplayName() which returns the display name? getUser() is used all over the place, I fear that there are many more hidden bugs because if this.

schiessle avatar Nov 24 '14 13:11 schiessle

You need to get the loginname via \OC\Session::getLoginName()

Shouldn't getUser() return the login name in contrast to getDisplayName() which returns the display name? getUser() is used all over the place, I fear that there are many more hidden bugs because if this.

No, it returns the user name ( != login name). You can have more than one login name, getLoginName() will return that one you used last time. For example you can login by some userid and email using LDAP.

blizzz avatar Nov 24 '14 14:11 blizzz

OK, but shouldn't the password work for all login names? Or can there be even different passwords for different login names?

Just to make sure that we don't miss anything. getUser() is still the right call to construct the path to the users data folder and as identifier for various encryption keys, to select name the user to whom a file gets shared, etc... right?

schiessle avatar Nov 24 '14 14:11 schiessle

OK, but shouldn't the password work for all login names? Or can there be even different passwords for different login names?

Yes the password is the same, but the username is not necessarily a login name!

The username is the key to reference users everywhere in ownCloud. But it does not necessarily apply to external resources.

Just to make sure that we don't miss anything. getUser() is still the right call to construct the path to the users data folder and as identifier for various encryption keys, to select name the user to whom a file gets shared, etc... right?

Yes!

blizzz avatar Nov 24 '14 14:11 blizzz

Thanks for clarification... I will prepare a PR to fix it.

schiessle avatar Nov 24 '14 14:11 schiessle

@Elethiomel The pull request above should fix it. Only two lines are changed. Maybe you want to give it a try? Thanks!

schiessle avatar Nov 24 '14 14:11 schiessle

@schiesbn Works perfectly. Thanks very much for all your help :)

Elethiomel avatar Nov 24 '14 14:11 Elethiomel

@schiesbn

Can you please post some repro steps?

Thanks!

jnfrmarks avatar Dec 02 '14 21:12 jnfrmarks

This only happens with some special LDAP settings. I wasn't able to reproduce it too but trusted @blizzz assessment. I think you need a LDAP setting where your login name is different to your user name and then login with the username and try to change the encryption password, but I'm not a LDAP expert.

@blizzz can you provide some steps to reproduce the problem? What kind of LDAP setting is needed to trigger this issue?

schiessle avatar Dec 03 '14 10:12 schiessle

@jnfrmarks

  1. configure LDAP and leave "Internal Username" empty (default).
  2. enable encryption
  3. login with an LDAP user. upload a file.
  4. logout.
  5. in LDAP, change the password of the user
  6. relogin with that LDAP user. you will be asked to refresh the encryption key
  7. do as said by going to personal page and provide old and new password in the appopriate fields.

blizzz avatar Dec 03 '14 12:12 blizzz

A regression exists in ownCloud 8 that causes the same bug reported here.

r000t avatar Oct 19 '15 18:10 r000t

Hi there,

we ran exactly into this. Using LDAP and ActiveDirectory with SharePoint and so on. User changed her password within the Exchange OWA web application and was able to log on into ownCloud web application with the new password. Then the warning appears, that the private key does not match new password as known.

We're using ownCloud Server 8.1.3 on Ubuntu Server 14.04.3 LTS with encryption app and ActiveDirectory LDAP user back end.

Trying to update the private keys with the new password and using the password recovery function fails. For your interest, the recovery functionality is set to enable for all users.

We've checked the LDAP filter and tried out as mentioned, but problem persists.

Fortunately, the user recognized the old password, so all is set to condition green - user can work on with old password for now.

Are there any new informations about, how to solve or set different, additional LDAP filters for AD to get the new password for changing keys working on?

I'm not into it, why the user can log on with the new password into the ownCloud web application - so the system just has the new password and recognizes it, and is still not able to change it within the private keys... another question is... why the ownCloud Server was able to encrypt the private keys with a LDAP AD password at the beginning of usage, isn't it the same LDAP attribute as used for checking new password?

Thanks!

GCC0THerbst avatar Oct 30 '15 08:10 GCC0THerbst