-
-
Notifications
You must be signed in to change notification settings - Fork 4.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
Add an occ command to scan files for legacy file key in use and get rid of those #38080
Conversation
…id of those Signed-off-by: Côme Chilliet <[email protected]>
Signed-off-by: Côme Chilliet <[email protected]>
Signed-off-by: Côme Chilliet <[email protected]>
@icewind1991 |
@@ -309,7 +309,12 @@ | |||
|
|||
$publicKeys = $this->keyManager->addSystemKeys($this->accessList, $publicKeys, $this->getOwner($path)); | |||
$shareKeys = $this->crypt->multiKeyEncrypt($this->fileKey, $publicKeys); | |||
$this->keyManager->deleteLegacyFileKey($this->path); | |||
if (!$this->keyManager->deleteLegacyFileKey($this->path)) { | |||
$this->logger->warning( |
Check notice
Code scanning / Psalm
DeprecatedMethod
1379731
to
0f867eb
Compare
We have to rewrite the header, so the whole file needs to be rewritten, so we just use the same strategy as DecryptAll. Signed-off-by: Côme Chilliet <[email protected]>
0f867eb
to
725403c
Compare
So, I was not able to do this in a smart way, in the end the whole file has to be written again anyway since the header at the beginning needs to change. So I went for the same implementation as the Ready for review. |
Signed-off-by: Côme Chilliet <[email protected]>
… mode. Signed-off-by: Côme Chilliet <[email protected]>
3884df7
to
a92028f
Compare
Ok this is now working and not losing fileid anymore. Ready for review. |
CI failures not related |
Signed-off-by: Côme Chilliet <[email protected]>
$output->writeln('<error>Failed to migrate ' . $path . '</error>'); | ||
$output->writeln('<error>' . $e . '</error>', OutputInterface::VERBOSITY_VERBOSE); | ||
} finally { | ||
if (is_resource($copyResource)) { |
Check notice
Code scanning / Psalm
RedundantConditionGivenDocblockType
$output->writeln('<error>Failed to migrate ' . $path . '</error>'); | ||
$output->writeln('<error>' . $e . '</error>', OutputInterface::VERBOSITY_VERBOSE); | ||
} finally { | ||
if (is_resource($copyResource)) { |
Check notice
Code scanning / Psalm
PossiblyUndefinedVariable
if (is_resource($copyResource)) { | ||
fclose($copyResource); | ||
} | ||
if (is_resource($sourceResource)) { |
Check notice
Code scanning / Psalm
RedundantConditionGivenDocblockType
if (is_resource($copyResource)) { | ||
fclose($copyResource); | ||
} | ||
if (is_resource($sourceResource)) { |
Check notice
Code scanning / Psalm
PossiblyUndefinedVariable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Is there any plans to update the documentation on server side encryption or write some documentation on the migration process using this new occ command ? If a follow up PR on the documentation of the migration process exists, could it be please linked here ? |
@AkechiShiro Still needs someone to pick it up, but tracking doc addition in nextcloud/documentation#11539. Thanks for the reminder! |
Summary
Add an occ command to scan files for legacy key format, and migrate those to the new format.
Only works if master key is enabled.
Checklist