core icon indicating copy to clipboard operation
core copied to clipboard

Problem with encryption:change-key-storage-root occ command

Open tnagyce opened this issue 10 years ago • 10 comments

I've run the following command sudo -u www-data encryption:change-key-storage-root ../../../mnt/storage/.owncloud_keys and I got the following message: "Key Storage is not ready".

So I tried to figure out what could be the problem, but unfortunately I couldn't.

However when the path is set to ../../../mnt/storage/.owncloud_keys the paths gets a / appended to the beginning of the string like this: /../../../mnt/storage/.owncloud_keys. If I change the path from database to /mnt/storage/.owncloud_keys the starting / gets removed, like this: mnt/storage/.owncloud_keys.

In both cases the Key storage fails to recognize the path correctly.

The .owncloud_keys folder is mounted with ecryptfs and exists on the partition. The folder permissions are set up as the following: drwxrws--- 2 root www-data 4096 Oct 26 19:17 .owncloud_keys/

So for now I've set the encryption storage path back to an empty string, which restored the working order. But I'd like to move the encryption keys to a safe place if it's possible.

Server configuration

Operating system:

root@icarus:/mnt/storage# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.1 LTS
Release:        16.04
Codename:       xenial
root@icarus:/mnt/storage# uname -a
Linux icarus 4.4.0-36-generic #55-Ubuntu SMP Thu Aug 11 18:01:55 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Web server:

root@icarus:/mnt/storage# apache2 -v
Server version: Apache/2.4.18 (Ubuntu)
Server built:   2016-07-14T12:32:26

Database:

root@icarus:/mnt/storage# mysql --version
mysql  Ver 14.14 Distrib 5.7.16, for Linux (x86_64) using  EditLine wrapper

PHP version:

root@icarus:/mnt/storage# php -v
PHP 7.0.8-0ubuntu0.16.04.3 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.8-0ubuntu0.16.04.3, Copyright (c) 1999-2016, by Zend Technologies

ownCloud version: ownCloud 9.1.1 (stable)

Updated from an older ownCloud or fresh install: no, fresh install

Where did you install ownCloud from: through apt-get

Signing status (ownCloud 9.0 and above): ???

List of activated apps:

yce@icarus:/var/www/owncloud$ sudo -u www-data php occ app:list
Enabled:
  - activity: 2.3.2
  - calendar: 1.4.0
  - comments: 0.3.0
  - contacts: 1.4.0.0
  - dav: 0.2.6
  - documents: 0.13.1
  - encryption: 1.3.0
  - federatedfilesharing: 0.3.0
  - federation: 0.1.0
  - files: 1.5.1
  - files_pdfviewer: 0.8.1
  - files_sharing: 0.10.0
  - files_texteditor: 2.1
  - files_trashbin: 0.9.0
  - files_versions: 1.3.0
  - files_videoplayer: 0.9.8
  - firstrunwizard: 1.1
  - gallery: 15.0.0
  - notifications: 0.3.0
  - ownnote: 1.08
  - provisioning_api: 0.5.0
  - shorten: 0.0.15
  - systemtags: 0.3.0
  - tasks: 0.9.3
  - templateeditor: 0.1
  - twofactor_totp: 0.4.1
  - updatenotification: 0.2.1
Disabled:
  - external
  - files_antivirus
  - files_external
  - richdocuments
  - user_external
  - user_ldap

The content of config/config.php:

yce@icarus:/var/www/owncloud$ sudo -u www-data php occ config:list system
{
    "system": {
        "updatechecker": false,
        "instanceid": "ocuqig4hmh2z",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "icarus",
            "ycarus.noip.me"
        ],
        "datadirectory": "\/mnt\/storage\/.owncloud",
        "overwrite.cli.url": "http:\/\/icarus\/owncloud",
        "dbtype": "mysql",
        "version": "9.1.1.3",
        "dbname": "owncloud",
        "dbhost": "127.0.0.1",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "logtimezone": "UTC",
        "installed": true,
        "loglevel": 2,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "maintenance": false
    }
}

Are you using external storage, if yes which one: local

Are you using encryption: yes

Are you using an external user-backend, if yes which one: no

Stack trace:

yce@icarus:/var/www/owncloud$ sudo -u www-data ./occ encryption:status
An unhandled exception has been thrown:
OC\ServiceUnavailableException: Key Storage is not ready in /var/www/owncloud/lib/private/Encryption/Manager.php:113
Stack trace:
#0 /var/www/owncloud/apps/encryption/appinfo/app.php(27): OC\Encryption\Manager->isReady()
#1 /var/www/owncloud/lib/private/legacy/app.php(186): require_once('/var/www/ownclo...')
#2 /var/www/owncloud/lib/private/legacy/app.php(149): OC_App::requireAppFile('encryption')
#3 /var/www/owncloud/lib/private/legacy/app.php(119): OC_App::loadApp('encryption')
#4 /var/www/owncloud/lib/private/Console/Application.php(95): OC_App::loadApps()
#5 /var/www/owncloud/console.php(93): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /var/www/owncloud/occ(11): require_once('/var/www/ownclo...')

tnagyce avatar Oct 26 '16 22:10 tnagyce

From what I remember when trying this a year ago or so, the key storage path must be a subpath relative to the "data" path. So you can't use "..", etc... Not sure why.

PVince81 avatar Oct 27 '16 08:10 PVince81

So will it work if I symlink my storage under the data folder?

tnagyce avatar Oct 27 '16 09:10 tnagyce

I don't know, why don't you try ?

PVince81 avatar Oct 27 '16 09:10 PVince81

Hm, maybe that's not a good idea, because that would be under the docroot of the ownCloud site. I would rather store the keys outside of it.

tnagyce avatar Oct 27 '16 09:10 tnagyce

Same issue: performed a copy/paste from the documentation (on a fresh test instance of course)... leads to a corrupted OC instance, unable even to log in. Disabling encryption in the DB restores the log in feature, but the admin page remains totally junked Any roadmap? Thanks

avv-github avatar Dec 16 '16 11:12 avv-github

I commented line 112 in owncloud/lib/private/Encryption/Manager.php

            //if ($this->isKeyStorageReady() === false) {
            //      throw new ServiceUnavailableException('Key Storage is not ready');
            //}

I can access to the admin panel. Maybe not the best solution but I didnt found how the isKeyStorageReady method works.

I hope this help.

CristianCardosoA avatar Jan 30 '17 23:01 CristianCardosoA

Or create the expected hidden file ".oc_key_storage" in the key storage folder. Maybe for some reason it could not be created or went missing.

PVince81 avatar Jan 31 '17 07:01 PVince81

Doesn't work, I already try that. When I commented the code on that part, that gave me a time to reinstall again.

Thanks !

CristianCardosoA avatar Jan 31 '17 14:01 CristianCardosoA

Hey, this issue has been closed because the label status/STALE is set and there were no updates for 7 days. Feel free to reopen this issue if you deem it appropriate.

(This is an automated comment from GitMate.io.

ownclouders avatar Dec 21 '17 01:12 ownclouders

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.

lock[bot] avatar Jul 31 '19 12:07 lock[bot]