Fix Windows IPsec
This commit is contained in:
parent
1754a82f67
commit
90912f9231
2 changed files with 16 additions and 13 deletions
|
|
@ -10,6 +10,7 @@
|
||||||
#include "ikev2_vpn_protocol_windows.h"
|
#include "ikev2_vpn_protocol_windows.h"
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
|
||||||
|
|
||||||
static Ikev2Protocol* self = nullptr;
|
static Ikev2Protocol* self = nullptr;
|
||||||
static std::mutex rasDialFuncMutex;
|
static std::mutex rasDialFuncMutex;
|
||||||
|
|
||||||
|
|
@ -80,10 +81,10 @@ void Ikev2Protocol::newConnectionStateEventReceived(UINT unMsg, tagRASCONNSTATE
|
||||||
case RASCS_AuthNotify:
|
case RASCS_AuthNotify:
|
||||||
//qDebug()<<__FUNCTION__ << __LINE__;
|
//qDebug()<<__FUNCTION__ << __LINE__;
|
||||||
if (dwError != 0) {
|
if (dwError != 0) {
|
||||||
//qDebug() << "have error" << dwError;
|
qDebug() << "have error" << dwError;
|
||||||
setConnectionState(Vpn::ConnectionState::Disconnected);
|
setConnectionState(Vpn::ConnectionState::Disconnected);
|
||||||
} else {
|
} else {
|
||||||
//qDebug() << "RASCS_AuthNotify but no error" << dwError;
|
qDebug() << "RASCS_AuthNotify but no error" << dwError;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RASCS_AuthRetry:
|
case RASCS_AuthRetry:
|
||||||
|
|
@ -193,16 +194,16 @@ ErrorCode Ikev2Protocol::start()
|
||||||
return ErrorCode::AmneziaServiceConnectionFailed;
|
return ErrorCode::AmneziaServiceConnectionFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
certInstallProcess->waitForSource(1000);
|
certInstallProcess->waitForSource();
|
||||||
if (!certInstallProcess->isInitialized()) {
|
if (!certInstallProcess->isInitialized()) {
|
||||||
qWarning() << "IpcProcess replica is not connected!";
|
qWarning() << "IpcProcess replica is not connected!";
|
||||||
setLastError(ErrorCode::AmneziaServiceConnectionFailed);
|
setLastError(ErrorCode::AmneziaServiceConnectionFailed);
|
||||||
return ErrorCode::AmneziaServiceConnectionFailed;
|
return ErrorCode::AmneziaServiceConnectionFailed;
|
||||||
}
|
}
|
||||||
certInstallProcess->setProgram(PermittedProcess::CertUtil);
|
certInstallProcess->setProgram(PermittedProcess::CertUtil);
|
||||||
QStringList arguments({"-f" , "-importpfx",
|
QString password = QString("-p %1").arg(m_config[config_key::password].toString());
|
||||||
"-p", m_config[config_key::password].toString(),
|
QStringList arguments({"-f", "-importpfx", password,
|
||||||
certFile.fileName(), "NoExport"
|
QDir::toNativeSeparators(certFile.fileName()), "NoExport"
|
||||||
});
|
});
|
||||||
certInstallProcess->setArguments(arguments);
|
certInstallProcess->setArguments(arguments);
|
||||||
|
|
||||||
|
|
@ -227,9 +228,8 @@ ErrorCode Ikev2Protocol::start()
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
auto adapterConfigProcess = new QProcess;
|
QProcess adapterConfigProcess;
|
||||||
|
adapterConfigProcess.setProgram("powershell");
|
||||||
adapterConfigProcess->setProgram("powershell");
|
|
||||||
QString arguments = QString("-command \"Set-VpnConnectionIPsecConfiguration\" "
|
QString arguments = QString("-command \"Set-VpnConnectionIPsecConfiguration\" "
|
||||||
"-ConnectionName '%1' "
|
"-ConnectionName '%1' "
|
||||||
"-AuthenticationTransformConstants GCMAES128 "
|
"-AuthenticationTransformConstants GCMAES128 "
|
||||||
|
|
@ -240,10 +240,11 @@ ErrorCode Ikev2Protocol::start()
|
||||||
"-DHGroup Group14 "
|
"-DHGroup Group14 "
|
||||||
"-PassThru -Force\"")
|
"-PassThru -Force\"")
|
||||||
.arg(tunnelName());
|
.arg(tunnelName());
|
||||||
adapterConfigProcess->setNativeArguments(arguments);
|
|
||||||
|
|
||||||
adapterConfigProcess->start();
|
adapterConfigProcess.setNativeArguments(arguments);
|
||||||
adapterConfigProcess->waitForFinished(5000);
|
|
||||||
|
adapterConfigProcess.start();
|
||||||
|
adapterConfigProcess.waitForFinished(5000);
|
||||||
}
|
}
|
||||||
//*/
|
//*/
|
||||||
{
|
{
|
||||||
|
|
@ -299,6 +300,7 @@ bool Ikev2Protocol::connect_to_vpn(const QString & vpn_name){
|
||||||
auto ret = RasDial(NULL, NULL, &RasDialParams, 0,
|
auto ret = RasDial(NULL, NULL, &RasDialParams, 0,
|
||||||
&RasDialFuncCallback,
|
&RasDialFuncCallback,
|
||||||
&hRasConn);
|
&hRasConn);
|
||||||
|
|
||||||
if (ret == ERROR_SUCCESS){
|
if (ret == ERROR_SUCCESS){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -263,7 +263,8 @@ PageType {
|
||||||
|
|
||||||
clickedFunc: function() {
|
clickedFunc: function() {
|
||||||
if (!port.textField.acceptableInput &&
|
if (!port.textField.acceptableInput &&
|
||||||
ContainerProps.containerTypeToString(dockerContainer) !== "torwebsite") {
|
ContainerProps.containerTypeToString(dockerContainer) !== "torwebsite" &&
|
||||||
|
ContainerProps.containerTypeToString(dockerContainer) !== "ikev2") {
|
||||||
port.errorText = qsTr("The port must be in the range of 1 to 65535")
|
port.errorText = qsTr("The port must be in the range of 1 to 65535")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue