My issue is basically outlined here: https://github.com/nextcloud/server/issues/8546 - exact same situation of “Invalid private key for encryption” floating at the top. It seems that since I’m using an AWS S3 bucket for my sdd device I need the default encryption module enabled or all my files don’t appear. When I disable the module the error goes away, but I lose file access… I also don’t really care to have the encryption, I’m just trying to find a work around to disable the error message as it’s erroneous for my environment. More reading on that thread above shows that I should be able to edit /snap/nextcloud/<some number of the snap(s)/htdocs/apps/encryption/lib/Controller/StatusController.php to disable the message.
I understand that snaps are read only filesystems for distribution integrity so I can’t make any changes to this file. I’ve used the following commands to attempt to mount a folder over the top of the read only files:
mount --bind -o nodev,ro /etc/nextcloud/Controller /snap/nextcloud/12753/htdocs/apps/encryption/lib/Controller/`
mount --bind -o nodev,ro /etc/nextcloud/Controller /snap/nextcloud/11891/htdocs/apps/encryption/lib/Controller/
mount --bind -o nodev,ro /etc/nextcloud/Controller /snap/nextcloud/12387/htdocs/apps/encryption/lib/Controller/
In my /etc/nextcloud/Controller/StatusController.php file after the mount commands, I have modified the getStatus() function to try to force it to always return success:
public function getStatus() {
$status = 'error';
$message = 'no valid init status';
switch( $this->session->getStatus()) {
/* case Session::INIT_EXECUTED:
$status = 'interactionNeeded';
$message = (string)$this->l->t(
'Invalid private key for encryption app. Please update your private key password in your personal settings to recover access to your encrypted files.'
);
break;
case Session::NOT_INITIALIZED:
$status = 'interactionNeeded';
if ($this->encryptionManager->isEnabled()) {
$message = (string)$this->l->t(
'Encryption App is enabled, but your keys are not initialized. Please log-out and log-in again.'
);
} else {
$message = (string)$this->l->t(
'Please enable server side encryption in the admin settings in order to use the encryption module.'
);
}
break;
*/
case Session::INIT_SUCCESSFUL:
$status = 'success';
$message = (string)$this->l->t('Encryption app is enabled and ready');
default:
$status = 'success';
$message = (string)$this->l->t('Encryption app is enabled and ready');
}
return new DataResponse(
[
'status' => $status,
'data' => [
'message' => $message]
]
);
None of this works to get rid of the warning message at the top. I’m not a PHP dev, so I have no idea if what I’ve done should work or not. Still have that pesky error about encryption though:
“Invalid private key for encryption app. Please update your private key password in your personal settings to recover access to your encrypted files.”
Thanks for reading