Added a form for entering a passphrase for a private ssh key and the corresponding logic for processing a private key

This commit is contained in:
vladimir.kuznetsov 2023-04-02 09:09:20 +03:00
parent f6ca22ecdd
commit f3aef67be6
10 changed files with 161 additions and 8 deletions

View file

@ -46,7 +46,7 @@ ErrorCode ServerController::runScript(const ServerCredentials &credentials, QStr
const std::function<ErrorCode (const QString &, libssh::Client &)> &cbReadStdOut,
const std::function<ErrorCode (const QString &, libssh::Client &)> &cbReadStdErr) {
auto error = m_sshClient.connectToHost(credentials);
auto error = m_sshClient.connectToHost(credentials, m_passphraseCallback);
if (error != ErrorCode::NoError) {
return error;
}
@ -221,7 +221,7 @@ ErrorCode ServerController::checkOpenVpnServer(DockerContainer container, const
ErrorCode ServerController::uploadFileToHost(const ServerCredentials &credentials, const QByteArray &data, const QString &remotePath,
libssh::SftpOverwriteMode overwriteMode)
{
auto error = m_sshClient.connectToHost(credentials);
auto error = m_sshClient.connectToHost(credentials, m_passphraseCallback);
if (error != ErrorCode::NoError) {
return error;
}
@ -754,3 +754,8 @@ ErrorCode ServerController::getAlreadyInstalledContainers(const ServerCredential
return ErrorCode::NoError;
}
void ServerController::setPassphraseCallback(const std::function<QString()> &callback)
{
m_passphraseCallback = callback;
}