core icon indicating copy to clipboard operation
core copied to clipboard

Many issues in logfile since enabling encryption oc 6.0.2

Open onewaypub opened this issue 12 years ago • 19 comments

Hi all,

I got many error messages (Level error and fatal) since I enabled encryption in owncloud 6.0.2:

Fatal webdav Exception: Encryption library: Decryption (symmetric) of content failed Error no app in context Error while running background job: Encryption library: no data provided for decryption Error PHP Undefined variable: message at /Applications/owncloud/apps/owncloud/htdocs/lib/public/util.php#95 Error no app in context Error while running background job: Encryption key not found for "//files/" during attempted read via stream

It seems that the files are correctly encrypted, but I don't know, because I cannot test it.

In order to test this, is there a way to use the admins recovery key and/or the user private key with openssl to decrypt single files?

My environment:

OSX: 10.9.2 OC: 6.0.2 Ecryption: 0.5

regards, onewaypub

onewaypub avatar Mar 25 '14 15:03 onewaypub

As I can see the error

Error PHP Undefined variable: message at /Applications/owncloud/apps/owncloud/htdocs/lib/public/util.php#95 appears, because of a error when logging a fatal error, which make me a little bit nervous ... :o)

onewaypub avatar Mar 25 '14 16:03 onewaypub

By the way: I saw that in other issues some of the errors depends on the "deleting files" app, which should be activated to prevent the behaviour. In my constallation the app is activated

onewaypub avatar Mar 25 '14 16:03 onewaypub

Seems to be that other people have a similar problem:

https://forum.owncloud.org/viewtopic.php?f=26&t=20142

onewaypub avatar Mar 25 '14 16:03 onewaypub

Not sure if the encryption app run correctly on a Mac OS X server, also ownCloud is not officially supported on Mac OS X (there are many other known issues).

Please ignore the "message" warning. It is due to an exception being throw that has no message set.

You might want to set the loglevel to 0, enable XDebug to get a stack trace.

PVince81 avatar Mar 25 '14 16:03 PVince81

@schiesbn

PVince81 avatar Mar 25 '14 16:03 PVince81

Can I test if the files are encrypted correctly and if the are decryptable somehow. For example with openssl with all the private keys. would be very helpful to decide if I have to roll back everything.

Thanks a lot for your help!

onewaypub avatar Mar 25 '14 17:03 onewaypub

@onewaypub it might be a bit tricky. One way is to check whether all files have keys the user's "files_encryption" subdir. Another way which I use is to run the "file" command on every file and see if it returns something like "ASCII text, long lines"

PVince81 avatar Mar 25 '14 17:03 PVince81

What do you mean with file command?

onewaypub avatar Mar 25 '14 17:03 onewaypub

The shell command "file":

vincent@petry ~/temp
  % file truck.svg                                                                                                                                            
truck.svg: SVG Scalable Vector Graphics image

If the file was encrypted it would return "ASCII text, long lines".

But that requires you to write a mini shell script with a loop, tricky.

@schiesbn is there another way ?

PVince81 avatar Mar 25 '14 17:03 PVince81

And testing decryption

onewaypub avatar Mar 25 '14 17:03 onewaypub

I would suggest to follow the instructions by @PVince81 first. Did you checked that all encryption keys are at the right place? Also keep in mind that MacOS is not a supported server platform, changes are high that you are the first one who tried encryption on MacOS.

If you want to decrypt a single file outside of ownClould you could try this PHP script: http://blog.schiessle.org/2013/05/28/introduction-to-the-new-owncloud-encryption-app/comment-page-1/#comment-61180

Be aware that it will output the unencrypted file content to your terminal, so if possible try it with an encrypted text file. If you don't have such a file you can replace the last line in the script

echo "result: " . $decryptedContent . "\n";

with

file_put_contents("/path/you/want/to/store/the/unencrypted/file", $decryptedContent);

to write the decrypted content to a file. Be careful to chose a unique path to make sure that you don't overwrite existing data.

schiessle avatar Mar 25 '14 17:03 schiessle

First of all: Many thanks for your support. I hope your benefit of my error report is the same :o)

Okay. After some research I found out that all keys of the files from today are created.

Interesting effect: The key is created 15 minutes after the error messages appear and one day after the content files is created.

Because of the error report in the forum https://forum.owncloud.org/viewtopic.php?f=26&t=20142 I think this is a general problem.

the file command gives: ASCII text, no line terminators (seems to be okay).

"..Please ignore the "message" warning. It is due to an exception being throw that has no message set..." Perhaps that should be fixed. An exception without an message could be more than crazy and dangerous :o). Also this results in a fatal error which is probably only a warning.

Another thing is that the errors

Error no app in context Error while running background job: Encryption library: no data provided for decryption Error PHP Undefined variable: message at /Applications/owncloud/apps/owncloud/htdocs/lib/public/util.php#95

always come together. so it seems that the message-error is a subsequent fault.

Conclusion: It seems to be a general problem. But it seems to be not critical. I will research the error a little bit more detailed.

onewaypub avatar Mar 25 '14 19:03 onewaypub

An exception without an message could be more than crazy and dangerous

This is already fixed on master and stable6 through https://github.com/owncloud/core/pull/7818

PVince81 avatar Mar 25 '14 19:03 PVince81

okay. I researched a little bit. one thing I have found is when you enable the encryption the error 'Error no app in context Error while running background job: Encryption library: no data provided for decryption' seems to have the cron.php-Job (Webcron) as its origin.

So when I disable this or try to login with a cookie in curl this error disappears. Also with enabled encryption no news updates will be done. only if I login with curl and a cookie. With a cron-Job server side, the news also will not be updated (perhaps the same reason?)

onewaypub avatar Mar 31 '14 21:03 onewaypub

Hmm, I wonder what background job is trying to access files. The thing is, when files are encrypted, the user's password is needed to retrieve the file's key, which is then used to decrypt the file. Obviously when a background job runs, the user's password is not known/available so files can't be decrypted.

Do you have any other apps enabled that might be triggering the scanning ? If possible, can you enable XDebug and set "loglevel" to 0 so we can get a stack trace and get more clues where this is happening ?

@schiesbn when scanning files in the background, and the "unencrypted_size" is not known yet, the process might try to open the file to find it out. What do you think ?

PVince81 avatar Apr 01 '14 07:04 PVince81

Currently I have enabled these apps:

Activity Calendar Contacts Deleted files Documents Encryption External Sites External storage support First run Wizard Full Text search owncloud dependencies info PDF Viewer Pictures Share Files Tasks Text Editor Updater Versions Video Viewer App Frameworl Mozilla Sync News Notes Videos

I will set the debug level to 0 and give you feedback in a few days.

onewaypub avatar Apr 01 '14 08:04 onewaypub

I've got the same issue. Owncloud 6.0.2, mysql 5.5.33, Freebsd 9.1 (actually a jail on nas4free). I had all my pictures in a single folder in owncloud - a few thousand of them. i decided to order them in a folder of the year they were taken and a subfolder with the month. The files were all moved to the proper folder, but it looks like many of the encryption keys in files_encryption/keyfiles are sill in their original location. The keys in share-keys seem to be in the right place. The files appear to be encrypted correctly.

I moved the keyfiles manually, and the errors stopped.

mrhanman avatar Apr 20 '14 00:04 mrhanman

@mrhanman there were issues related to moving share keys of files with specific name patterns, that was fixed in OC 7.0.3.

@onewaypub any update ? Did you manage to recover your files ? I see you're using OS X for your server, this isn't officially supported and there are a few knows issues with it.

PVince81 avatar Dec 05 '14 16:12 PVince81

Closing due to lack of activity/feedback. Like I said above a critical encryption bug was fixed in 7.0.3.

Feel free to reopen if you're still having issues with 7.0.5 or 8.0.2. Thanks.

PVince81 avatar Mar 23 '15 17:03 PVince81