Skip to content

Commit

Permalink
win7 support fixes
Browse files Browse the repository at this point in the history
wizard added
  • Loading branch information
pokamest committed May 18, 2021
1 parent 45e5ec7 commit 4ba964d
Show file tree
Hide file tree
Showing 16 changed files with 2,053 additions and 477 deletions.
14 changes: 13 additions & 1 deletion client/configurators/openvpn_configurator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,14 @@ QString OpenVpnConfigurator::genOpenVpnConfig(const ServerCredentials &credentia
config.replace("$OPENVPN_CA_CERT", connData.caCert);
config.replace("$OPENVPN_CLIENT_CERT", connData.clientCert);
config.replace("$OPENVPN_PRIV_KEY", connData.privKey);
config.replace("$OPENVPN_TA_KEY", connData.taKey);

if (config.contains("$OPENVPN_TA_KEY")) {
config.replace("$OPENVPN_TA_KEY", connData.taKey);
}
else {
config.replace("<tls-auth>", "");
config.replace("</tls-auth>", "");
}

#ifdef Q_OS_MAC
config.replace("block-outside-dns", "");
Expand All @@ -222,6 +229,11 @@ QString OpenVpnConfigurator::processConfigWithLocalSettings(QString config)
if (m_settings().customRouting()) {
config.replace("redirect-gateway def1 bypass-dhcp", "");
}
else {
if(!config.contains("redirect-gateway def1 bypass-dhcp")) {
config.append("redirect-gateway def1 bypass-dhcp\n");
}
}

#ifdef Q_OS_MAC
config.replace("block-outside-dns", "");
Expand Down
10 changes: 9 additions & 1 deletion client/core/servercontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ ErrorCode ServerController::startupContainerWorker(const ServerCredentials &cred
genVarsForScript(credentials, container, config)));
}

ServerController::Vars ServerController::genVarsForScript(const ServerCredentials &credentials, DockerContainer container, const QJsonObject &config)
ServerController::Vars ServerController:: genVarsForScript(const ServerCredentials &credentials, DockerContainer container, const QJsonObject &config)
{
const QJsonObject &openvpnConfig = config.value(config_key::openvpn).toObject();
const QJsonObject &cloakConfig = config.value(config_key::cloak).toObject();
Expand All @@ -529,9 +529,17 @@ ServerController::Vars ServerController::genVarsForScript(const ServerCredential

bool isNcpDisabled = openvpnConfig.value(config_key::ncp_disable).toBool(amnezia::protocols::openvpn::defaultNcpDisable);
vars.append({{"$OPENVPN_NCP_DISABLE", isNcpDisabled ? protocols::openvpn::ncpDisableString : "" }});

vars.append({{"$OPENVPN_CIPHER", openvpnConfig.value(config_key::cipher).toString(amnezia::protocols::openvpn::defaultCipher) }});
vars.append({{"$OPENVPN_HASH", openvpnConfig.value(config_key::hash).toString(amnezia::protocols::openvpn::defaultHash) }});

bool isTlsAuth = openvpnConfig.value(config_key::tls_auth).toBool(amnezia::protocols::openvpn::defaultTlsAuth);
vars.append({{"$OPENVPN_TLS_AUTH", isTlsAuth ? protocols::openvpn::tlsAuthString : "" }});
if (!isTlsAuth) {
// erase $OPENVPN_TA_KEY, so it will not set in OpenVpnConfigurator::genOpenVpnConfig
vars.append({{"$OPENVPN_TA_KEY", "" }});
}

// ShadowSocks vars
vars.append({{"$SHADOWSOCKS_SERVER_PORT", ssConfig.value(config_key::port).toString(amnezia::protocols::shadowsocks::defaultPort) }});
vars.append({{"$SHADOWSOCKS_LOCAL_PORT", ssConfig.value(config_key::local_port).toString(amnezia::protocols::shadowsocks::defaultLocalProxyPort) }});
Expand Down
Binary file modified client/images/plus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions client/protocols/protocols_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ constexpr char transport_proto[] = "transport_proto";
constexpr char cipher[] = "cipher";
constexpr char hash[] = "hash";
constexpr char ncp_disable[] = "ncp_disable";
constexpr char tls_auth[] = "tls_auth";

constexpr char site[] = "site";
constexpr char block_outside_dns[] = "block_outside_dns";
Expand Down Expand Up @@ -72,7 +73,9 @@ constexpr char defaultCipher[] = "AES-256-GCM";
constexpr char defaultHash[] = "SHA512";
constexpr bool defaultBlockOutsideDns = true;
constexpr bool defaultNcpDisable = false;
constexpr bool defaultTlsAuth = true;
constexpr char ncpDisableString[] = "ncp-disable";
constexpr char tlsAuthString[] = "tls-auth /opt/amnezia/openvpn/ta.key 0";

}

Expand Down
2 changes: 1 addition & 1 deletion client/server_scripts/openvpn/configure_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ status openvpn-status.log \\n\
verb 1 \\n\
tls-server \\n\
tls-version-min 1.2 \\n\
tls-auth /opt/amnezia/openvpn/ta.key 0" >>/opt/amnezia/openvpn/server.conf'
$OPENVPN_TLS_AUTH" >/opt/amnezia/openvpn/server.conf'

2 changes: 1 addition & 1 deletion client/server_scripts/openvpn_cloak/configure_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ status openvpn-status.log \\n\
verb 1 \\n\
tls-server \\n\
tls-version-min 1.2 \\n\
tls-auth /opt/amnezia/openvpn/ta.key 0" >>/opt/amnezia/openvpn/server.conf'
$OPENVPN_TLS_AUTH" >/opt/amnezia/openvpn/server.conf'

# Cloak config
sudo docker exec -i $CONTAINER_NAME bash -c '\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ status openvpn-status.log \\n\
verb 1 \\n\
tls-server \\n\
tls-version-min 1.2 \\n\
tls-auth /opt/amnezia/openvpn/ta.key 0" >>/opt/amnezia/openvpn/server.conf'
$OPENVPN_TLS_AUTH" >/opt/amnezia/openvpn/server.conf'

# Cloak config
sudo docker exec -i $CONTAINER_NAME bash -c '\
Expand Down
Binary file modified client/translations/amneziavpn_ru.qm
Binary file not shown.
Loading

0 comments on commit 4ba964d

Please sign in to comment.