Encryption: files are not decrypted on password change
Steps to reproduce
- Enable server encryption, recovery keys on admin, create user, enable recovery keys there.
- Upload some files/folders, whatever you want to.
- Login back as admin and change user password.
- Re-login with user with new password - you're not able to access your files - "Encryption not ready: multikeydecrypt with share key failed:error:0407109F:rsa routines:RSA_padding_check_PKCS1_type_2:pkcs decoding error"
Expected behaviour
Tell us what should happen - according to OC documentation, it says "For users who have enabled password recovery, give them a new password and recover access to their encrypted files by supplying the Recovery Key on the Users page." - by supplying admin recovery key when changing users passwords, present users files should get decrypted and user should be able to read them (if you try to type wrong admin recovery password, you will get an error, so definitely it's not problem in admin key).
However, please note that as far as I've tested, if you repeat steps 1) and 2) from above and you log in now as normal user, change password, no problems occur and you are still able to access your files.
Actual behaviour
Tell us what happens instead: problems mentioned in steps to reproduce above.
Server configuration
Operating system: Debian 8.3
Web server: Apache 2.4.10
Database: MariaDB 10
PHP version: PHP 5.6
ownCloud version: (see ownCloud admin page) - 9.0.0 stable
Updated from an older ownCloud or fresh install: - updated from 8.2.2 stable
Where did you install ownCloud from: - from official sources list, through apt-get
Signing status (ownCloud 9.0 and above): - how to get this?
Login as admin user into your ownCloud and access
http://example.com/index.php/settings/integrity/failed
paste the results here.
No errors have been found.
List of activated apps:
If you have access to your command line run e.g.:
sudo -u www-data php occ app:list
from within your ownCloud installation folder
Enabled:
- activity: 2.2.1
- comments: 0.2
- dav: 0.1.5
- encryption: 1.2.0
- federatedfilesharing: 0.1.0
- federation: 0.0.4
- files: 1.4.4
- files_external: 0.5.2
- files_pdfviewer: 0.8
- files_sharing: 0.9.1
- files_texteditor: 2.1
- files_trashbin: 0.8.0
- files_versions: 1.2.0
- files_videoplayer: 0.9.8
- notifications: 0.2.3
- provisioning_api: 0.4.1
- systemtags: 0.2
- templateeditor: 0.1
- updatenotification: 0.1.0 Disabled:
- documents
- external
- firstrunwizard
- gallery
- user_external
- user_ldap
The content of config/config.php:
If you have access to your command line run e.g.:
sudo -u www-data php occ config:list system
from within your ownCloud installation folder
{ "system": { "instanceid": "XY", "passwordsalt": "_REMOVED SENSITIVE VALUE", "secret": "_REMOVED SENSITIVE VALUE", "trusted_domains": [ "XY" ], "datadirectory": "/opt/owncloud/data", "overwrite.cli.url": "XY", "dbtype": "mysql", "version": "9.0.0.19", "dbname": "XY", "dbhost": "localhost", "dbtableprefix": "oc_", "dbuser": "_REMOVED SENSITIVE VALUE", "dbpassword": "_REMOVED SENSITIVE VALUE", "logtimezone": "UTC", "installed": true, "loglevel": 3, "logdateformat": "F d, Y H:i:s", "asset-pipeline.enabled": true, "memcache.local": "\OC\Memcache\APCu", "defaultapp": "files", "theme": "", "maintenance": false, "mail_smtpmode": "smtp", "mail_smtpauth": 1, "mail_smtpsecure": "ssl", "appstore.experimental.enabled": false, "singleuser": false, "knowledgebaseenabled": false, "check_for_working_htaccess": false, "log_rotate_size": 104857600, "mail_smtpauthtype": "LOGIN", "mail_from_address": "XY", "mail_domain": "XY", "mail_smtphost": "XY", "mail_smtpport": "465", "mail_smtpname": "_REMOVED SENSITIVE VALUE", "mail_smtppassword": "_REMOVED SENSITIVE VALUE", "enable_previews": false, "filesystem_check_changes": 0, "trashbin_retention_obligation": "auto", "filelocking.enabled": "true", "memcache.locking": "\OC\Memcache\Redis", "redis": { "host": "localhost", "port": 6379, "timeout": 0 }, "updatechecker": false } }
Are you using external storage, if yes which one: local/smb/sftp/... - no external storage
Are you using encryption: yes
Are you using an external user-backend, if yes which one: - no external user-backend
Client configuration
Browser: Mozilla Firefox
Operating system: ubuntu 14.04 LTS
Logs
ownCloud log (data/owncloud.log)
Insert your ownCloud log here
{"reqId":"RG7ghM66z9xjEsA/rwLd","remoteAddr":"78.1.179.20","app":"webdav","message":"Exception: {"Message":"HTTP\/1.1 503 Encryption not ready: multikeydecrypt with share key failed:error:0407109F:rsa routines:RSA_padding_check_PKCS1_type_2:pkcs decoding error","Exception":"Sabre\DAV\Exception\ServiceUnavailable","Code":0,"Trace":"#0 \/var\/www\/owncloud\/3rdparty\/sabre\/dav\/lib\/DAV\/CorePlugin.php(83): OCA\DAV\Connector\Sabre\File->get()\n#1 [internal function]: Sabre\DAV\CorePlugin->httpGet(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))\n#2 \/var\/www\/owncloud\/3rdparty\/sabre\/event\/lib\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\n#3 \/var\/www\/owncloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php(459): Sabre\Event\EventEmitter->emit('method:GET', Array)\n#4 \/var\/www\/owncloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php(248): Sabre\DAV\Server->invokeMethod(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))\n#5 \/var\/www\/owncloud\/apps\/dav\/appinfo\/v1\/webdav.php(55): Sabre\DAV\Server->exec()\n#6 \/var\/www\/owncloud\/remote.php(138): require_once('\/var\/www\/ownclo...')\n#7 {main}","File":"\/var\/www\/owncloud\/apps\/dav\/lib\/connector\/sabre\/file.php","Line":311,"User":"123123"}","level":4,"time":"March 15, 2016 16:56:38"} {"reqId":"hSpoc5VBDl7PqR4Atp5E","remoteAddr":"78.1.179.20","app":"webdav","message":"Exception: {"Message":"HTTP\/1.1 503 Encryption not ready: multikeydecrypt with share key failed:error:0407109F:rsa routines:RSA_padding_check_PKCS1_type_2:pkcs decoding error","Exception":"Sabre\DAV\Exception\ServiceUnavailable","Code":0,"Trace":"#0 \/var\/www\/owncloud\/3rdparty\/sabre\/dav\/lib\/DAV\/CorePlugin.php(83): OCA\DAV\Connector\Sabre\File->get()\n#1 [internal function]: Sabre\DAV\CorePlugin->httpGet(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))\n#2 \/var\/www\/owncloud\/3rdparty\/sabre\/event\/lib\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\n#3 \/var\/www\/owncloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php(459): Sabre\Event\EventEmitter->emit('method:GET', Array)\n#4 \/var\/www\/owncloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php(248): Sabre\DAV\Server->invokeMethod(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))\n#5 \/var\/www\/owncloud\/apps\/dav\/appinfo\/v1\/webdav.php(55): Sabre\DAV\Server->exec()\n#6 \/var\/www\/owncloud\/remote.php(138): require_once('\/var\/www\/ownclo...')\n#7 {main}","File":"\/var\/www\/owncloud\/apps\/dav\/lib\/connector\/sabre\/file.php","Line":311,"User":"123123"}","level":4,"time":"March 15, 2016 16:59:12"}
Additional info: this happens only for users that exists before upgrading to newest version.
In other words, detail explanation:
-
user1 - existed on version 8.2.2 and user2 was created after I've upgraded to 9.0.0
-
user1 password change - when I change password for user1 through admin part, only these two files are changed: files_encryption/OC_DEFAULT_MODULE/XX.privateKey files_encryption/OC_DEFAULT_MODULE/123123.publicKey
When I try to re-login, I'm no longer able to access my files (getting error I mentioned above in steps to reproduce). However, if I do the same, password change from within users personal settings, then all files_encryption keys are regenerated and no matter how many times I change password through user settings Personal, I'm still able to access my files.
- user2 password change - when I change password for user2 through admin part, all files are regenerated, e.g.: files_encryption/keys/files/testfolder/test_doc.docx/OC_DEFAULT_MODULE/recoveryKey_79096b7d.shareKey files_encryption/keys/files/testfolder/test_doc.docx/OC_DEFAULT_MODULE/XX.shareKey files_encryption/keys/files/testfolder/test_doc.docx/OC_DEFAULT_MODULE/fileKey files_encryption/keys/files/testfolder/test_pdf.pdf/OC_DEFAULT_MODULE/recoveryKey_79096b7d.shareKey files_encryption/keys/files/testfolder/test_pdf.pdf/OC_DEFAULT_MODULE/XX.shareKey files_encryption/keys/files/testfolder/test_pdf.pdf/OC_DEFAULT_MODULE/fileKey files_encryption/keys/files/testfolder/test_image.png/OC_DEFAULT_MODULE/recoveryKey_79096b7d.shareKey files_encryption/keys/files/testfolder/test_image.png/OC_DEFAULT_MODULE/XX.shareKey files_encryption/keys/files/testfolder/test_image.png/OC_DEFAULT_MODULE/fileKey files_encryption/OC_DEFAULT_MODULE/XX.privateKey files_encryption/OC_DEFAULT_MODULE/XX.publicKey
and no matter how many times I change password in either way I can access the files.
So it seems like the problem is connected with users that existed before upgrade and only when trying to change password through admin part.
cc @owncloud/encryption
Maybe the time is right for #18951. But I have no time now to work on it; definitely not in time for 9.0.1.
@jknockaert #18951 is also nothing we would do for 9.0.1 (minor versions are only for bug fixes). So the earliest date for this is 9.1.
Is there any ETA for 9.1. ? Encryption is one of the biggest strengths of OC and without it, it's similar to any other solution out there, so fixing this problem together with the https://github.com/owncloud/core/issues/18225 https://github.com/owncloud/core/issues/22042 is kinda important.
If you guys need tester for encryption, I will volunteer.
@mislav-eu I tried it but couldn't reproduce it. What I did:
- setup ownCloud 8.2.2 with encryption, recovery key
- create a user "user1" and enable the recovery key for user1
- upload some files for user1
- upgrade to ownCloud 9.0
- login as admin and go to the user management
- enter the recovery key password and change the password for "user1"
- login as "user1" with the new password
- "user1" can still read his files.
Are this the same steps you performed? Or did you something different?
@schiesbn agree
@mislav-eu bug fixed will of course end up in bug-fix releases like 9.0.1. But a complete new recovery key behavior like suggested in #18951 will only happen in a new major release
@schiesbn this is exactly what I did, however 8.2.2. was not clean installation, it was upgrade from 8.1.x - something like that
I can provide you with some credentials to this server if you want to check it out.
@schiesbn also note - sometimes when you initially log in for very first time after changing password you can read the files and then you logout and log in back with the same password - you're no longer able to read files
Any news - need to do anything in addition on this matter?
@schiesbn ping
also note - sometimes when you initially log in for very first time after changing password you can read the files and then you logout and log in back with the same password - you're no longer able to read files
That sounds really strange. I really have no idea what should happen between two logins...
You said that it only happens to users which already existed before the upgrade. Can you double check that for this users the recovery key was/is really enabled. In the database table oc_preferences you should find a entry with "userid"=user; "appid="encryption"; "configkey"="recoveryEnabled"; "configvalue"=1.
Also check the users data/<user>/files_encryption/keys/files/... folder that for all files a recoveryKey_<random_string>.shareKey exists beside the <user>.shareKey
I'm no longer able to reproduce this - this is almost one month old, I didn't get much feedback and I've no longer same environment/users as before
I will close this for now and test how it is when I update to 9.1
@mislav-eu thanks for your feedback! Please don't hesitate to re-open the issue if you experience the same problem again.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.