OC6 keeps losing encryption keys
Hi everyone,
I'm using the encryption app. After updating to OC6 and logging in all my key files were lost (and so was my data). Fortunately, I still had a copy on a machine that didn't sync yet. Now I try to upload the data again folder by folder and the keys are being generated. But after a while the key files vanish, leaving my data unreadable again. I'm using the owncloud client to sync my data, and the former folder's key files seem to vanish after the sync to the server has completed.
The server log file shows
{"app":"Encryption library","message":"Could not delete keyfile; does not exist: \"\/phil\/files_encryption\/keyfiles\/","level":3,"time":"2013-12-13T23:50:07+00:00"}
{"app":"Encryption library","message":"Keyfile or shareKey could not be deleted for file \"\/\"","level":3,"time":"2013-12-13T23:50:07+00:00"}
{"app":"Encryption library","message":"\"phil\" is not setup for encryption","level":2,"time":"2013-12-13T23:50:07+00:00"}
{"app":"PHP","message":"openssl_seal(): Fourth argument to openssl_seal() must be a non-empty array at \/var\/www\/html\/owncloud\/apps\/files_encryption\/lib\/crypt.php#410","level":2,"time":"2013-12-13T23:50:07+00:00"}
{"app":"PHP","message":"Missing argument 2 for OC\\Files\\Storage\\Local::file_put_contents(), called in \/var\/www\/html\/owncloud\/lib\/private\/files\/view.php on line 684 and defined at \/var\/www\/html\/owncloud\/lib\/private\/files\/storage\/local.php#153","level":2,"time":"2013-12-13T23:50:07+00:00"}
{"app":"PHP","message":"Undefined variable: data at \/var\/www\/html\/owncloud\/lib\/private\/files\/storage\/local.php#154","level":2,"time":"2013-12-13T23:50:07+00:00"}
{"app":"PHP","message":"Argument 4 passed to OCA\\Encryption\\Keymanager::setShareKeys() must be an array, null given, called in \/var\/www\/html\/owncloud\/apps\/files_encryption\/lib\/stream.php on line 534 and defined at \/var\/www\/html\/owncloud\/apps\/files_encryption\/lib\/keymanager.php#320","level":2,"time":"2013-12-13T23:50:07+00:00"}
{"app":"PHP","message":"Invalid argument supplied for foreach() at \/var\/www\/html\/owncloud\/apps\/files_encryption\/lib\/keymanager.php#338","level":2,"time":"2013-12-13T23:50:07+00:00"}
{"app":"hook","message":"error while running hook (OC\\Preview::post_write): Encryption key not found for \"\/phil\/files\/DocsWork\/somefile.bin\" during attempted read via stream","level":3,"time":"2013-12-13T23:50:07+00:00"}
{"app":"index","message":"Exception: Encryption key not found for \"\/phil\/files\/DocsWork\/anotherfile.txt\" during attempted read via stream","level":4,"time":"2013-12-14T00:26:58+00:00"}
To me it looks fscked up really bad. For now, I am unable to store any data in OC without losing it.
Any clues?
Regards,
Phil
I can confirm that there is something wrong with encryption after update to OC6. First it worked, but suddenly all files were still crypted even after download. I had to recover the keys from backup in order to decrypt my files.
Just to add: I uploaded a profile image, activated the activity app and the documents app before the problem occurred, so maybe related to these changes?
@schiesbn
@formwandler Just to add: I have no profile picture, and neither the activity app nor the documents app have been activated in my setup.
What database are you using and which exact version did you migrate from ? Was it OC 5.0.13 to OC 6.0.0 ?
It's mysql 5.1.71 and OC was updated automatically via yum-autoupdate from 5.0.13-21.2 to 6.0.0-2.1
I am using MariaDB 5.5.33 and upgraded from OC 5.0.13 to OC 6.0.0 (under openSUSE 13.1 but with repo http://download.opensuse.org/repositories/isv:/ownCloud:/community/openSUSE_12.3_standard/). I now switched to http://download.opensuse.org/repositories/isv:/ownCloud:/community/openSUSE_13.1/ which offers OC 6.0.0a.
Maybe this explains my error as well. I can´t decrypt my files with OC6. It says "Authenticate failure".
If this happens, what keys are gone? How does your data/user/files_encryption/ folder looks like in this case? Is the users private key still there? The share-keys? The keyfiles? Is the folder completely empty?
Most of the private keys were gone, some random keys were still there and I was able to view the corresponding files. But this was far the minority. Didn't look whether or not the share-keys vanished, too. btw - would you be so kind to add the label "app:files_encryption" to this issue, please?
All the keys are still there afaik and all the files in /files are .key.
What should I do? Can I reset the keys in some way?
MVH Daniel
Skickat från Google Nexus 5 Den 16 dec 2013 10:33 skrev "Björn Schießle" [email protected]:
If this happens, what keys are gone. How does your data/user/files_encryption/ folder looks in this case? Is the users private key still there? The share-keys? The keyfiles?
— Reply to this email directly or view it on GitHubhttps://github.com/owncloud/core/issues/6411#issuecomment-30646665 .
(added label "app:files_encryption" as requested)
Which apps do you have activated? Did you disabled the "deleted files" app?
these apps are enabled additionally: Calendar, Contacts, LDAP user and group backend, ownCloud dependencies Info, PDF Viewer, Pictures, Share Files, Tasks, Text Editor, Versions, Video Viewer, Files move
It just happened again. The private key file is just there, but all files in keyfiles/ and share-keys/ are gone:
files_encryption> l *
-rw-r--r-- 1 wwwrun www 4388 10. Dez 11:32 myuser.private.key
keyfiles:
insgesamt 8
drwxr-xr-x 2 wwwrun www 4096 16. Dez 07:26 ./
drwxr-xr-x 4 wwwrun www 4096 16. Dez 07:26 ../
share-keys:
insgesamt 8
drwxr-xr-x 2 wwwrun www 4096 16. Dez 07:26 ./
drwxr-xr-x 4 wwwrun www 4096 16. Dez 07:26 ../
After recovery of keyfiles/ and share-keys/ the files are decrypted again.
No, I haven't "Deleted Files" enabled.
Some more info: It does not seem to happen with files of my "admin" user. Maybe it's related to the sync client that I am running on two hosts with the user that is affected. I am running version 1.4.2 of the sync client. Just updated to 1.5 (wasn't updated before due to odd package conflict).
I am running the sync client just towards a subdir, not the root dir.
Than I think I found the issue. There is a problem with the keyfile handling if "deleted files" is disabled. To avoid further data lose please activate the "deleted files" app for now. A patch to solve the issue will follow soon.
@schiesbn Ok, thanks. Just enabled the "Deleted Files" app. If problem occurs again, I will post a note here.
Fix merged in master and stable6... Will be released with ownCloud 6.0.1.
I will close this issue now. If the problem still exists after the patch was applied or with "deleted files" enabled feel free to re-open it and add you comment here.
Happens to me after the Upgrade to 6.0.2 – any solution for this problem? (deleted files enabled since the initial setup of owncloud)
BTW: The problem occurred right after enabeling public acces for a folder shared with another user – don't know if there is a connection, but maybe this is no coincidence...
Update: I looked through the owncloud log (this doesn't get deleted automatically, right?) since the initial setup the only thing occurred was: {"app":"PHP","message":"Undefined variable: matches at /html/owncloud/apps/files_encryption/lib/keymanager.php#487","level":2,"time":"2014-01-13T09:45:43+00:00"} {"app":"PHP","message":"Undefined variable: escapedDir at /html/owncloud/apps/files_encryption/lib/keymanager.php#508","level":3,"time":"2014-03-26T18:19:30+00:00"} {"app":"PHP","message":"Undefined variable: matches at /html/owncloud/apps/files_encryption/lib/keymanager.php#502","level":3,"time":"2014-03-26T18:19:30+00:00"} but everything worked fine nonetheless.
But after enabeling the public access the log is full with errors like those: {"app":"files_sharing","message":"File source not found for: /files/Allgemein/Arbeitgeber BW","level":0,"time":"2014-03-26T18:19:51+00:00"} {"app":"files_sharing","message":"File source not found for: /files/Allgemein/Arbeitgeber BW","level":0,"time":"2014-03-26T18:19:51+00:00"} {"app":"files_sharing","message":"File source not found for: /files/Allgemein/Bilder Arbeitgeber BW.zip","level":0,"time":"2014-03-26T18:19:51+00:00"} {"app":"files_sharing","message":"File source not found for: /files/Allgemein/Bilder Arbeitgeber BW.zip","level":0,"time":"2014-03-26T18:19:51+00:00"} {"app":"OC\Files\Cache\Scanner","message":"!!! Path 'Allgemein/Arbeitgeber BW/Bilder Arbeitgeber BW.zip' is not readable !!!","level":0,"time":"2014-03-26T18:19:55+00:00"} {"app":"OC\Files\Cache\Scanner","message":"!!! Path 'Allgemein/Arbeitgeber BW/Bilder Arbeitgeber BW.zip' is not readable !!!","level":0,"time":"2014-03-26T18:19:55+00:00"} {"app":"OC\Files\Cache\Scanner","message":"!!! No reuse of etag for 'Allgemein' !!! \ncache: Array\n(\n [fileid] => 21\n [storage] => home::Alexander\n [path] => files/Allgemein\n [parent] => 2\n [name] => Allgemein\n [mimetype] => httpd/unix-directory\n [mimepart] => httpd\n [size] => 29894844\n [mtime] => 1395857990\n [storage_mtime] => 1395857990\n [encrypted] => \n [unencrypted_size] => 22355433\n [etag] => 53331a475adce\n)\n \ndata: Array\n(\n [mimetype] => httpd/unix-directory\n [mtime] => 1395857995\n [size] => -1\n [etag] => 53331a4b627a5\n [storage_mtime] => 1395857995\n)\n","level":0,"time":"2014-03-26T18:19:55+00:00"} {"app":"OC\Files\Cache\Scanner","message":"!!! No reuse of etag for 'Allgemein/Arbeitgeber BW' !!! \ncache: Array\n(\n [fileid] => 4406\n [storage] => home::Alexander\n [path] => files/Allgemein/Arbeitgeber BW\n [parent] => 21\n [name] => Arbeitgeber BW\n [mimetype] => httpd/unix-directory\n [mimepart] => httpd\n [size] => 29894844\n [mtime] => 1395857990\n [storage_mtime] => 1395857990\n [encrypted] => \n [unencrypted_size] => 22355433\n [etag] => 53331a46a6126\n)\n \ndata: Array\n(\n [mimetype] => httpd/unix-directory\n [mtime] => 1395857995\n [size] => -1\n [etag] => 53331a4b753f6\n [storage_mtime] => 1395857995\n)\n","level":0,"time":"2014-03-26T18:19:55+00:00"} {"app":"files_sharing","message":"File source not found for: /files/Allgemein/Arbeitgeber BW","level":0,"time":"2014-03-26T18:19:55+00:00"} {"app":"files_sharing","message":"File source not found for: /files/Allgemein/Arbeitgeber BW","level":0,"time":"2014-03-26T18:19:55+00:00"} {"app":"hook","message":"error while running hook (OCA\Encryption\Hooks::postRename): Encryption key not found for "/Alexander/files/Allgemein/Arbeitgeber BW/Bilder Arbeitgeber BW.zip" during attempted read via stream","level":3,"time":"2014-03-26T18:19:56+00:00"} {"app":"search_lucene","message":"searching hits for pk:1c863d5547a9aec96a16f549fad6ea3d","level":0,"time":"2014-03-26T18:20:05+00:00"} {"app":"search_lucene","message":"found 0 hits ","level":0,"time":"2014-03-26T18:20:05+00:00"} {"app":"core","message":"Generating preview for "Bilder Arbeitgeber BW.zip" with "OC\Preview\Unknown"","level":0,"time":"2014-03-26T18:20:33+00:00"} {"app":"core","message":"OC_Image->fixOrientation() Orientation: -1","level":0,"time":"2014-03-26T18:20:33+00:00"} {"app":"core","message":"scalefactor reduced from 4 to 2","level":0,"time":"2014-03-26T18:20:33+00:00"} {"app":"OC\Files\Cache\Scanner","message":"!!! No reuse of etag for '' !!! \ncache: Array\n(\n [fileid] => 29\n [storage] => home::Christian\n [path] => \n [parent] => -1\n [name] => \n [mimetype] => httpd/unix-directory\n [mimepart] => httpd\n [size] => 0\n [mtime] => 1392120662\n [storage_mtime] => 1388666321\n [encrypted] => \n [unencrypted_size] => 0\n [etag] => 52fa1356a381f\n)\n \ndata: Array\n(\n [mimetype] => httpd/unix-directory\n [mtime] => 1394792635\n [size] => -1\n [etag] => 53331a726583d\n [storage_mtime] => 1394792635\n)\n","level":0,"time":"2014-03-26T18:20:34+00:00"} {"app":"OC\Files\Cache\Scanner","message":"!!! No reuse of etag for 'thumbnails' !!! \ncache: Array\n(\n [fileid] => 2927\n [storage] => home::Christian\n [path] => thumbnails\n [parent] => 29\n [name] => thumbnails\n [mimetype] => httpd/unix-directory\n [mimepart] => httpd\n [size] => 16178\n [mtime] => 1392025431\n [storage_mtime] => 1392025431\n [encrypted] => \n [unencrypted_size] => 0\n [etag] => 52f8a229270ef\n)\n \ndata: Array\n(\n [mimetype] => httpd/unix-directory\n [mtime] => 1395857976\n [size] => -1\n [etag] => 53331a726c7f6\n [storage_mtime] => 1395857976\n)\n","level":0,"time":"2014-03-26T18:20:34+00:00"} {"app":"PHP","message":"DateTimeZone::__construct() [datetimezone.--construct</a>]: Unknown or bad timezone (W. Europe Standard Time) at /html/owncloud/3rdparty/Sabre/VObject/TimeZoneUtil.php#307","level":3,"time":"2014-03-26T19:35:51+00:00"} {"app":"PHP","message":"DateTimeZone::__construct() [datetimezone.--construct</a>]: Unknown or bad timezone (W. Europe Standard Time) at /html/owncloud/3rdparty/Sabre/VObject/TimeZoneUtil.php#307","level":3,"time":"2014-03-26T21:17:04+00:00"} {"app":"PHP","message":"DateTimeZone::__construct() [datetimezone.--construct</a>]: Unknown or bad timezone (W. Europe Standard Time) at /html/owncloud/3rdparty/Sabre/VObject/TimeZoneUtil.php#307","level":3,"time":"2014-03-27T03:13:05+00:00"} {"app":"PHP","message":"json_encode() [function.json-encode</a>]: Invalid UTF-8 sequence in argument at /html/owncloud/lib/private/log/owncloud.php#73","level":3,"time":"2014-03-27T07:31:30+00:00"} {"app":"core","message":null,"level":0,"time":"2014-03-27T07:31:30+00:00"} {"app":"core","message":"OC_Image->loadFromBase64, couldn't load","level":0,"time":"2014-03-27T07:31:30+00:00"} {"app":"core","message":"OC_Image->fixOrientation() No readable file path set.","level":0,"time":"2014-03-27T07:31:30+00:00"} {"app":"core","message":"OC_Image->fixOrientation() Orientation: -1","level":0,"time":"2014-03-27T07:31:30+00:00"} {"app":"PHP","message":"json_encode() [function.json-encode</a>]: Invalid UTF-8 sequence in argument at /html/owncloud/lib/private/log/owncloud.php#73","level":3,"time":"2014-03-27T07:40:34+00:00"} {"app":"core","message":null,"level":0,"time":"2014-03-27T07:40:34+00:00"}
I'm gonna try a reinstall of owncloud as soon as the backup is complete, hopfully this helps!