-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[7.0.3RC2] Local files still encrypted after sync download #11908
Comments
When I change the file in the web UI with the text editor (the file is still decrypted there), the sync client will resync it down but the local result is STILL encrypted. |
Very strange: when I download the file with the Android client it appears in clear text. Only downloading with the sync client leaves the file encrypted. |
After restarting the sync client the file is downloading properly. I just remembered that I rebooted my server while the sync client was running... I have the feeling that this is a session management issue: normally when the sync client logs in, the user's private key will be stored in the session. If I reboot the server, there's a chance that the session will still exist somehow. Not sure how the session could mess itself up the way it did for me ? I'll try to reproduce this in a controlled local environment. @schiesbn @LukasReschke any idea ? |
There was nothing to be seen in the logs. |
Mhm. Yes. But then the key should also still be within the session. - That's really very strange. Do you happen to have a dump of the request that leads to this result? Also is the session content of this session different from the one when using Web-Based Login? Does it work via the browser when logging-in via /remote.php/webdav/? |
It's already too late as I restarted the sync client. As specified before, the Android client did not have any issues and that one is using WebDAV. I'll have another try tomorrow and see whether rebooting the server while syncing/downloading could cause that issue again... |
Just a guess, maybe the sync client does something similar to the "remember" option for the web login. We disabled it for the web login if encryption is enabled because that will lead to the exact same result, the user will be logged in but without a private key because no password was provided. cc @danimo @dragotin What do you think, could this be the reason? |
Seems to be difficult to reproduce locally. It could be a race condition. |
I tried setting |
Maybe it happened because I still had a session from before the upgrade, and it was kept after the upgrade, since I did not shut down my sync client. It was an upgrade to 7.0.3 RC2 back then. @javiergonzper reported that it also happend to iOS clients just after an 7.0.3, so that might be a clue to find a way to reproduce it. |
We have the problem here: And also other issue that could be related: @PVince81 maybe I did not explain well on the irc. In our case the sessions are new because we are using a new install of the app. |
Would be good to get this investigated! This could be real bad... |
Do we have an environment where this happens consistently ? |
I tried upgrading from 7.0.2 to 7.0.3 with a running sync client + cadaver session, with encryption enabled: no issues. Then I tried setting "session_timeout" to one minute and let sync client, cadaver and web UI timeout. Downloading files still delivers unencrypted files. Works properly. I only had this once on my personal server but since I restarted the sync client the problem went away, so not possible to debug. |
@PVince81 on the daily server at the instance stable7 I can reproduce it using the current iOS app of the market. I just added two account and change of account several times downloading the same file every time until it fails. Once it fails it does not work never. |
Just now I also tried stopping Apache2, deleting all session files while the sync client is still running. Then brought back Apache 2. The client still continued working. So I'm still not sure what exactly is happening with the session. For the iOS app if it's keeping the same cookie all the time and never re-logins, it means you'll still be on the broken session. On the desktop app, closing it and restarting it will retrigger a login and get a new session/cookie. From what I remember when it happened to me (#11908 (comment)) I had rebooted the server completely so that killed Apache and maybe also the session (if there was an Apache update as well). But not sure. |
Yes, we are reusing the same session al the time. We asume that the server will manage the update of the cookie because on all the requests we send also the user/password. Are we right? |
I believe that if the cookie isn't valid it should reauthenticate automatically. |
One thing that could cause files to be downloaded encrypted is if the file proxy gets disabled (which happens in lots of places) but doesn't get reenabled for some reason, maybe some exception happening in the middle but which also wouldn't be thrown out and continue processing (for example hooks swallow exceptions...) |
The app stores two informations in the session: the private key and the initialization mode. But looking at the code there is no visible code path that would have the private key present but not the initialization mode. To make this happen the PHP process would have to get killed while a session is being invalidated exactly between these two lines: https://github.com/owncloud/core/blob/master/apps/files_encryption/lib/session.php#L140 |
I tried to sabotage the sync client's session by setting This doesn't prove that it is actually our problem though... |
If it happens again for anyone we should grab the matching session files from the server for further examination. |
@PVince81 is it possible that the encryption are using a wrong session (previous session) to decrypt the files and it is not using the last one? |
Yes. But normally all code paths should lead to either the old session to be destroyed/invalidated or the old session should still contain a valid private key. For a session to be valid it need to contain:
If for some mysterious reason one of both is missing it could lead to issues. But from all code paths it looks like it's impossible to reach a situation where the private key is in the session but initialization status is still 0. So best would be to find the session file on the server for that broken session so we can look at these two values. |
Something to try: setting |
i set this value from ~20 minutes to 10hours. First, it seemed to have changed something but now the problems are back. Maybe it takes longer for them to return. |
This is happening to me, but I'm not the administrator of the server. Using client ver 1.5.0 on Ubuntu 14.04. The server uname -a output is: Is there a way to manually decrypt the files? |
I believe we fixed this a while ago and it was due to cookie handling ? @LukasReschke @javiergonzper @schiesbn @sjlawson you cannot decrypt the file locally. To recover from this situation, either: Advanced stuff: what I did was |
We didn't noticed something similar to this during the past year. I guess this is solved - also encryption 2.0 changed a lot in the architecture. |
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. |
Steps to reproduce:
Expected result
All files properly downloaded
Actual result
Some files locally encrypted, but fine on server.
One file, "articles.txt" looks like this:
Another file "pomodoro.txt" (which is my TODO list) has a conflict:
The file "pomodoro.txt" is still encrypted.
The conflict file "pomodoro_conflict-20141101-091042.txt" is fine.
If I download "articles.txt" and "pomodoro.txt" from the web UI the files are decrypted properly.
VERY STRANGE.
Versions
ownCloud 7.0.3 RC2
Sync client 1.7.0 beta1
CC @schiesbn
@karlitschek @MTRichards @craigpg potential showstopper. Need to find a way to reproduce it locally first (only happened on my own server so far)
The text was updated successfully, but these errors were encountered: