Merge branch 'dev' of github.com:amnezia-vpn/desktop-client into feature/cloak-and-ss-in-linux-bundle

This commit is contained in:
vladimir.kuznetsov 2023-02-02 13:08:23 +03:00
commit f7ee532add
22 changed files with 130 additions and 64 deletions

3
.gitignore vendored
View file

@ -127,3 +127,6 @@ captures/
# Android Profiling # Android Profiling
*.hprof *.hprof
client/3rd/ShadowSocks/ss_ios.xcconfig client/3rd/ShadowSocks/ss_ios.xcconfig
# UML generated pics
out/

View file

@ -27,7 +27,7 @@ if(APPLE AND NOT IOS)
set(SOURCES ${SOURCES} ${CMAKE_CURRENT_LIST_DIR}/macos/botan_all.cpp) set(SOURCES ${SOURCES} ${CMAKE_CURRENT_LIST_DIR}/macos/botan_all.cpp)
endif() endif()
if(LINUX) if(LINUX AND NOT ANDROID)
include_directories(${CMAKE_CURRENT_LIST_DIR}/linux) include_directories(${CMAKE_CURRENT_LIST_DIR}/linux)
set(HEADERS ${HEADERS} ${CMAKE_CURRENT_LIST_DIR}/linux/botan_all.h) set(HEADERS ${HEADERS} ${CMAKE_CURRENT_LIST_DIR}/linux/botan_all.h)
set(SOURCES ${SOURCES} ${CMAKE_CURRENT_LIST_DIR}/linux/botan_all.cpp) set(SOURCES ${SOURCES} ${CMAKE_CURRENT_LIST_DIR}/linux/botan_all.cpp)

View file

@ -43,7 +43,7 @@ QString CloakConfigurator::genCloakConfig(const ServerCredentials &credentials,
config.insert("StreamTimeout", 300); config.insert("StreamTimeout", 300);
// transfer params to protocol runner // transfer params to protocol runner
config.insert(config_key::transport_proto, "$OPENVPN_TRANSPORT_PROTO"); config.insert(config_key::transport_proto, "tcp");
config.insert(config_key::remote, credentials.hostName); config.insert(config_key::remote, credentials.hostName);
config.insert(config_key::port, "$CLOAK_SERVER_PORT"); config.insert(config_key::port, "$CLOAK_SERVER_PORT");

View file

@ -70,7 +70,7 @@ QList<DockerContainer> ContainerProps::allContainers()
QMap<DockerContainer, QString> ContainerProps::containerHumanNames() QMap<DockerContainer, QString> ContainerProps::containerHumanNames()
{ {
return { return {
{DockerContainer::None, "Unknown (Old version)"}, {DockerContainer::None, "Not installed"},
{DockerContainer::OpenVpn, "OpenVPN"}, {DockerContainer::OpenVpn, "OpenVPN"},
{DockerContainer::ShadowSocks, "OpenVpn over ShadowSocks"}, {DockerContainer::ShadowSocks, "OpenVpn over ShadowSocks"},
{DockerContainer::Cloak, "OpenVpn over Cloak"}, {DockerContainer::Cloak, "OpenVpn over Cloak"},

View file

@ -549,10 +549,9 @@ ErrorCode ServerController::installDockerWorker(const ServerCredentials &credent
return ErrorCode::NoError; return ErrorCode::NoError;
}); });
watcher.setFuture(future);
QEventLoop wait; QEventLoop wait;
QObject::connect(&watcher, &QFutureWatcher<ErrorCode>::finished, &wait, &QEventLoop::quit); QObject::connect(&watcher, &QFutureWatcher<ErrorCode>::finished, &wait, &QEventLoop::quit);
watcher.setFuture(future);
wait.exec(); wait.exec();
m_cancelInstallation = false; m_cancelInstallation = false;

View file

@ -12,7 +12,7 @@ WireguardProtocol::WireguardProtocol(const QJsonObject &configuration, QObject*
VpnProtocol(configuration, parent) VpnProtocol(configuration, parent)
{ {
m_configFile.setFileName(QDir::tempPath() + QDir::separator() + serviceName() + ".conf"); m_configFile.setFileName(QDir::tempPath() + QDir::separator() + serviceName() + ".conf");
readWireguardConfiguration(configuration); writeWireguardConfiguration(configuration);
} }
WireguardProtocol::~WireguardProtocol() WireguardProtocol::~WireguardProtocol()
@ -70,7 +70,7 @@ void WireguardProtocol::stop()
} }
void WireguardProtocol::readWireguardConfiguration(const QJsonObject &configuration) void WireguardProtocol::writeWireguardConfiguration(const QJsonObject &configuration)
{ {
QJsonObject jConfig = configuration.value(ProtocolProps::key_proto_config_data(Proto::WireGuard)).toObject(); QJsonObject jConfig = configuration.value(ProtocolProps::key_proto_config_data(Proto::WireGuard)).toObject();

View file

@ -23,7 +23,7 @@ public:
private: private:
QString configPath() const; QString configPath() const;
void readWireguardConfiguration(const QJsonObject &configuration); void writeWireguardConfiguration(const QJsonObject &configuration);
void updateRouteGateway(QString line); void updateRouteGateway(QString line);
void updateVpnGateway(const QString &line); void updateVpnGateway(const QString &line);

View file

@ -163,5 +163,6 @@
<file>images/svg/control_point_black_24dp.svg</file> <file>images/svg/control_point_black_24dp.svg</file>
<file>images/svg/settings_suggest_black_24dp.svg</file> <file>images/svg/settings_suggest_black_24dp.svg</file>
<file>server_scripts/website_tor/Dockerfile</file> <file>server_scripts/website_tor/Dockerfile</file>
<file>ui/qml/Controls/PopupWithQuestion.qml</file>
</qresource> </qresource>
</RCC> </RCC>

View file

@ -1,5 +1,4 @@
FROM alpine:3.15 FROM alpine:3.15
LABEL maintainer="AmneziaVPN" LABEL maintainer="AmneziaVPN"
ARG SS_RELEASE="v1.13.1" ARG SS_RELEASE="v1.13.1"

View file

@ -1,6 +1,6 @@
cat > /opt/amnezia/openvpn/server.conf <<EOF cat > /opt/amnezia/openvpn/server.conf <<EOF
port $OPENVPN_PORT port $OPENVPN_PORT
proto $OPENVPN_TRANSPORT_PROTO proto tcp
dev tun dev tun
ca /opt/amnezia/openvpn/ca.crt ca /opt/amnezia/openvpn/ca.crt
cert /opt/amnezia/openvpn/AmneziaReq.crt cert /opt/amnezia/openvpn/AmneziaReq.crt
@ -39,7 +39,7 @@ cat > /opt/amnezia/cloak/ck-config.json <<EOF
{ {
"ProxyBook": { "ProxyBook": {
"openvpn": [ "openvpn": [
"$OPENVPN_TRANSPORT_PROTO", "tcp",
"localhost:$OPENVPN_PORT" "localhost:$OPENVPN_PORT"
], ],
"shadowsocks": [ "shadowsocks": [

View file

@ -1,6 +1,6 @@
client client
dev tun dev tun
proto $OPENVPN_TRANSPORT_PROTO proto tcp
resolv-retry infinite resolv-retry infinite
nobind nobind
persist-key persist-key

View file

@ -51,9 +51,15 @@ void OpenVpnLogic::updateProtocolPage(const QJsonObject &openvpnConfig, DockerCo
set_lineEditSubnetText(openvpnConfig.value(config_key::subnet_address). set_lineEditSubnetText(openvpnConfig.value(config_key::subnet_address).
toString(protocols::openvpn::defaultSubnetAddress)); toString(protocols::openvpn::defaultSubnetAddress));
QString trasnsport = openvpnConfig.value(config_key::transport_proto). QString trasnsport;
toString(protocols::openvpn::defaultTransportProto); if (container == DockerContainer::ShadowSocks || container == DockerContainer::Cloak) {
trasnsport = "tcp";
set_radioButtonUdpEnabled(false);
set_radioButtonTcpEnabled(false);
} else {
trasnsport = openvpnConfig.value(config_key::transport_proto).
toString(protocols::openvpn::defaultTransportProto);
}
set_radioButtonUdpChecked(trasnsport == protocols::openvpn::defaultTransportProto); set_radioButtonUdpChecked(trasnsport == protocols::openvpn::defaultTransportProto);
set_radioButtonTcpChecked(trasnsport != protocols::openvpn::defaultTransportProto); set_radioButtonTcpChecked(trasnsport != protocols::openvpn::defaultTransportProto);
@ -80,12 +86,6 @@ void OpenVpnLogic::updateProtocolPage(const QJsonObject &openvpnConfig, DockerCo
toString(protocols::openvpn::defaultAdditionalServerConfig); toString(protocols::openvpn::defaultAdditionalServerConfig);
set_textAreaAdditionalServerConfig(additionalServerConfig); set_textAreaAdditionalServerConfig(additionalServerConfig);
if (container == DockerContainer::ShadowSocks) {
set_radioButtonUdpEnabled(false);
set_radioButtonTcpEnabled(false);
set_radioButtonTcpChecked(true);
}
set_lineEditPortText(openvpnConfig.value(config_key::port). set_lineEditPortText(openvpnConfig.value(config_key::port).
toString(protocols::openvpn::defaultPort)); toString(protocols::openvpn::defaultPort));

View file

@ -0,0 +1,57 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
Popup {
id: root
property string questionText
property string yesText: "yes"
property string noText: "no"
property var yesFunc
property var noFunc
anchors.centerIn: Overlay.overlay
modal: true
closePolicy: Popup.NoAutoClose
width: parent.width - 20
ColumnLayout {
width: parent.width
Text {
horizontalAlignment: Text.AlignHCenter
Layout.fillWidth: true
wrapMode: Text.WordWrap
font.pixelSize: 16
text: questionText
}
RowLayout {
BlueButtonType {
id: yesButton
Layout.preferredWidth: parent.width / 2
Layout.fillWidth: true
text: yesText
onClicked: {
root.enabled = false
if (yesFunc && typeof yesFunc === "function") {
yesFunc()
}
root.enabled = true
}
}
BlueButtonType {
id: noButton
Layout.preferredWidth: parent.width / 2
Layout.fillWidth: true
text: noText
onClicked: {
if (noFunc && typeof noFunc === "function") {
noFunc()
}
}
}
}
}
}

View file

@ -63,7 +63,7 @@ PageBase {
pageLoader.focus = true pageLoader.focus = true
} }
onContainerSelected: { onContainerSelected: function(c_index){
var containerProto = ContainerProps.defaultProtocol(c_index) var containerProto = ContainerProps.defaultProtocol(c_index)
tf_port_num.text = ProtocolProps.defaultPort(containerProto) tf_port_num.text = ProtocolProps.defaultPort(containerProto)

View file

@ -55,7 +55,6 @@ PageBase {
tf_port_num.text = qsTr("Default") tf_port_num.text = qsTr("Default")
} }
else tf_port_num.text = ProtocolProps.defaultPort(containerProto) else tf_port_num.text = ProtocolProps.defaultPort(containerProto)
cb_port_proto.currentIndex = ProtocolProps.defaultTransportProto(containerProto) cb_port_proto.currentIndex = ProtocolProps.defaultTransportProto(containerProto)
tf_port_num.enabled = ProtocolProps.defaultPortChangeable(containerProto) tf_port_num.enabled = ProtocolProps.defaultPortChangeable(containerProto)
@ -297,23 +296,24 @@ PageBase {
implicitHeight: 30 implicitHeight: 30
checked: default_role checked: default_role
onClicked: popupRemove.open()
MessageDialog {
id: dialogRemove
buttons: StandardButton.Yes | StandardButton.Cancel
title: "AmneziaVPN"
text: qsTr("Remove container") + " " + name_role + "?" + "\n" + qsTr("This action will erase all data of this container on the server.")
onAccepted: {
tb_c.currentIndex = -1
ServerContainersLogic.onPushButtonRemoveClicked(proxyContainersModel.mapToSource(index))
}
}
onClicked: dialogRemove.open()
VisibleBehavior on visible { } VisibleBehavior on visible { }
} }
PopupWithQuestion {
id: popupRemove
questionText: qsTr("Remove container") + " " + name_role + "?" + "\n" + qsTr("This action will erase all data of this container on the server.")
yesFunc: function() {
tb_c.currentIndex = -1
ServerContainersLogic.onPushButtonRemoveClicked(proxyContainersModel.mapToSource(index))
close()
}
noFunc: function() {
close()
}
}
ImageButtonType { ImageButtonType {
id: button_share id: button_share
visible: (index === tb_c.currentIndex) && ServerContainersLogic.isManagedServer visible: (index === tb_c.currentIndex) && ServerContainersLogic.isManagedServer
@ -418,7 +418,7 @@ PageBase {
BlueButtonType { BlueButtonType {
id: pb_add_container id: pb_add_container
visible: container_selector.selectedIndex < 0 visible: container_selector.selectedIndex < 0 && ServerContainersLogic.isManagedServer
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
@ -430,6 +430,5 @@ PageBase {
text: qsTr("Install new service") text: qsTr("Install new service")
font.pixelSize: 16 font.pixelSize: 16
onClicked: container_selector.visible ? container_selector.close() : container_selector.open() onClicked: container_selector.visible ? container_selector.close() : container_selector.open()
} }
} }

View file

@ -93,24 +93,49 @@ PageBase {
ServerSettingsLogic.onPushButtonClearClientCacheClicked() ServerSettingsLogic.onPushButtonClearClientCacheClicked()
} }
} }
BlueButtonType { BlueButtonType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 10 Layout.topMargin: 10
text: ServerSettingsLogic.pushButtonClearText text: ServerSettingsLogic.pushButtonClearText
visible: ServerSettingsLogic.pushButtonClearVisible visible: ServerSettingsLogic.pushButtonClearVisible
onClicked: { onClicked: {
ServerSettingsLogic.onPushButtonClearServer() popupClearServer.open()
} }
} }
PopupWithQuestion {
id: popupClearServer
questionText: "Attention! All containers will be deleted on the server. This means that configuration files, keys and certificates will be deleted. Continue?"
yesFunc: function() {
ServerSettingsLogic.onPushButtonClearServer()
close()
}
noFunc: function() {
close()
}
}
BlueButtonType { BlueButtonType {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 10 Layout.topMargin: 10
text: qsTr("Forget this server") text: qsTr("Forget this server")
onClicked: { onClicked: {
ServerSettingsLogic.onPushButtonForgetServer() popupForgetServer.open()
} }
} }
PopupWithQuestion {
id: popupForgetServer
questionText: "Attention! This action will not remove the container on the server, it will only remove the container information from the application. Continue?"
yesFunc: function() {
ServerSettingsLogic.onPushButtonForgetServer()
close()
}
noFunc: function() {
close()
}
}
} }
} }

View file

@ -11,10 +11,9 @@ PageProtocolBase {
protocol: ProtocolEnum.Cloak protocol: ProtocolEnum.Cloak
logic: UiLogic.protocolLogic(protocol) logic: UiLogic.protocolLogic(protocol)
enabled: logic.pageEnabled
BackButton { BackButton {
id: back id: back
enabled: logic.pageEnabled enabled: !logic.pushButtonCancelVisible
} }
Caption { Caption {

View file

@ -13,7 +13,7 @@ PageProtocolBase {
BackButton { BackButton {
id: back id: back
enabled: logic.pageEnabled enabled: !logic.pushButtonCancelVisible
} }
Caption { Caption {
@ -285,8 +285,6 @@ PageProtocolBase {
} }
} }
} }
} }
BasicButtonType { BasicButtonType {
@ -338,8 +336,6 @@ PageProtocolBase {
} }
} }
} }
} }
LabelType { LabelType {

View file

@ -13,7 +13,7 @@ PageProtocolBase {
BackButton { BackButton {
id: back id: back
enabled: logic.pageEnabled enabled: !logic.pushButtonCancelVisible
} }
Caption { Caption {

View file

@ -232,18 +232,6 @@ Window {
} }
} }
MessageDialog {
id: closePrompt
// x: (root.width - width) / 2
// y: (root.height - height) / 2
title: qsTr("Exit")
text: qsTr("Do you really want to quit?")
// standardButtons: StandardButton.Yes | StandardButton.No
// onYesClicked: {
// Qt.quit()
// }
visible: false
}
MessageDialog { MessageDialog {
id: publicKeyWarning id: publicKeyWarning
title: "AmneziaVPN" title: "AmneziaVPN"

View file

@ -26,7 +26,7 @@ function appInstalled()
} else if (runningOnMacOS()){ } else if (runningOnMacOS()){
appInstalledUninstallerPath = "/Applications/" + appName() + ".app/maintenancetool.app/Contents/MacOS/maintenancetool"; appInstalledUninstallerPath = "/Applications/" + appName() + ".app/maintenancetool.app/Contents/MacOS/maintenancetool";
} else if (runningOnLinux()){ } else if (runningOnLinux()){
allInstalledUninstallerPath = "/opt/" + appName(); appInstalledUninstallerPath = "/opt/" + appName() + "/maintenancetool";
} }
return installer.fileExists(appInstalledUninstallerPath) || installer.fileExists(appInstalledUninstallerPath_x86); return installer.fileExists(appInstalledUninstallerPath) || installer.fileExists(appInstalledUninstallerPath_x86);
@ -49,7 +49,7 @@ function runningOnMacOS()
function runningOnLinux() function runningOnLinux()
{ {
return (installer.value("os") === "linux"); return ((installer.value("os") === "linux") || (installer.value("os") === "x11"));
} }
function sleep(miliseconds) { function sleep(miliseconds) {

View file

@ -93,7 +93,7 @@ Component.prototype.createOperations = function()
} else if (runningOnMacOS()) { } else if (runningOnMacOS()) {
component.addElevatedOperation("Execute", "@TargetDir@/post_install.sh", "UNDOEXECUTE", "@TargetDir@/post_uninstall.sh"); component.addElevatedOperation("Execute", "@TargetDir@/post_install.sh", "UNDOEXECUTE", "@TargetDir@/post_uninstall.sh");
} else if (runningOnLinux()) { } else if (runningOnLinux()) {
component.addElevatedOperation("Execute", "bash", "@TargetDir@/post_install.sh", "UNDOEXECUTE", "bash", "@TargetDir@/post_uninstall.sh"); component.addElevatedOperation("Execute", "bash", "@TargetDir@/post_install.sh", "UNDOEXECUTE", "bash", "@TargetDir@/post_uninstall.sh");
} }
} }