Various bug fixes
This commit is contained in:
parent
973cbd83d9
commit
b1f7baa79f
10 changed files with 30 additions and 20 deletions
|
@ -28,6 +28,7 @@ enum ErrorCode
|
|||
ServerCheckFailed,
|
||||
ServerPortAlreadyAllocatedError,
|
||||
ServerContainerMissingError,
|
||||
ServerDockerFailedError,
|
||||
|
||||
// Ssh connection errors
|
||||
SshSocketError, SshTimeoutError, SshProtocolError,
|
||||
|
|
|
@ -13,6 +13,8 @@ QString errorString(ErrorCode code){
|
|||
// Server errors
|
||||
case(ServerCheckFailed): return QObject::tr("Server check failed");
|
||||
case(ServerPortAlreadyAllocatedError): return QObject::tr("Server port already used. Check for another software");
|
||||
case(ServerContainerMissingError): return QObject::tr("Server error: Docker container missing");
|
||||
case(ServerDockerFailedError): return QObject::tr("Server error: Docker failed");
|
||||
|
||||
// Ssh connection errors
|
||||
case(SshSocketError): return QObject::tr("Ssh connection error");
|
||||
|
|
|
@ -390,6 +390,9 @@ ErrorCode ServerController::setupContainer(const ServerCredentials &credentials,
|
|||
if (e) return e;
|
||||
qDebug().noquote() << "ServerController::setupContainer configureContainerWorker finished";
|
||||
|
||||
setupServerFirewall(credentials);
|
||||
qDebug().noquote() << "ServerController::setupContainer setupServerFirewall finished";
|
||||
|
||||
return startupContainerWorker(credentials, container, config);
|
||||
}
|
||||
|
||||
|
@ -460,10 +463,14 @@ ErrorCode ServerController::installDockerWorker(const ServerCredentials &credent
|
|||
stdOut += data + "\n";
|
||||
};
|
||||
|
||||
return runScript(sshParams(credentials),
|
||||
ErrorCode e = runScript(sshParams(credentials),
|
||||
replaceVars(amnezia::scriptData(SharedScriptType::install_docker),
|
||||
genVarsForScript(credentials, container)),
|
||||
genVarsForScript(credentials)),
|
||||
cbReadStdOut, cbReadStdErr);
|
||||
|
||||
if (stdOut.contains("command not found")) return ErrorCode::ServerDockerFailedError;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
ErrorCode ServerController::prepareHostWorker(const ServerCredentials &credentials, DockerContainer container, const QJsonObject &config)
|
||||
|
@ -681,7 +688,7 @@ ErrorCode ServerController::setupServerFirewall(const ServerCredentials &credent
|
|||
{
|
||||
return runScript(sshParams(credentials),
|
||||
replaceVars(amnezia::scriptData(SharedScriptType::setup_host_firewall),
|
||||
genVarsForScript(credentials, DockerContainer::OpenVpnOverCloak)));
|
||||
genVarsForScript(credentials)));
|
||||
}
|
||||
|
||||
QString ServerController::replaceVars(const QString &script, const Vars &vars)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#define APPLICATION_NAME "AmneziaVPN"
|
||||
#define SERVICE_NAME "AmneziaVPN-service"
|
||||
#define ORGANIZATION_NAME "AmneziaVPN.ORG"
|
||||
#define APP_MAJOR_VERSION "1.8.0"
|
||||
#define APP_VERSION "1.8.0.0"
|
||||
#define APP_MAJOR_VERSION "1.8.1"
|
||||
#define APP_VERSION "1.8.1.0"
|
||||
|
||||
#endif // DEFINES_H
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
OpenVpnProtocol::OpenVpnProtocol(const QJsonObject &configuration, QObject* parent) :
|
||||
VpnProtocol(configuration, parent)
|
||||
{
|
||||
Utils::initializePath(defaultConfigPath());
|
||||
|
||||
readOpenVpnConfiguration(configuration);
|
||||
connect(&m_managementServer, &ManagementServer::readyRead, this, &OpenVpnProtocol::onReadyReadDataFromManagementServer);
|
||||
}
|
||||
|
@ -28,13 +26,16 @@ OpenVpnProtocol::~OpenVpnProtocol()
|
|||
|
||||
QString OpenVpnProtocol::defaultConfigFileName()
|
||||
{
|
||||
qDebug() << "OpenVpnProtocol::defaultConfigFileName" << defaultConfigPath() + QString("/%1.ovpn").arg(APPLICATION_NAME);
|
||||
//qDebug() << "OpenVpnProtocol::defaultConfigFileName" << defaultConfigPath() + QString("/%1.ovpn").arg(APPLICATION_NAME);
|
||||
return defaultConfigPath() + QString("/%1.ovpn").arg(APPLICATION_NAME);
|
||||
}
|
||||
|
||||
QString OpenVpnProtocol::defaultConfigPath()
|
||||
{
|
||||
return QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/config";
|
||||
QString p = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/config";
|
||||
Utils::initializePath(p);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
void OpenVpnProtocol::stop()
|
||||
|
|
|
@ -93,7 +93,7 @@ constexpr char ckPublicKeyPath[] = "/opt/amnezia/cloak/cloak_public.key";
|
|||
constexpr char ckBypassUidKeyPath[] = "/opt/amnezia/cloak/cloak_bypass_uid.key";
|
||||
constexpr char ckAdminKeyPath[] = "/opt/amnezia/cloak/cloak_admin_uid.key";
|
||||
constexpr char defaultPort[] = "443";
|
||||
constexpr char defaultRedirSite[] = "mail.ru";
|
||||
constexpr char defaultRedirSite[] = "tile.openstreetmap.org";
|
||||
constexpr char defaultCipher[] = "chacha20-ietf-poly1305";
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
pm_apt="/usr/bin/apt-get"; pm_yum="/usr/bin/yum";\
|
||||
if [[ -f "$pm_apt" ]]; then pm=$pm_apt; docker_pkg="docker.io"; else pm=$pm_yum; docker_pkg="docker"; fi;\
|
||||
if [[ ! -f "/usr/bin/sudo" ]]; then $pm update -y -q; $pm install -y -q sudo; fi;\
|
||||
docker_service=$(systemctl list-units --full -all | grep docker.service);\
|
||||
docker_service=$(systemctl list-units --full -all | grep docker.service | grep -v inactive | grep -v dead | grep -v failed);\
|
||||
if [[ -f "$pm_apt" ]]; then export DEBIAN_FRONTEND=noninteractive; fi;\
|
||||
if [[ -z "$docker_service" ]]; then sudo $pm update -y -q; sudo $pm install -y -q curl $docker_pkg; fi;\
|
||||
sudo systemctl start docker
|
||||
docker_service=$(systemctl list-units --full -all | grep docker.service | grep -v inactive | grep -v dead | grep -v failed);\
|
||||
if [[ -z "$docker_service" ]]; then sleep 5 && sudo systemctl start docker && sleep 5; fi;\
|
||||
docker --version
|
||||
|
|
|
@ -109,7 +109,7 @@ void SlidingStackedWidget::waitForAnimation()
|
|||
{
|
||||
if (!isAnimationRunning()) return;
|
||||
|
||||
qDebug() << "Wait for stacked widget animation";
|
||||
//qDebug() << "Wait for stacked widget animation";
|
||||
QEventLoop l;
|
||||
connect(animgroup, &QParallelAnimationGroup::finished, &l, &QEventLoop::quit);
|
||||
l.exec();
|
||||
|
|
|
@ -2224,7 +2224,7 @@ border: none;
|
|||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>mail.ru</string>
|
||||
<string>tile.openstreetmap.org</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -7542,7 +7542,7 @@ color: #100A44;
|
|||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>mail.ru</string>
|
||||
<string>tile.openstreetmap.org</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_102">
|
||||
|
|
|
@ -261,10 +261,6 @@ ErrorCode VpnConnection::connectToVpn(int serverIndex,
|
|||
|
||||
emit connectionStateChanged(VpnProtocol::Connecting);
|
||||
|
||||
if (credentials.isValid()) {
|
||||
ServerController::setupServerFirewall(credentials);
|
||||
}
|
||||
|
||||
if (m_vpnProtocol) {
|
||||
disconnect(m_vpnProtocol.data(), &VpnProtocol::protocolError, this, &VpnConnection::vpnProtocolError);
|
||||
m_vpnProtocol->stop();
|
||||
|
@ -346,7 +342,8 @@ void VpnConnection::disconnectFromVpn()
|
|||
IpcClient::Interface()->flushDns();
|
||||
|
||||
// delete cached routes
|
||||
IpcClient::Interface()->clearSavedRoutes();
|
||||
QRemoteObjectPendingReply<bool> response = IpcClient::Interface()->clearSavedRoutes();
|
||||
response.waitForFinished(1000);
|
||||
}
|
||||
|
||||
if (!m_vpnProtocol.data()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue