Merge branch 'dev' of github.com:amnezia-vpn/amnezia-client into feature/new-gui
This commit is contained in:
commit
e0d6e0117e
12 changed files with 63 additions and 40 deletions
|
|
@ -236,14 +236,7 @@ ErrorCode ServerController::setupContainer(const ServerCredentials &credentials,
|
|||
ErrorCode e = ErrorCode::NoError;
|
||||
|
||||
e = isUserInSudo(credentials, container);
|
||||
if (e)
|
||||
return e;
|
||||
|
||||
if (!isUpdate) {
|
||||
e = isServerPortBusy(credentials, container, config);
|
||||
if (e)
|
||||
return e;
|
||||
}
|
||||
if (e) return e;
|
||||
|
||||
e = isServerDpkgBusy(credentials, container);
|
||||
if (e)
|
||||
|
|
@ -254,6 +247,16 @@ ErrorCode ServerController::setupContainer(const ServerCredentials &credentials,
|
|||
return e;
|
||||
qDebug().noquote() << "ServerController::setupContainer installDockerWorker finished";
|
||||
|
||||
if (!isUpdate) {
|
||||
e = isServerPortBusy(credentials, container, config);
|
||||
if (e) return e;
|
||||
}
|
||||
|
||||
if (!isUpdate) {
|
||||
e = isServerPortBusy(credentials, container, config);
|
||||
if (e) return e;
|
||||
}
|
||||
|
||||
e = prepareHostWorker(credentials, container, config);
|
||||
if (e)
|
||||
return e;
|
||||
|
|
@ -356,8 +359,8 @@ ErrorCode ServerController::installDockerWorker(const ServerCredentials &credent
|
|||
replaceVars(amnezia::scriptData(SharedScriptType::install_docker), genVarsForScript(credentials)),
|
||||
cbReadStdOut, cbReadStdErr);
|
||||
|
||||
if (stdOut.contains("command not found"))
|
||||
return ErrorCode::ServerDockerFailedError;
|
||||
qDebug().noquote() << "ServerController::installDockerWorker" << stdOut;
|
||||
if (stdOut.contains("command not found")) return ErrorCode::ServerDockerFailedError;
|
||||
|
||||
return error;
|
||||
}
|
||||
|
|
@ -655,7 +658,7 @@ ErrorCode ServerController::isServerPortBusy(const ServerCredentials &credential
|
|||
ProtocolProps::transportProtoToString(ProtocolProps::defaultTransportProto(protocol), protocol);
|
||||
QString transportProto = containerConfig.value(config_key::transport_proto).toString(defaultTransportProto);
|
||||
|
||||
QString script = QString("sudo lsof -i -P -n | grep -E ':%1 ").arg(port);
|
||||
QString script = QString("which lsof &>/dev/null || true && sudo lsof -i -P -n | grep -E ':%1 ").arg(port);
|
||||
for (auto &port : fixedPorts) {
|
||||
script = script.append("|:%1").arg(port);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -369,16 +369,18 @@ namespace libssh {
|
|||
m_passphraseCallback = passphraseCallback;
|
||||
authResult = ssh_pki_import_privkey_base64(credentials.secretData.toStdString().c_str(), nullptr, callback, nullptr, &privateKey);
|
||||
if (authResult == SSH_OK) {
|
||||
char* key = new char[65535];
|
||||
char *b64 = nullptr;
|
||||
|
||||
authResult = ssh_pki_export_privkey_base64(privateKey, nullptr, nullptr, nullptr, &key);
|
||||
decryptedPrivateKey = key;
|
||||
delete[] key;
|
||||
authResult = ssh_pki_export_privkey_base64(privateKey, nullptr, nullptr, nullptr, &b64);
|
||||
decryptedPrivateKey = QString(b64);
|
||||
|
||||
if (authResult != SSH_OK) {
|
||||
qDebug() << "failed to export private key";
|
||||
errorCode = ErrorCode::InternalError;
|
||||
}
|
||||
else {
|
||||
ssh_string_free_char(b64);
|
||||
}
|
||||
} else {
|
||||
errorCode = ErrorCode::SshPrivateKeyError;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue