Skip to content
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

Change to re-create masterkeys #6

Closed
wants to merge 1 commit into from
Closed

Conversation

sharidas
Copy link
Contributor

This change brings a new command to re-create
masterkey

Signed-off-by: Sujith H sharidasan@owncloud.com

Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

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

Good progress. There are still a few changes needed.

}

protected function execute(InputInterface $input, OutputInterface $output) {
if ($this->util->isMasterKeyEnabled()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should add a warning here before starting and asking whether to proceed "Y/N". Please check how warnings are displayed for the other encryption commands. Also add a "-y" option to answer yes automatically.

Considering that this will decrypt a whole instance and might take days, we better inform the admin in advance before starting.

cc @tomneedham

$progress->finish();
$output->writeln("\nEncryption completed successfully\n");
} else {
$output->writeln("Master key is not enabled. Kindly enable it\n");
Copy link
Contributor

Choose a reason for hiding this comment

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

please remove the "Kindly" bit. The instance might be in "user key" mode

}

public function encryptAllUsersFiles(ProgressBar $progress) {
$userNo = 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

start at zero ?

}
}

public function encryptUsersFiles($uid, ProgressBar $progress) {
Copy link
Contributor

Choose a reason for hiding this comment

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

is there any code from the occ encrypt-all command we could reuse ?

protected $appConfig;

/** @var IConfig */
protected $IConfig;
Copy link
Contributor

Choose a reason for hiding this comment

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

local attributes must start with a lower case and be camel case.

}
}

if (empty($this->failed)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

show error in case of failure ? an admin might want to ctrl+c when seeing this in real-time

protected $appConfig;

/** @var IConfig | \PHPUnit_Framework_MockObject_MockObject */
protected $IConfig;
Copy link
Contributor

Choose a reason for hiding this comment

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

see my comment on attribute casing above

@PVince81 PVince81 added this to the development milestone Jul 24, 2017
@sharidas sharidas force-pushed the recreate-masterkey-task branch 2 times, most recently from a69526c to cc7bbcb Compare July 28, 2017 14:29
$this->keyManager, $this->util, $this->config,
$this->mailer, $this->l, $this->questionHelper,
$this->secureRandom);
$this->encryptAll->encryptAll($input, $output);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We call encryptAll here. Reusing old code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we use encrypt all. Let me also see if we can reuse decrypt all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My mistake, its better to stick on with the decrypt implemented here. The final output of a decryptall is again encrypted. Which is not the result we want.

Copy link
Contributor

Choose a reason for hiding this comment

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

can you add a comment to clarify this, in case future developers wonder about the same question ?

@sharidas sharidas force-pushed the recreate-masterkey-task branch 2 times, most recently from a19ae76 to 5ebdd9e Compare July 31, 2017 12:30

protected function encryptAllUsers(InputInterface $input, OutputInterface $output) {
/*
* We are reusing the encryptAll code but not the decryptAll. The reason being
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added doc which says why we are not using decryptAll and re-using encryptAll. This should help future devs understand why we used this approach.

Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

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

👍, assuming you tested it and it still works

@sharidas
Copy link
Contributor Author

sharidas commented Jul 31, 2017

Testing done as follows:

  • Created user admin and created files.
  • Tried to modify the files.
  • Ran the command. Relogin as admin user and verified the files were readable.
  • Created another user user1 and did the same procedure on both admin and user1

Testing done with external storage:

  • Create a file and move to the external storage.
  • Now try to update the file
  • Run the command from the location where the file was initially created.
  • After relogin, the file was readable. Done this exercise multiple times.

@sharidas sharidas force-pushed the recreate-masterkey-task branch 2 times, most recently from afe97a5 to 71f182d Compare July 31, 2017 17:08
@CLAassistant
Copy link

CLAassistant commented Jul 31, 2017

CLA assistant check
All committers have signed the CLA.

@sharidas sharidas force-pushed the recreate-masterkey-task branch from 71f182d to 775a4d0 Compare July 31, 2017 17:11
@sharidas sharidas force-pushed the recreate-masterkey-task branch 13 times, most recently from 3749e30 to fd11f85 Compare August 21, 2017 10:07
This change brings a new command to re-create
masterkey

Signed-off-by: Sujith H <sharidasan@owncloud.com>
@sharidas sharidas force-pushed the recreate-masterkey-task branch from fd11f85 to 2b1eb3e Compare August 21, 2017 12:14
@sharidas
Copy link
Contributor Author

Closing this PR. We have #12 to track.

@sharidas sharidas closed this Aug 31, 2017
@patrickjahns patrickjahns removed this from the QA milestone Aug 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants