Skip to content

add migration script from old encryption to new one - #15445

Merged
th3fallen merged 7 commits into
masterfrom
enc2_migration
Apr 16, 2015
Merged

th3fallen merged 7 commits into
masterfrom
enc2_migration

Conversation

@schiessle

Copy link
Copy Markdown
Contributor

migration from the old encryption to the new one.

All test pass locally but still need manual testing.

Since encryption 2.0 is a new app the admin needs to manually enable the new encryption module in the app store and enable encryption in the admin settings.

There are two ways to upgrade from the old encryption.

The admin setting show you one of the following messages:

You need to migrate your encryption keys from the old encryption (ownCloud <= 8.0) to the new one. Please enable the "ownCloud Default Encryption Module" and run 'occ encryption:migrate'

or

'You need to migrate your encryption keys from the old encryption (ownCloud <= 8.0) to the new one.' [Start Migration]

The second message is shown if no external user back-end is enabled. In this case we can assume a reasonable small installation and let the user execute the migration from the web interface by clicking the "Start migration" button.
If external user back-ends are enabled we expect a larger installation and a installation where the admin has access to the command line, in this case we recommend the occ tool

cc @th3fallen maybe you can give it a try?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldnt this know the encryption module id since keys are stored in /files_encryption/OC_DEFAULT_MODULE/*.$keyid

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The id is used here when we create the new target location: https://github.com/owncloud/core/pull/15445/files#diff-edd4cc87f86b59eb64c8f85bf4de2ba7R184

The parameter contains the path to the old location.

@th3fallen

Copy link
Copy Markdown
Contributor
 ✘  ~/Sites/OwnCloud/core   enc2_migration  occ encryption:migrate
Reorganize system folder structure



  [Doctrine\DBAL\Exception\UniqueConstraintViolationException]
  An exception occurred while executing 'UPDATE `oc_appconfig` SET `appid` = ? WHERE `appid` = ?' with params ["encryption", "files_encryption"]:
  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'encryption-enabled' for key 'PRIMARY'






  [Doctrine\DBAL\Driver\PDOException]
  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'encryption-enabled' for key 'PRIMARY'






  [PDOException]
  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'encryption-enabled' for key 'PRIMARY'



encryption:migrate [user_id1] ... [user_idN]

@th3fallen

Copy link
Copy Markdown
Contributor

@DeepDiver1975 thoughts on his question?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it wasn't me 😉

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was you... It's a 1:1 copy from the old encryption where you created the command line tool 😄

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DeepDiver1975 Nice try 😈

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

damn 😉

@DeepDiver1975 DeepDiver1975 added this to the 8.1-current milestone Apr 7, 2015
@DeepDiver1975

Copy link
Copy Markdown
Contributor

From my POV a manual step is okay as long as we properly display this to the admin during/after upgrade.
We have to think about installations with no terminal access - I was thinking about having a web console to trigger occ commands ......

@schiessle

Copy link
Copy Markdown
Contributor Author

@th3fallen thanks for testing. The problem here is that the new encryption directly created the share-key and the recovery-key and write it to the database. That's OK in most cases but in case of a migration we have a conflict. We probably need a check if we are still in transition and hold the new encryption back as long as the migration isn't finished... I will have a look at it.

@schiessle

Copy link
Copy Markdown
Contributor Author

@owncloud-bot retest this please

@schiessle

Copy link
Copy Markdown
Contributor Author

@owncloud-bot retest this please

@ghost

ghost commented Apr 9, 2015

Copy link
Copy Markdown

Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/11348/
🚀 Test PASSed.🚀
chuck

@schiessle

Copy link
Copy Markdown
Contributor Author

There are now two ways to upgrade from the old encryption.
The admin setting show you one of the following messages:

You need to migrate your encryption keys from the old encryption (ownCloud <= 8.0) to the new one. Please enable the "ownCloud Default Encryption Module" and run 'occ encryption:migrate'

or

'You need to migrate your encryption keys from the old encryption (ownCloud <= 8.0) to the new one.' [Start Migration]

The second message is shown if no external user back-end is enabled. In this case we can assume a reasonable small installation and let the user execute the migration from the web interface by clicking the "Start migration" button.
If external user back-ends are enabled we expect a larger installation and a installation where the admin has access to the command line, in this case we recommend the occ tool

Please review and test it... Thanks!

@ghost

ghost commented Apr 9, 2015

Copy link
Copy Markdown

Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/11388/
🚀 Test PASSed.🚀
chuck

@th3fallen

Copy link
Copy Markdown
Contributor

needs rebase and still getting this

 ✘  ~/Sites/OwnCloud/core   enc2_migration  occ encryption:migrate th3fallen
Reorganize system folder structure



  [Doctrine\DBAL\Exception\UniqueConstraintViolationException]
  An exception occurred while executing 'UPDATE `oc_appconfig` SET `appid` = ? WHERE `appid` = ?' with params ["encryption", "files_encryption"]:
  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'encryption-publicShareKeyId' for key 'PRIMARY'






  [Doctrine\DBAL\Driver\PDOException]
  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'encryption-publicShareKeyId' for key 'PRIMARY'






  [PDOException]
  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'encryption-publicShareKeyId' for key 'PRIMARY'



encryption:migrate [user_id1] ... [user_idN]

Comment thread apps/encryption/appinfo/info.xml Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While at it: Shouldn't this not get properly indented?

@PVince81

Copy link
Copy Markdown
Contributor

I have a fix for the SFTP storage (it was specific for that one), so I will test upgrading with ext storage shares now.

@PVince81

Copy link
Copy Markdown
Contributor

@schiesbn ok I'm done: I applied #15644 to be able to test with SFTP + shares. Files cannot be downloaded as recipients.

Then I tried the same on stable8 and noticed that this never worked in the first place... so nothing from this PR. Raised as: #15645

The only remaining issue for this PR is #15445 (comment)

@schiessle

Copy link
Copy Markdown
Contributor Author

@PVince81 public link shares should work now

@schiessle

Copy link
Copy Markdown
Contributor Author

@owncloud-bot retest this please

@PVince81

Copy link
Copy Markdown
Contributor

Tested public link migration, works now 👍

I hope you manage to fix the Oracle issue too.

@schiessle
schiessle force-pushed the enc2_migration branch 2 times, most recently from 15ca10e to 771364d Compare April 16, 2015 08:36
@schiessle

Copy link
Copy Markdown
Contributor Author

@owncloud-bot retest this please

@schiessle

Copy link
Copy Markdown
Contributor Author

@owncloud-bot retest this please

@schiessle

Copy link
Copy Markdown
Contributor Author

@owncloud-bot retest this please

@scrutinizer-notifier

Copy link
Copy Markdown

The inspection completed: 12 new issues, 52 updated code elements

@ghost

ghost commented Apr 16, 2015

Copy link
Copy Markdown

Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/11572/
🚀 Test PASSed.🚀
chuck

@schiessle

Copy link
Copy Markdown
Contributor Author

need second reviewer @DeepDiver1975 @th3fallen

@th3fallen

Copy link
Copy Markdown
Contributor

🙌 Works for me 👍

th3fallen added a commit that referenced this pull request Apr 16, 2015
add migration script from old encryption to new one
@th3fallen
th3fallen merged commit 1174ad0 into master Apr 16, 2015
@th3fallen
th3fallen deleted the enc2_migration branch April 16, 2015 13:34
@lock lock Bot locked as resolved and limited conversation to collaborators Aug 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants