diff --git a/client/core/defs.h b/client/core/defs.h index 4f715006..4ea03dbe 100644 --- a/client/core/defs.h +++ b/client/core/defs.h @@ -28,6 +28,7 @@ enum ErrorCode ServerCheckFailed, ServerPortAlreadyAllocatedError, ServerContainerMissingError, + ServerDockerFailedError, // Ssh connection errors SshSocketError, SshTimeoutError, SshProtocolError, diff --git a/client/core/errorstrings.cpp b/client/core/errorstrings.cpp index 537a1db8..bbf5cea4 100644 --- a/client/core/errorstrings.cpp +++ b/client/core/errorstrings.cpp @@ -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"); diff --git a/client/core/servercontroller.cpp b/client/core/servercontroller.cpp index e27f6ff8..b58a2454 100644 --- a/client/core/servercontroller.cpp +++ b/client/core/servercontroller.cpp @@ -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) diff --git a/client/defines.h b/client/defines.h index ee9b84e6..86adf289 100644 --- a/client/defines.h +++ b/client/defines.h @@ -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 diff --git a/client/protocols/openvpnprotocol.cpp b/client/protocols/openvpnprotocol.cpp index c47795c0..5371c566 100644 --- a/client/protocols/openvpnprotocol.cpp +++ b/client/protocols/openvpnprotocol.cpp @@ -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() diff --git a/client/protocols/protocols_defs.h b/client/protocols/protocols_defs.h index 6f0bc6c5..e70dae0f 100644 --- a/client/protocols/protocols_defs.h +++ b/client/protocols/protocols_defs.h @@ -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"; } diff --git a/client/server_scripts/install_docker.sh b/client/server_scripts/install_docker.sh index 1e4043bf..baff7cb6 100644 --- a/client/server_scripts/install_docker.sh +++ b/client/server_scripts/install_docker.sh @@ -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 diff --git a/client/ui/Controls/SlidingStackedWidget.cpp b/client/ui/Controls/SlidingStackedWidget.cpp index d37422d1..dd64197d 100644 --- a/client/ui/Controls/SlidingStackedWidget.cpp +++ b/client/ui/Controls/SlidingStackedWidget.cpp @@ -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(); diff --git a/client/ui/mainwindow.ui b/client/ui/mainwindow.ui index 09c5b326..0cbd7c6d 100644 --- a/client/ui/mainwindow.ui +++ b/client/ui/mainwindow.ui @@ -2224,7 +2224,7 @@ border: none; - mail.ru + tile.openstreetmap.org @@ -7542,7 +7542,7 @@ color: #100A44; - mail.ru + tile.openstreetmap.org diff --git a/client/vpnconnection.cpp b/client/vpnconnection.cpp index a7ec5f04..4433ace2 100644 --- a/client/vpnconnection.cpp +++ b/client/vpnconnection.cpp @@ -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 response = IpcClient::Interface()->clearSavedRoutes(); + response.waitForFinished(1000); } if (!m_vpnProtocol.data()) {