core icon indicating copy to clipboard operation
core copied to clipboard

OC7 remarks "Encryption key not found", breaks encrypted Data

Open derkostka opened this issue 12 years ago • 14 comments

Expected behaviour The encryption keys and Data are kept in sync - data loss must not happen

Actual behaviour 2 unexpected things: #1 After upgrading from OC6 to OC7, the encryption keys were lost somewhere between the Update and clearing the Trash. #2 Reuploading all Data worked around #1, keys are created but OC does not find them

Steps to reproduce #1

Could not be reproduced. However: Updated from 7.0.0 to 7.0.1 and deleted a shared file (10 gig) stored in a read only mounted SMB share. The next morning, the storage was at 100%, the Trash was fillled with files. Keys got deleted somewhere in between these Steps. #2

not reproduced yet

Server configuration

Operating system: Ubuntu 14.04.1 on Odroid U2 ARM
Web server: Apache
Database: MySQL 5.5.38
PHP version: PHP 5.5.9
ownCloud version: 7.0.1

Client configuration

  • Browser, WebDav, Android client

Logs #1

No keyfiles after clearing the trash: root@odroid:/media/data/owncloud/data/skostka/files_encryption# l * skostka.private.key keyfiles: share-keys: #2

"app":"index","message":"Exception: Encryption key not found for "/skostka/files/MyData/KnowHow/filename.pdf" during attempted read via stream","level":4,"time":"August 14, 2014 23:21:35"}

But as you can see, the key is present: /media/data/owncloud/data/skostka/files_encryption/keyfiles/MyData/KnowHow# ls -lh filename.pdf.key -rw-r--r-- 1 www-data www-data 44 Aug 8 02:02 filename.pdf.key

Additional information Happened to all users and admin

derkostka avatar Aug 19 '14 20:08 derkostka

@schiesbn

karlitschek avatar Aug 19 '14 20:08 karlitschek

I noticed something very strange. Since I have other issues ( see here #10481 ) I have been looking through my files and found all share-keys in the folder of a user instead of the admin-user (who shared the files/folders with the users). This could be the cause of your problem, which I also had with OC 6.0.4 ( see here #9191 ). Since the sharing-function is bugged for me in 7.0.1 I don't have much data in yet, but I'll watch closely if I'm losing keyfiles again...

lorddoumer avatar Aug 20 '14 07:08 lorddoumer

Same "Encryption key not found" error for me, i'm unable to access my old files throw web interface (newly uploaded files works ok). This problem happened after adding a local directory as an external folder. If I remove the external forlder, everything works fine, adding it again breaks decryption

Not sure it's the same bug, @derkostka can you try to remove your external storage ?

aaujon avatar Aug 20 '14 07:08 aaujon

do you use external storages mounted with in the admin settings?

schiessle avatar Aug 20 '14 08:08 schiessle

@schiesbn : yes, is have mounted a readonly samba share as local file system (smb mount via servers fstab, link the mount as file system in owncloud) from the admin settings. i shared a file from there via link, after i removed that link (unshare the file), my trash got filled with garbage and the issues began.

derkostka avatar Aug 20 '14 08:08 derkostka

@schiesbn : Yes, I do The share is mounted on the file system using fuse and I added it to owncloud using the 'local' external storage in the admin settings

aaujon avatar Aug 20 '14 08:08 aaujon

Then it is most likely fixed with this PR: https://github.com/owncloud/core/pull/10181

schiessle avatar Aug 20 '14 08:08 schiessle

Can you give it a try, best thing would be to start without any encrypted files

schiessle avatar Aug 20 '14 08:08 schiessle

@schiesbn : this PR fixes my issue, thanks !

aaujon avatar Aug 20 '14 09:08 aaujon

Great. @derkostka can you also give it a try ?

PVince81 avatar Aug 20 '14 10:08 PVince81

Yes, i will check until tomorrow evening and provide feedback !

derkostka avatar Aug 20 '14 11:08 derkostka

@schiesbn @PVince81 the PR fixed it, thank you ! I guess you can close this Issue

One last question: How does OC behave, if a file in a read-only share is removed ? will it be deleted also from the OC-DB during the cron jobs or is this case undefined ? If it is not covered yet, one should open a new item to catch this case of read-only file systems.

derkostka avatar Aug 21 '14 18:08 derkostka

Great, thanks for the feedback, closing.

PVince81 avatar Aug 21 '14 19:08 PVince81

One last question: How does OC behave, if a file in a read-only share is removed ?

Shared files/folders can always be deleted by the recipient, independent from the permissions. A "delete" will always result in a unshare operation. The web interface also shows a "unshare" tooltip for the trash icon instead of a "delete" tooltip if it is a shared file/folder.

schiessle avatar Aug 22 '14 08:08 schiessle