Cannot login after enabling encryption
Expected behaviour
I can at least work normally as long as it does not refer to encrypted files
Actual behaviour
Immediately after enabling encryption, I was stuck at the login screen.
After disabling the app in the database (UPDATE oc_appconfig SET configvalue = 'no' WHERE appid='files_encryption' AND configkey='enabled';) everything is back to normal.
Steps to reproduce
- Enable the encryption app
- Switching to the Files app, I am instead seeing the login screen
- Stuck at the login screen
Server configuration
Operating system: Ubuntu 12.04.2 LTS
Web server: Apache/2.2.22
Database: PostgreSQL 9.1
PHP version: PHP 5.3.10-1ubuntu3.6 with Suhosin-Patch (cli) (built: Mar 11 2013 14:31:48)
ownCloud version: 5.0.7
Client configuration
Browser: Safari, Firefox, …
Operating system: MacOSX
Logs
Web server error log
78.105.207.250 - - [07/Jun/2013:12:10:47 +0200] "GET /owncloud/ HTTP/1.1" 200 2049 "https://example.com/owncloud/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"
78.105.207.250 - - [07/Jun/2013:12:10:48 +0200] "GET /owncloud/remote.php/core.css?v=f0873a91b499e265ff6d78ff6e8985a0 HTTP/1.1" 304 254 "https://example.com/owncloud/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"
78.105.207.250 - - [07/Jun/2013:12:10:48 +0200] "GET /owncloud/core/js/visitortimezone.js?v=f0873a91b499e265ff6d78ff6e8985a0 HTTP/1.1" 304 360 "https://example.com/owncloud/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"
78.105.207.250 - - [07/Jun/2013:12:10:48 +0200] "GET /owncloud/index.php/core/js/config.js?v=f0873a91b499e265ff6d78ff6e8985a0 HTTP/1.1" 200 2030 "https://example.com/owncloud/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"
78.105.207.250 - - [07/Jun/2013:12:10:48 +0200] "GET /owncloud/remote.php/core.js?v=f0873a91b499e265ff6d78ff6e8985a0 HTTP/1.1" 304 388 "https://example.com/owncloud/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"
78.105.207.250 - - [07/Jun/2013:12:10:48 +0200] "GET /owncloud/index.php/core/routes.json HTTP/1.1" 304 254 "https://example.com/owncloud/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"
78.105.207.250 - - [07/Jun/2013:12:10:48 +0200] "GET /owncloud/core/img/logo.svg HTTP/1.1" 200 111590 "https://example.com/owncloud/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"
78.105.207.250 - - [07/Jun/2013:12:10:48 +0200] "GET /owncloud/core/img/actions/user.svg HTTP/1.1" 200 54612 "https://example.com/owncloud/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"
78.105.207.250 - - [07/Jun/2013:12:10:48 +0200] "GET /owncloud/core/img/actions/password.svg HTTP/1.1" 200 66861 "https://example.com/owncloud/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"
78.105.207.250 - - [07/Jun/2013:12:10:48 +0200] "GET /owncloud/core/img/actions/toggle.png?2013-06-06T09:26:40Z HTTP/1.1" 304 204 "https://example.com/owncloud/remote.php/core.css?v=f0873a91b499e265ff6d78ff6e8985a0" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"
78.105.207.250 - - [07/Jun/2013:12:10:48 +0200] "GET /owncloud/core/img/breadcrumb.svg HTTP/1.1" 200 3001 "https://example.com/owncloud/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"
78.105.207.250 - - [07/Jun/2013:12:10:48 +0200] "GET /owncloud/cron.php HTTP/1.1" 200 703 "https://example.com/owncloud/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"
78.105.207.250 - - [07/Jun/2013:12:10:53 +0200] "POST /owncloud/ HTTP/1.1" 302 1005 "https://example.com/owncloud/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"
78.105.207.250 - - [07/Jun/2013:12:10:53 +0200] "GET /owncloud/index.php/apps/files HTTP/1.1" 302 885 "https://example.com/owncloud/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"
78.105.207.250 - - [07/Jun/2013:12:10:54 +0200] "GET /owncloud/ HTTP/1.1" 200 1913 "https://example.com/owncloud/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"
78.105.207.250 - - [07/Jun/2013:12:10:54 +0200] "GET /owncloud/remote.php/core.css?v=f0873a91b499e265ff6d78ff6e8985a0 HTTP/1.1" 304 254 "https://example.com/owncloud/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"
78.105.207.250 - - [07/Jun/2013:12:10:54 +0200] "GET /owncloud/core/js/visitortimezone.js?v=f0873a91b499e265ff6d78ff6e8985a0 HTTP/1.1" 304 360 "https://example.com/owncloud/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"
78.105.207.250 - - [07/Jun/2013:12:10:54 +0200] "GET /owncloud/index.php/core/js/config.js?v=f0873a91b499e265ff6d78ff6e8985a0 HTTP/1.1" 200 2030 "https://example.com/owncloud/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"
78.105.207.250 - - [07/Jun/2013:12:10:54 +0200] "GET /owncloud/remote.php/core.js?v=f0873a91b499e265ff6d78ff6e8985a0 HTTP/1.1" 304 388 "https://example.com/owncloud/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"
78.105.207.250 - - [07/Jun/2013:12:10:55 +0200] "GET /owncloud/index.php/core/routes.json HTTP/1.1" 304 254 "https://example.com/owncloud/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"
78.105.207.250 - - [07/Jun/2013:12:10:55 +0200] "GET /owncloud/cron.php HTTP/1.1" 200 569 "https://example.com/owncloud/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"
ownCloud log (data/owncloud.log)
{"app":"core","message":"Adding user backend instance of OC_User_Database.","level":0,"time":1370598440}
{"app":"core","message":"Adding user backend instance of OC_User_Database.","level":0,"time":1370598440}
{"app":"hook","message":"error while running hook (OCA\\Encryption\\Hooks::login): Encryption library: no data provided for decryption","level":3,"time":1370598440}
{"app":"core","message":"Adding user backend instance of OC_User_Database.","level":0,"time":1370598446}
{"app":"core","message":"Adding user backend instance of OC_User_Database.","level":0,"time":1370598474}
{"app":"core","message":"Adding user backend instance of OC_User_Database.","level":0,"time":1370598476}
{"app":"core","message":"Adding user backend instance of OC_User_Database.","level":0,"time":1370598476}
{"app":"hook","message":"error while running hook (OCA\\Encryption\\Hooks::login): Encryption library: no data provided for decryption","level":3,"time":1370598477}
{"app":"core","message":"Adding user backend instance of OC_User_Database.","level":0,"time":1370598483}
{"app":"core","message":"Adding user backend instance of OC_User_Database.","level":0,"time":1370598511}
{"app":"core","message":"Adding user backend instance of OC_User_Database.","level":0,"time":1370598513}
{"app":"core","message":"Adding user backend instance of OC_User_Database.","level":0,"time":1370598513}
{"app":"hook","message":"error while running hook (OCA\\Encryption\\Hooks::login): Encryption library: no data provided for decryption","level":3,"time":1370598513}
{"app":"core","message":"Adding user backend instance of OC_User_Database.","level":0,"time":1370598519}
{"app":"core","message":"Adding user backend instance of OC_User_Database.","level":0,"time":1370598547}
It's intended to log you out after enabling the encryption app. Since your log-in password is used to encrypt your private key that's the only way to create the encryption keys.
The first log-in after enabling the app can take some time because all your data will be encrypted at this point in time. What do you exactly mean with "Stuck at the login screen" what happens if you try to log in?
same issue here, loging in only results in a reload of the login screen itself. repeats forever and is also happening after a few hours after enabling the encryption. the accounts are also quite small, just a few megs.
I'm having the same problems on a Windows 7 x64 / Apache 2.22 setup. From the log:
same issue here.
Apache/2.4 (Win32) OpenSSL/1.0.1c PHP/5.4
log:
{"app":"PHP","message":"mysql_close(): 48 is not a valid MySQL-Link resource at C:\\webroot\\xxxx-xxxx.xx\\cloud\\lib\\setup.php#277","level":2,"time":1371558464}
{"app":"PHP","message":"openssl_pkey_export(): cannot get key from parameter 1 at C:\\webroot\\xxxx-xxxx.xx\\cloud\\apps\\files_encryption\\lib\\crypt.php#57","level":2,"time":1371558553}
{"app":"PHP","message":"openssl_pkey_get_details() expects parameter 1 to be resource, boolean given at C:\\webroot\\xxxx-xxxx.xx\\cloud\\apps\\files_encryption\\lib\\crypt.php#60","level":2,"time":1371558553}
{"app":"PHP","message":"Missing argument 2 for OC\\Files\\Storage\\MappedLocal::file_put_contents(), called in C:\\webroot\\xxxx-xxxx.xx\\cloud\\lib\\files\\view.php on line 644 and defined at C:\\webroot\\xxxx-xxxx.xx\\cloud\\lib\\files\\storage\\mappedlocal.php#133","level":2,"time":1371558553}
{"app":"PHP","message":"Undefined variable: data at C:\\webroot\\xxxx-xxxx.xx\\cloud\\lib\\files\\storage\\mappedlocal.php#134","level":2,"time":1371558553}
{"app":"core","message":"Authentication cookie rejected for user admin","level":2,"time":1371558554}
{"app":"PHP","message":"openssl_pkey_export(): cannot get key from parameter 1 at C:\\webroot\\xxxx-xxxx.xx\\cloud\\apps\\files_encryption\\lib\\crypt.php#57","level":2,"time":1371558615}
{"app":"PHP","message":"openssl_pkey_get_details() expects parameter 1 to be resource, boolean given at C:\\webroot\\xxxx-xxxx.xx\\cloud\\apps\\files_encryption\\lib\\crypt.php#60","level":2,"time":1371558615}
{"app":"PHP","message":"Missing argument 2 for OC\\Files\\Storage\\MappedLocal::file_put_contents(), called in C:\\webroot\\xxxx-xxxx.xx\\cloud\\lib\\files\\view.php on line 644 and defined at C:\\webroot\\xxxx-xxxx.xx\\cloud\\lib\\files\\storage\\mappedlocal.php#133","level":2,"time":1371558615}
{"app":"PHP","message":"Undefined variable: data at C:\\webroot\\xxxx-xxxx.xx\\cloud\\lib\\files\\storage\\mappedlocal.php#134","level":2,"time":1371558615}
{"app":"hook","message":"error while running hook (OCA\\Encryption\\Hooks::login): Encryption library: no data provided for decryption","level":3,"time":1371558615}
Hi, anybody found solution for this??
I have this problem...
Until now I was not able to reproduce it.
Can you please check if data/user/files_encryption/user.privateKey exists and contains a private key?
exists, but it is empty. also in data/public-keys/ and in data/owncloud-private-key/ every key is empty
Looks like something during the creation of the key-pair went wrong.
Can you remove the users key in data/public-keys and in data/user/files_encryption and try to log in again? This should trigger the creation of a new key-pair. Please monitor your apache error log and owncloud.log during this process and report the messages which appear there. Also check the keys afterwards. Thanks.
I prepared a update for the encryption app to output more error messages in case something went wrong during key generation: https://github.com/owncloud/core/pull/3788
If the trail I described above doesn't provide any useful information than it would be great if you could apply the patch to your system and try again. Than we should get some meaningful information.
It could be also useful to check your server settings if openSSL is set up correctly: http://www.php.net/manual/en/openssl.installation.php
I've the same problem. I've deaktivate the encryption app, empty the owncloud.log and then reaktivate the encryption app. To get a log file without other errors. I've add a table "oc_users_pay" for my university project, it look like that is a problem?!
{"app":"PHP","message":"openssl_pkey_export(): cannot get key from parameter 1 at D:\Programme\xampp\htdocs\SecOCloud\apps\files_encryption\lib\crypt.php#57","level":2,"time":1371721498}
{"app":"PHP","message":"openssl_pkey_get_details() expects parameter 1 to be resource, boolean given at D:\Programme\xampp\htdocs\SecOCloud\apps\files_encryption\lib\crypt.php#60","level":2,"time":1371721498}
{"app":"PHP","message":"Missing argument 2 for OC\Files\Storage\MappedLocal::file_put_contents(), called in D:\Programme\xampp\htdocs\SecOCloud\lib\files\view.php on line 644 and defined at D:\Programme\xampp\htdocs\SecOCloud\lib\files\storage\mappedlocal.php#133","level":2,"time":1371721498}
{"app":"PHP","message":"Undefined variable: data at D:\Programme\xampp\htdocs\SecOCloud\lib\files\storage\mappedlocal.php#134","level":2,"time":1371721498}
{"app":"PHP","message":"Undefined index: email at D:\Programme\xampp\htdocs\SecOCloud\core\templates\login.php#83","level":2,"time":1371721500}
{"app":"PHP","message":"Undefined index: pay_type at D:\Programme\xampp\htdocs\SecOCloud\core\templates\login.php#90","level":2,"time":1371721500}
{"app":"PHP","message":"Undefined index: Creditcard_no at D:\Programme\xampp\htdocs\SecOCloud\core\templates\login.php#98","level":2,"time":1371721500}
{"app":"PHP","message":"Undefined index: Creditcard_no at D:\Programme\xampp\htdocs\SecOCloud\core\templates\login.php#105","level":2,"time":1371721500}
{"app":"PHP","message":"Undefined index: volume at D:\Programme\xampp\htdocs\SecOCloud\core\templates\login.php#112","level":2,"time":1371721500}
{"app":"PHP","message":"Undefined index: chechno at D:\Programme\xampp\htdocs\SecOCloud\core\templates\login.php#119","level":2,"time":1371721500}
{"app":"PHP","message":"Undefined index: email at D:\Programme\xampp\htdocs\SecOCloud\core\templates\login.php#83","level":2,"time":1371721504}
{"app":"PHP","message":"Undefined index: pay_type at D:\Programme\xampp\htdocs\SecOCloud\core\templates\login.php#90","level":2,"time":1371721504}
{"app":"PHP","message":"Undefined index: Creditcard_no at D:\Programme\xampp\htdocs\SecOCloud\core\templates\login.php#98","level":2,"time":1371721504}
{"app":"PHP","message":"Undefined index: Creditcard_no at D:\Programme\xampp\htdocs\SecOCloud\core\templates\login.php#105","level":2,"time":1371721504}
{"app":"PHP","message":"Undefined index: volume at D:\Programme\xampp\htdocs\SecOCloud\core\templates\login.php#112","level":2,"time":1371721504}
{"app":"PHP","message":"Undefined index: chechno at D:\Programme\xampp\htdocs\SecOCloud\core\templates\login.php#119","level":2,"time":1371721504}
{"app":"files_antivirus","message":"The clamscan executable could not be found at /usr/bin/clamscan","level":3,"time":1371721510}
{"app":"PHP","message":"Undefined variable: user at D:\Programme\xampp\htdocs\SecOCloud\apps\files_antivirus\lib\scanner.php#62","level":2,"time":1371721510}
{"app":"files_antivirus","message":"File "bbott4/files/127.0.0.1.txt" from user "": is not checked","level":3,"time":1371721510}
{"app":"files_antivirus","message":"The clamscan executable could not be found at /usr/bin/clamscan","level":3,"time":1371721510}
{"app":"PHP","message":"Undefined variable: user at D:\Programme\xampp\htdocs\SecOCloud\apps\files_antivirus\lib\scanner.php#62","level":2,"time":1371721510}
{"app":"files_antivirus","message":"File "files/127.0.0.1.txt" from user "": is not checked","level":3,"time":1371721510}
I remove the users key in data/public-keys and in data/user/files_encryption
This is owncloud.log now, and not login again:
{"app":"Encryption library","message":"Encryption (symmetric) of content failed","level":3,"time":1371850756} {"app":"Encryption library","message":"Encryption (symmetric) of keyfile content failed","level":3,"time":1371850756} {"app":"hook","message":"error while running hook (OCA\Encryption\Hooks::login): Encryption library: no data provided for decryption","level":3,"time":1371850756}
ideas?
For some reasons the key doesn't get generated correctly. This sound pretty much like a openssl issue. Did you checked that openSSL is installed and configured correctly on your system? See: http://www.php.net/manual/en/openssl.installation.php
Which owCloud version did you tried? Would be great if you could try the latest stable5 branch directly from github. This contains a lot of improvements regarding error reporting which should give us more information.
i used OC 5.0.7 .deb installation in ubuntu server 10.x.
how to install OC 5.0.7 github version?
send me the command lines pls!
thx!
You can clone it into a new folder with
git clone git://github.com/owncloud/core.git .
after that switch to the stable5 branch:
git checkout -b stable5 origin/stable5
If you open the new folder in your browser you can configure this version of ownCloud like you did it with your current version.
If you are unfamiliar with this approach you could also pick the following files from github and use them to replace the corresponding files of your ownCloud installation (make a backup of the original files first, so that you can revert the changes):
apps/files_encryption/lib/crypt.php -> https://github.com/owncloud/core/blob/stable5/apps/files_encryption/lib/crypt.php
apps/files_encryption/lib/util.php -> https://github.com/owncloud/core/blob/stable5/apps/files_encryption/lib/util.php
apps/files_encryption/appinfo/app.php -> https://github.com/owncloud/core/blob/stable5/apps/files_encryption/appinfo/app.php
apps/files_encryption/hooks/hooks.php -> https://github.com/owncloud/core/blob/stable5/apps/files_encryption/hooks/hooks.php
thx, but now i have another issues
owncloud.log cgallardo@SERVERGALA:/var/www/testOC/owncloud2/data$ sudo tail -f owncloud.log {"app":"PHP","message":"openssl_encrypt() expects at most 4 parameters, 5 given at /var/www/testOC/owncloud2/apps/files_encryption/lib/crypt.php#208","level":2,"time":1372085987} {"app":"Encryption library","message":"Encryption (symmetric) of content failed","level":3,"time":1372085987} {"app":"Encryption library","message":"Encryption (symmetric) of keyfile content failed","level":3,"time":1372085987} {"app":"PHP","message":"file_get_contents(/var/www/testOC/owncloud2/data/cgallardo/files_encryption/cgallardo.private.key): failed to open stream: No such file or directory at /var/www/testOC/owncloud2/lib/files/storage/local.php#113","level":2,"time":1372085987} {"app":"hook","message":"error while running hook (OCA\Encryption\Hooks::login): Encryption library: no data provided for decryption","level":3,"time":1372085987}
no login user and file missing {"app":"PHP","message":"file_get_contents(/var/www/testOC/owncloud2/data/cgallardo/files_encryption/cgallardo.private.key): failed to open stream: No such file or directory at /var/www/testOC/owncloud2/lib/files/storage/local.php#113","level":2,"time":1372085987}
how to create this .key?
{"app":"PHP","message":"openssl_encrypt() expects at most 4 parameters, 5 given at /var/www/testOC/owncloud2/apps/files_encryption/lib/crypt.php#208","level":2,"time":1372085987}
This function call didn't changed since stable 5.0.7, so it is strange that you see this error message only now. Anyway, as you can see here, openssl_encrypt() can take up to 5 parameters: http://de2.php.net/manual/en/function.openssl-encrypt.php Maybe you have a older PHP version?
The .key gets generated by ownCloud and encrypted by openssl_encrypt(), but this seems to fail on your server.
I use Windows 7 with Xampp 1.8.1 (Apache 2.4.3) and OwnCloud 5.0.7 (non Pre). I have aktivate in the phpi.ini the openssl.dll. What else should I do for the right openssl conf?
@bbott sorry, I'm not a windows expert. Did you followed this instructions: http://www.php.net/manual/en/openssl.installation.php ?
If it still doesn't work, what does your error log says?
Would be great if you could also try the latest stable5 branch from github or patch your installation with the files I mentioned above in the conversation with @pcreadycl. Also make sure to delete all the (empty) key files so that ownCloud tried to create new ones.
openssl is installed correct. tested with several code snippets and all throwed the right output. maybe openssl is still configured wrong, but no log file throws any ssl related errors.
[ OwnCloud 5.0.12 ] log after deleting key files and updated files mentioned above:
{"app":"Encryption library","message":"couldn't generate users key-pair for admin","level":3,"time":1372192169}
{"app":"PHP","message":"file_get_contents(C:\\webroot\\xxxx-xxxx.de\\cloud\\data\/admin\/files-encryption\/admin-private.key): failed to open stream: No such file or directory at C:\\webroot\\xxxx-xxxx.de\\cloud\\lib\\files\\storage\\mappedlocal.php#131","level":2,"time":1372192169}
{"app":"hook","message":"error while running hook (OCA\\Encryption\\Hooks::login): Encryption library: no data provided for decryption","level":3,"time":1372192169}
{"app":"Encryption library","message":"couldn't generate users key-pair for admin","level":3,"time":1372192170}
{"app":"PHP","message":"Missing argument 2 for OC\\Files\\Storage\\MappedLocal::file_put_contents(), called in C:\\webroot\\xxxx-xxxx.de\\cloud\\lib\\files\\view.php on line 644 and defined at C:\\webroot\\xxxx-xxxx.de\\cloud\\lib\\files\\storage\\mappedlocal.php#133","level":2,"time":1372192170}
{"app":"PHP","message":"Undefined variable: data at C:\\webroot\\xxxx-xxxx.de\\cloud\\lib\\files\\storage\\mappedlocal.php#134","level":2,"time":1372192170}
{"app":"Encryption library","message":"symmetrically encryption failed, no content given.","level":3,"time":1372192170}
i dont think a ssl error, i think this error to OC, developer.. help?