Remote Wipe: Implement hack to allow deleting all keychain entries (SSL certs & keys)

Client SSL certificates and keys cannot be deleted at this time because there is
no UI for selecting them on re-login.

We introduce this dirty hack here, to allow deleting them upon Remote Wipe.

Signed-off-by: Michael Schuster <michael@schuster.ms>
This commit is contained in:
Michael Schuster 2019-12-08 00:00:02 +01:00 коммит произвёл Michael Schuster
Родитель 6ef9f3cc26
Коммит 0c5f4a1525
3 изменённых файлов: 53 добавлений и 17 удалений

Просмотреть файл

@ -432,14 +432,7 @@ void WebFlowCredentials::forgetSensitiveData() {
invalidateToken();
/* IMPORTANT
* TODO: For "Log out" & "Remove account": Remove client CA certs and KEY!
*
* Disabled as long as selecting another cert is not supported by the UI.
*
* Being able to specify a new certificate is important anyway: expiry etc.
*/
//deleteKeychainEntries();
deleteKeychainEntries();
}
void WebFlowCredentials::setAccount(Account *account) {
@ -706,19 +699,34 @@ void WebFlowCredentials::deleteKeychainEntries(bool oldKeychainEntries) {
};
startDeleteJob(_user);
startDeleteJob(_user + clientKeyPEMC);
startDeleteJob(_user + clientCertificatePEMC);
for (auto i = 0; i < _clientSslCaCertificates.count(); i++) {
startDeleteJob(_user + clientCaCertificatePEMC + QString::number(i));
}
/* IMPORTANT - remove later - FIXME MS@2019-12-07 -->
* TODO: For "Log out" & "Remove account": Remove client CA certs and KEY!
*
* Disabled as long as selecting another cert is not supported by the UI.
*
* Being able to specify a new certificate is important anyway: expiry etc.
*
* We introduce this dirty hack here, to allow deleting them upon Remote Wipe.
*/
if(_account->isRemoteWipeRequested_HACK()) {
// <-- FIXME MS@2019-12-07
startDeleteJob(_user + clientKeyPEMC);
startDeleteJob(_user + clientCertificatePEMC);
for (auto i = 0; i < _clientSslCaCertificates.count(); i++) {
startDeleteJob(_user + clientCaCertificatePEMC + QString::number(i));
}
#if defined(Q_OS_WIN)
// also delete key sub-chunks (Windows workaround)
for (auto i = 1; i < _clientSslKeyChunkCount; i++) {
startDeleteJob(_user + clientKeyPEMC + QString(".") + QString::number(i));
}
// also delete key sub-chunks (Windows workaround)
for (auto i = 1; i < _clientSslKeyChunkCount; i++) {
startDeleteJob(_user + clientKeyPEMC + QString(".") + QString::number(i));
}
#endif
// FIXME MS@2019-12-07 -->
}
// <-- FIXME MS@2019-12-07
}
}

Просмотреть файл

@ -100,6 +100,18 @@ void RemoteWipe::checkJobSlot()
auto accountState = manager->account(_account->displayName()).data();
if(wipe){
/* IMPORTANT - remove later - FIXME MS@2019-12-07 -->
* TODO: For "Log out" & "Remove account": Remove client CA certs and KEY!
*
* Disabled as long as selecting another cert is not supported by the UI.
*
* Being able to specify a new certificate is important anyway: expiry etc.
*
* We introduce this dirty hack here, to allow deleting them upon Remote Wipe.
*/
_account->setRemoteWipeRequested_HACK();
// <-- FIXME MS@2019-12-07
// delete account
manager->deleteAccount(accountState);
manager->save();

Просмотреть файл

@ -323,6 +323,22 @@ private:
bool _wroteAppPassword = false;
friend class AccountManager;
/* IMPORTANT - remove later - FIXME MS@2019-12-07 -->
* TODO: For "Log out" & "Remove account": Remove client CA certs and KEY!
*
* Disabled as long as selecting another cert is not supported by the UI.
*
* Being able to specify a new certificate is important anyway: expiry etc.
*
* We introduce this dirty hack here, to allow deleting them upon Remote Wipe.
*/
public:
void setRemoteWipeRequested_HACK() { _isRemoteWipeRequested_HACK = true; }
bool isRemoteWipeRequested_HACK() { return _isRemoteWipeRequested_HACK; }
private:
bool _isRemoteWipeRequested_HACK = false;
// <-- FIXME MS@2019-12-07
};
}