Ssh key auth support added
yum/apt install support
This commit is contained in:
parent
a2bb382652
commit
ca898a6759
40 changed files with 222 additions and 77 deletions
|
@ -823,11 +823,13 @@ void SshConnectionPrivate::createPrivateKey()
|
|||
if (m_connParams.privateKeyFile.isEmpty())
|
||||
throw SshClientException(SshKeyFileError, tr("No private key file given."));
|
||||
QFile keyFile(m_connParams.privateKeyFile);
|
||||
if (!keyFile.open(QIODevice::ReadOnly)) {
|
||||
throw SshClientException(SshKeyFileError,
|
||||
tr("Private key file error: %1").arg(keyFile.errorString()));
|
||||
|
||||
if (keyFile.open(QIODevice::ReadOnly)) {
|
||||
m_sendFacility.createAuthenticationKey(keyFile.readAll());
|
||||
}
|
||||
else {
|
||||
m_sendFacility.createAuthenticationKey(m_connParams.privateKeyFile.toUtf8());
|
||||
}
|
||||
m_sendFacility.createAuthenticationKey(keyFile.readAll());
|
||||
}
|
||||
|
||||
QSharedPointer<SshRemoteProcess> SshConnectionPrivate::createRemoteProcess(const QByteArray &command)
|
||||
|
|
|
@ -24,6 +24,8 @@ struct ServerCredentials
|
|||
QString userName;
|
||||
QString password;
|
||||
int port = 22;
|
||||
|
||||
bool isValid() { return !hostName.isEmpty() && !userName.isEmpty() && !password.isEmpty() && port > 0; }
|
||||
};
|
||||
|
||||
enum ErrorCode
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <QRandomGenerator>
|
||||
#include <QTemporaryDir>
|
||||
#include <QDebug>
|
||||
#include <QTemporaryFile>
|
||||
|
||||
QString OpenVpnConfigurator::getRandomString(int len)
|
||||
{
|
||||
|
@ -48,9 +49,8 @@ QProcessEnvironment OpenVpnConfigurator::prepareEnv()
|
|||
|
||||
#ifdef Q_OS_WIN
|
||||
pathEnvVar.clear();
|
||||
pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "\\easyrsa\\bin;");
|
||||
pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "\\cygwin;");
|
||||
pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "\\openvpn\\i386;");
|
||||
pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "\\openvpn\\x64;");
|
||||
#else
|
||||
pathEnvVar.prepend(QDir::toNativeSeparators(QApplication::applicationDirPath()) + "/Contents/MacOS");
|
||||
#endif
|
||||
|
@ -253,3 +253,35 @@ QString OpenVpnConfigurator::genOpenVpnConfig(const ServerCredentials &credentia
|
|||
//qDebug().noquote() << config;
|
||||
return config;
|
||||
}
|
||||
|
||||
QString OpenVpnConfigurator::convertOpenSShKey(const QString &key)
|
||||
{
|
||||
QProcess p;
|
||||
p.setProcessChannelMode(QProcess::MergedChannels);
|
||||
|
||||
QTemporaryFile tmp;
|
||||
tmp.setAutoRemove(false);
|
||||
tmp.open();
|
||||
tmp.write(key.toUtf8());
|
||||
tmp.close();
|
||||
|
||||
// ssh-keygen -p -P "" -N "" -m pem -f id_ssh
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
p.setProcessEnvironment(prepareEnv());
|
||||
p.setProgram("cmd.exe");
|
||||
p.setNativeArguments(QString("/C \"ssh-keygen.exe -p -P \"\" -N \"\" -m pem -f \"%1\"\"").arg(tmp.fileName()));
|
||||
#else
|
||||
p.setProgram("ssh-keygen");
|
||||
p.setArguments(QStringList() << "-p" << "-P" << "\"\"" << "-N" << "\"\"" << "-m" << "pem" << "-f" << tmp.fileName());
|
||||
#endif
|
||||
|
||||
p.start();
|
||||
p.waitForFinished();
|
||||
|
||||
qDebug().noquote() << "OpenVpnConfigurator::convertOpenSShKey" << p.exitCode() << p.exitStatus() << p.readAll();
|
||||
|
||||
tmp.open();
|
||||
|
||||
return tmp.readAll();
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@ public:
|
|||
static QString genOpenVpnConfig(const ServerCredentials &credentials, Protocol proto,
|
||||
ErrorCode *errorCode = nullptr);
|
||||
|
||||
static QString convertOpenSShKey(const QString &key);
|
||||
|
||||
private:
|
||||
static QString getRandomString(int len);
|
||||
static QString getEasyRsaShPath();
|
||||
|
|
|
@ -29,8 +29,6 @@ ErrorCode ServerController::runScript(DockerContainer container,
|
|||
const std::function<void(const QString &, QSharedPointer<SshRemoteProcess>)> &cbReadStdOut,
|
||||
const std::function<void(const QString &, QSharedPointer<SshRemoteProcess>)> &cbReadStdErr)
|
||||
{
|
||||
QLoggingCategory::setFilterRules(QStringLiteral("qtc.ssh=false"));
|
||||
|
||||
SshConnection *client = connectToHost(sshParams);
|
||||
if (client->state() != SshConnection::State::Connected) {
|
||||
return fromSshConnectionErrorCode(client->errorState());
|
||||
|
@ -103,9 +101,7 @@ ErrorCode ServerController::runScript(DockerContainer container,
|
|||
ErrorCode ServerController::uploadTextFileToContainer(DockerContainer container,
|
||||
const ServerCredentials &credentials, QString &file, const QString &path)
|
||||
{
|
||||
QLoggingCategory::setFilterRules(QStringLiteral("qtc.ssh=false"));
|
||||
|
||||
QString script = QString("docker exec -i %1 sh -c \"echo \'%2\' > %3\"").
|
||||
QString script = QString("sudo docker exec -i %1 sh -c \"echo \'%2\' > %3\"").
|
||||
arg(getContainerName(container)).arg(file).arg(path);
|
||||
|
||||
// qDebug().noquote() << "uploadTextFileToContainer\n" << script;
|
||||
|
@ -155,7 +151,7 @@ ErrorCode ServerController::uploadTextFileToContainer(DockerContainer container,
|
|||
QString ServerController::getTextFileFromContainer(DockerContainer container,
|
||||
const ServerCredentials &credentials, const QString &path, ErrorCode *errorCode)
|
||||
{
|
||||
QString script = QString("docker exec -i %1 sh -c \"cat \'%2\'\"").
|
||||
QString script = QString("sudo docker exec -i %1 sh -c \"cat \'%2\'\"").
|
||||
arg(getContainerName(container)).arg(path);
|
||||
|
||||
qDebug().noquote() << "Copy file from container\n" << script;
|
||||
|
@ -203,11 +199,11 @@ QString ServerController::getTextFileFromContainer(DockerContainer container,
|
|||
ErrorCode ServerController::signCert(DockerContainer container,
|
||||
const ServerCredentials &credentials, QString clientId)
|
||||
{
|
||||
QString script_import = QString("docker exec -i %1 bash -c \"cd /opt/amneziavpn_data && "
|
||||
QString script_import = QString("sudo docker exec -i %1 bash -c \"cd /opt/amneziavpn_data && "
|
||||
"easyrsa import-req /opt/amneziavpn_data/clients/%2.req %2\"")
|
||||
.arg(getContainerName(container)).arg(clientId);
|
||||
|
||||
QString script_sign = QString("docker exec -i %1 bash -c \"export EASYRSA_BATCH=1; cd /opt/amneziavpn_data && "
|
||||
QString script_sign = QString("sudo docker exec -i %1 bash -c \"export EASYRSA_BATCH=1; cd /opt/amneziavpn_data && "
|
||||
"easyrsa sign-req client %2\"")
|
||||
.arg(getContainerName(container)).arg(clientId);
|
||||
|
||||
|
@ -261,10 +257,16 @@ ErrorCode ServerController::fromSshProcessExitStatus(int exitStatus)
|
|||
SshConnectionParameters ServerController::sshParams(const ServerCredentials &credentials)
|
||||
{
|
||||
QSsh::SshConnectionParameters sshParams;
|
||||
sshParams.authenticationType = QSsh::SshConnectionParameters::AuthenticationTypePassword;
|
||||
if (credentials.password.contains("BEGIN") && credentials.password.contains("PRIVATE KEY")) {
|
||||
sshParams.authenticationType = QSsh::SshConnectionParameters::AuthenticationTypePublicKey;
|
||||
sshParams.privateKeyFile = credentials.password;
|
||||
}
|
||||
else {
|
||||
sshParams.authenticationType = QSsh::SshConnectionParameters::AuthenticationTypePassword;
|
||||
sshParams.password = credentials.password;
|
||||
}
|
||||
sshParams.host = credentials.hostName;
|
||||
sshParams.userName = credentials.userName;
|
||||
sshParams.password = credentials.password;
|
||||
sshParams.timeout = 10;
|
||||
sshParams.port = credentials.port;
|
||||
sshParams.hostKeyCheckingMode = QSsh::SshHostKeyCheckingMode::SshHostKeyCheckingNone;
|
||||
|
@ -403,7 +405,7 @@ ErrorCode ServerController::setupShadowSocksServer(const ServerCredentials &cred
|
|||
uploadTextFileToContainer(DockerContainer::ShadowSocks, credentials, configData, sSConfigPath);
|
||||
|
||||
// Start ss
|
||||
QString script = QString("docker exec -d %1 sh -c \"ss-server -c %2\"").
|
||||
QString script = QString("sudo docker exec -d %1 sh -c \"ss-server -c %2\"").
|
||||
arg(getContainerName(DockerContainer::ShadowSocks)).arg(sSConfigPath);
|
||||
|
||||
e = runScript(DockerContainer::ShadowSocks, sshParams(credentials), script);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <QMessageBox>
|
||||
#include <QTranslator>
|
||||
#include <QTimer>
|
||||
#include <QLoggingCategory>
|
||||
|
||||
#include "debug.h"
|
||||
#include "defines.h"
|
||||
|
@ -25,6 +26,8 @@ static void loadTranslator()
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QLoggingCategory::setFilterRules(QStringLiteral("qtc.ssh=false"));
|
||||
|
||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
|
|
|
@ -1,25 +1,26 @@
|
|||
# CONTAINER_NAME=... this var will be set in ServerController
|
||||
# Don't run commands in background like sh -c "openvpn &"
|
||||
|
||||
apt-get update
|
||||
pm_apt="/usr/bin/apt-get"; pm_yum="/usr/bin/yum"; if [[ -f "$pm_apt" ]]; then pm=$pm_apt; else pm=$pm_yum; fi; if [[ -f "/usr/bin/sudo" ]]; then $pm install -y sudo; fi
|
||||
sudo iptables -P FORWARD ACCEPT
|
||||
|
||||
iptables -P FORWARD ACCEPT
|
||||
pm_apt="/usr/bin/apt-get"; pm_yum="/usr/bin/yum"; if [[ -f "$pm_apt" ]]; then pm=$pm_apt; else pm=$pm_yum; fi; sudo $pm update -y
|
||||
pm_apt="/usr/bin/apt-get"; pm_yum="/usr/bin/yum"; if [[ -f "$pm_apt" ]]; then pm=$pm_apt; else pm=$pm_yum; fi; sudo $pm install -y curl
|
||||
pm_apt="/usr/bin/apt-get"; pm_yum="/usr/bin/yum"; if [[ -f "$pm_apt" ]]; then sudo $pm_apt install -y docker.io; else sudo $pm_yum install -y docker; fi
|
||||
sudo systemctl start docker
|
||||
|
||||
apt install -y docker.io curl
|
||||
systemctl start docker
|
||||
|
||||
docker stop $CONTAINER_NAME
|
||||
docker rm -f $CONTAINER_NAME
|
||||
docker pull amneziavpn/openvpn:latest
|
||||
docker run -d --restart always --cap-add=NET_ADMIN -p 1194:1194/udp --name $CONTAINER_NAME amneziavpn/openvpn:latest
|
||||
sudo docker stop $CONTAINER_NAME
|
||||
sudo docker rm -f $CONTAINER_NAME
|
||||
sudo docker pull amneziavpn/openvpn:latest
|
||||
sudo docker run -d --restart always --cap-add=NET_ADMIN -p 1194:1194/udp --name $CONTAINER_NAME amneziavpn/openvpn:latest
|
||||
|
||||
|
||||
docker exec -i $CONTAINER_NAME sh -c "mkdir -p /opt/amneziavpn_data/clients"
|
||||
docker exec -i $CONTAINER_NAME sh -c "cd /opt/amneziavpn_data && easyrsa init-pki"
|
||||
docker exec -i $CONTAINER_NAME sh -c "cd /opt/amneziavpn_data && easyrsa gen-dh"
|
||||
sudo docker exec -i $CONTAINER_NAME sh -c "mkdir -p /opt/amneziavpn_data/clients"
|
||||
sudo docker exec -i $CONTAINER_NAME sh -c "cd /opt/amneziavpn_data && easyrsa init-pki"
|
||||
sudo docker exec -i $CONTAINER_NAME sh -c "cd /opt/amneziavpn_data && easyrsa gen-dh"
|
||||
|
||||
docker exec -i $CONTAINER_NAME sh -c "cd /opt/amneziavpn_data && cp pki/dh.pem /etc/openvpn && easyrsa build-ca nopass << EOF yes EOF && easyrsa gen-req MyReq nopass << EOF2 yes EOF2"
|
||||
docker exec -i $CONTAINER_NAME sh -c "cd /opt/amneziavpn_data && easyrsa sign-req server MyReq << EOF3 yes EOF3"
|
||||
docker exec -i $CONTAINER_NAME sh -c "cd /opt/amneziavpn_data && openvpn --genkey --secret ta.key << EOF4"
|
||||
docker exec -i $CONTAINER_NAME sh -c "cd /opt/amneziavpn_data && cp pki/ca.crt pki/issued/MyReq.crt pki/private/MyReq.key ta.key /etc/openvpn"
|
||||
docker exec -d $CONTAINER_NAME sh -c "openvpn --config /etc/openvpn/server.conf"
|
||||
sudo docker exec -i $CONTAINER_NAME sh -c "cd /opt/amneziavpn_data && cp pki/dh.pem /etc/openvpn && easyrsa build-ca nopass << EOF yes EOF && easyrsa gen-req MyReq nopass << EOF2 yes EOF2"
|
||||
sudo docker exec -i $CONTAINER_NAME sh -c "cd /opt/amneziavpn_data && easyrsa sign-req server MyReq << EOF3 yes EOF3"
|
||||
sudo docker exec -i $CONTAINER_NAME sh -c "cd /opt/amneziavpn_data && openvpn --genkey --secret ta.key << EOF4"
|
||||
sudo docker exec -i $CONTAINER_NAME sh -c "cd /opt/amneziavpn_data && cp pki/ca.crt pki/issued/MyReq.crt pki/private/MyReq.key ta.key /etc/openvpn"
|
||||
sudo docker exec -d $CONTAINER_NAME sh -c "openvpn --config /etc/openvpn/server.conf"
|
||||
|
|
|
@ -1,25 +1,26 @@
|
|||
# CONTAINER_NAME=... this var will be set in ServerController
|
||||
# Don't run commands in background like sh -c "openvpn &"
|
||||
|
||||
apt-get update
|
||||
pm_apt="/usr/bin/apt-get"; pm_yum="/usr/bin/yum"; if [[ -f "$pm_apt" ]]; then pm=$pm_apt; else pm=$pm_yum; fi; if [[ -f "/usr/bin/sudo" ]]; then $pm install -y sudo; fi
|
||||
sudo iptables -P FORWARD ACCEPT
|
||||
|
||||
iptables -P FORWARD ACCEPT
|
||||
pm_apt="/usr/bin/apt-get"; pm_yum="/usr/bin/yum"; if [[ -f "$pm_apt" ]]; then pm=$pm_apt; else pm=$pm_yum; fi; sudo $pm update -y
|
||||
pm_apt="/usr/bin/apt-get"; pm_yum="/usr/bin/yum"; if [[ -f "$pm_apt" ]]; then pm=$pm_apt; else pm=$pm_yum; fi; sudo $pm install -y curl
|
||||
pm_apt="/usr/bin/apt-get"; pm_yum="/usr/bin/yum"; if [[ -f "$pm_apt" ]]; then sudo $pm_apt install -y docker.io; else sudo $pm_yum install -y docker; fi
|
||||
sudo systemctl start docker
|
||||
|
||||
apt install -y docker.io curl
|
||||
systemctl start docker
|
||||
|
||||
docker stop $CONTAINER_NAME
|
||||
docker rm -f $CONTAINER_NAME
|
||||
docker pull amneziavpn/shadowsocks:latest
|
||||
docker run -d --restart always --cap-add=NET_ADMIN -p 1194:1194/tcp -p 6789:6789/tcp --name $CONTAINER_NAME amneziavpn/shadowsocks:latest
|
||||
sudo docker stop $CONTAINER_NAME
|
||||
sudo docker rm -f $CONTAINER_NAME
|
||||
sudo docker pull amneziavpn/shadowsocks:latest
|
||||
sudo docker run -d --restart always --cap-add=NET_ADMIN -p 1194:1194/tcp -p 6789:6789/tcp --name $CONTAINER_NAME amneziavpn/shadowsocks:latest
|
||||
|
||||
|
||||
docker exec -i $CONTAINER_NAME sh -c "mkdir -p /opt/amneziavpn_data/clients"
|
||||
docker exec -i $CONTAINER_NAME sh -c "cd /opt/amneziavpn_data && easyrsa init-pki"
|
||||
docker exec -i $CONTAINER_NAME sh -c "cd /opt/amneziavpn_data && easyrsa gen-dh"
|
||||
sudo docker exec -i $CONTAINER_NAME sh -c "mkdir -p /opt/amneziavpn_data/clients"
|
||||
sudo docker exec -i $CONTAINER_NAME sh -c "cd /opt/amneziavpn_data && easyrsa init-pki"
|
||||
sudo docker exec -i $CONTAINER_NAME sh -c "cd /opt/amneziavpn_data && easyrsa gen-dh"
|
||||
|
||||
docker exec -i $CONTAINER_NAME sh -c "cd /opt/amneziavpn_data && cp pki/dh.pem /etc/openvpn && easyrsa build-ca nopass << EOF yes EOF && easyrsa gen-req MyReq nopass << EOF2 yes EOF2"
|
||||
docker exec -i $CONTAINER_NAME sh -c "cd /opt/amneziavpn_data && easyrsa sign-req server MyReq << EOF3 yes EOF3"
|
||||
docker exec -i $CONTAINER_NAME sh -c "cd /opt/amneziavpn_data && openvpn --genkey --secret ta.key << EOF4"
|
||||
docker exec -i $CONTAINER_NAME sh -c "cd /opt/amneziavpn_data && cp pki/ca.crt pki/issued/MyReq.crt pki/private/MyReq.key ta.key /etc/openvpn"
|
||||
docker exec -d $CONTAINER_NAME sh -c "openvpn --config /etc/openvpn/server.conf"
|
||||
sudo docker exec -i $CONTAINER_NAME sh -c "cd /opt/amneziavpn_data && cp pki/dh.pem /etc/openvpn && easyrsa build-ca nopass << EOF yes EOF && easyrsa gen-req MyReq nopass << EOF2 yes EOF2"
|
||||
sudo docker exec -i $CONTAINER_NAME sh -c "cd /opt/amneziavpn_data && easyrsa sign-req server MyReq << EOF3 yes EOF3"
|
||||
sudo docker exec -i $CONTAINER_NAME sh -c "cd /opt/amneziavpn_data && openvpn --genkey --secret ta.key << EOF4"
|
||||
sudo docker exec -i $CONTAINER_NAME sh -c "cd /opt/amneziavpn_data && cp pki/ca.crt pki/issued/MyReq.crt pki/private/MyReq.key ta.key /etc/openvpn"
|
||||
sudo docker exec -d $CONTAINER_NAME sh -c "openvpn --config /etc/openvpn/server.conf"
|
||||
|
|
|
@ -38,6 +38,10 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
m_vpnConnection(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
setupTray();
|
||||
setupUiConnections();
|
||||
|
||||
ui->label_error_text->clear();
|
||||
ui->widget_tittlebar->installEventFilter(this);
|
||||
|
||||
|
@ -68,9 +72,6 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
goToPage(Page::Start, true, false);
|
||||
}
|
||||
|
||||
setupTray();
|
||||
setupUiConnections();
|
||||
|
||||
connect(ui->lineEdit_sites_add_custom, &QLineEdit::returnPressed, [&](){
|
||||
ui->pushButton_sites_add_custom->click();
|
||||
});
|
||||
|
@ -147,6 +148,7 @@ void MainWindow::goToPage(Page page, bool reset, bool slide)
|
|||
.arg(m_settings.serverPort()));
|
||||
}
|
||||
|
||||
ui->pushButton_new_server_connect_key->setChecked(false);
|
||||
}
|
||||
|
||||
if (slide)
|
||||
|
@ -241,12 +243,25 @@ void MainWindow::hideEvent(QHideEvent *event)
|
|||
|
||||
void MainWindow::onPushButtonNewServerConnectWithNewData(bool)
|
||||
{
|
||||
if (ui->lineEdit_new_server_ip->text().isEmpty() ||
|
||||
ui->lineEdit_new_server_login->text().isEmpty() ||
|
||||
ui->lineEdit_new_server_password->text().isEmpty() ) {
|
||||
QMessageBox::warning(this, APPLICATION_NAME, tr("Please fill in all fields"));
|
||||
return;
|
||||
if (ui->pushButton_new_server_connect_key->isChecked()){
|
||||
if (ui->lineEdit_new_server_ip->text().isEmpty() ||
|
||||
ui->lineEdit_new_server_login->text().isEmpty() ||
|
||||
ui->textEdit_new_server_ssh_key->toPlainText().isEmpty() ) {
|
||||
|
||||
ui->label_new_server_wait_info->setText(tr("Please fill in all fields"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (ui->lineEdit_new_server_ip->text().isEmpty() ||
|
||||
ui->lineEdit_new_server_login->text().isEmpty() ||
|
||||
ui->lineEdit_new_server_password->text().isEmpty() ) {
|
||||
|
||||
ui->label_new_server_wait_info->setText(tr("Please fill in all fields"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
qDebug() << "Start connection with new data";
|
||||
|
||||
|
@ -257,7 +272,18 @@ void MainWindow::onPushButtonNewServerConnectWithNewData(bool)
|
|||
serverCredentials.hostName = serverCredentials.hostName.split(":").at(0);
|
||||
}
|
||||
serverCredentials.userName = ui->lineEdit_new_server_login->text();
|
||||
serverCredentials.password = ui->lineEdit_new_server_password->text();
|
||||
if (ui->pushButton_new_server_connect_key->isChecked()){
|
||||
QString key = ui->textEdit_new_server_ssh_key->toPlainText();
|
||||
if (key.contains("OPENSSH") && key.contains("BEGIN") && key.contains("PRIVATE KEY")) {
|
||||
key = OpenVpnConfigurator::convertOpenSShKey(key);
|
||||
}
|
||||
|
||||
serverCredentials.password = key;
|
||||
}
|
||||
else {
|
||||
serverCredentials.password = ui->lineEdit_new_server_password->text();
|
||||
}
|
||||
|
||||
|
||||
bool ok = installServer(serverCredentials,
|
||||
ui->page_new_server,
|
||||
|
@ -287,15 +313,20 @@ void MainWindow::onPushButtonNewServerConnectWithExistingCode(bool)
|
|||
credentials.userName = o.value("u").toString();
|
||||
credentials.password = o.value("w").toString();
|
||||
|
||||
m_settings.setServerCredentials(credentials);
|
||||
|
||||
goToPage(Page::Vpn);
|
||||
qDebug() << QString("Added server %3@%1:%2").
|
||||
arg(credentials.hostName).
|
||||
arg(credentials.port).
|
||||
arg(credentials.userName);
|
||||
|
||||
//qDebug() << QString("Password") << credentials.password;
|
||||
|
||||
if (!credentials.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_settings.setServerCredentials(credentials);
|
||||
|
||||
goToPage(Page::Vpn);
|
||||
}
|
||||
|
||||
bool MainWindow::installServer(ServerCredentials credentials,
|
||||
|
@ -613,6 +644,13 @@ void MainWindow::setupUiConnections()
|
|||
}
|
||||
});
|
||||
|
||||
connect(ui->pushButton_new_server_connect_key, &QPushButton::toggled, this, [this](bool checked){
|
||||
ui->label_new_server_password->setText(checked ? tr("Private key") : tr("Password"));
|
||||
ui->pushButton_new_server_connect_key->setText(checked ? tr("Connect using SSH password") : tr("Connect using SSH key"));
|
||||
ui->lineEdit_new_server_password->setVisible(!checked);
|
||||
ui->textEdit_new_server_ssh_key->setVisible(checked);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::setTrayState(VpnProtocol::ConnectionState state)
|
||||
|
|
|
@ -251,10 +251,12 @@ QPushButton:hover {
|
|||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
<string notr="true">QWidget {
|
||||
background: white;
|
||||
}</string>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>3</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_start">
|
||||
<widget class="QLabel" name="label_23">
|
||||
|
@ -473,7 +475,7 @@ color: #100A44;
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>170</y>
|
||||
<y>150</y>
|
||||
<width>171</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
|
@ -498,7 +500,7 @@ color: #333333;</string>
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>255</y>
|
||||
<y>235</y>
|
||||
<width>261</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
|
@ -519,11 +521,11 @@ color: #333333;</string>
|
|||
<string>Login to connect via SSH</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<widget class="QLabel" name="label_new_server_password">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>340</y>
|
||||
<y>320</y>
|
||||
<width>171</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
|
@ -548,7 +550,7 @@ color: #333333;</string>
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>200</y>
|
||||
<y>180</y>
|
||||
<width>300</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
|
@ -568,7 +570,7 @@ color: #333333;</string>
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>285</y>
|
||||
<y>265</y>
|
||||
<width>300</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
|
@ -588,7 +590,7 @@ color: #333333;</string>
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>370</y>
|
||||
<y>350</y>
|
||||
<width>300</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
|
@ -611,7 +613,7 @@ color: #333333;</string>
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>440</y>
|
||||
<y>450</y>
|
||||
<width>301</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
|
@ -672,7 +674,7 @@ color: #15CDCB;</string>
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>440</y>
|
||||
<y>450</y>
|
||||
<width>301</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
|
@ -767,7 +769,7 @@ QPushButton:hover {
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>490</y>
|
||||
<y>500</y>
|
||||
<width>301</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
|
@ -779,11 +781,68 @@ QPushButton:hover {
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_new_server_connect_key">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>550</y>
|
||||
<width>281</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font-family: Lato;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-size: 16px;
|
||||
line-height: 20px;
|
||||
text-align: center;
|
||||
|
||||
/* акцент */
|
||||
color: #15CDCB;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Connect using SSH key</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextEdit" name="textEdit_new_server_ssh_key">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>350</y>
|
||||
<width>300</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background: #F4F4F4;
|
||||
|
||||
/* grey */
|
||||
border: 1px solid #A7A7A7;
|
||||
color: #333333;</string>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Lato'; font-size:16px; font-weight:400; font-style:normal;">
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
<zorder>progressBar_new_server_connection</zorder>
|
||||
<zorder>label_2</zorder>
|
||||
<zorder>label_4</zorder>
|
||||
<zorder>label_5</zorder>
|
||||
<zorder>label_6</zorder>
|
||||
<zorder>label_new_server_password</zorder>
|
||||
<zorder>lineEdit_new_server_ip</zorder>
|
||||
<zorder>lineEdit_new_server_login</zorder>
|
||||
<zorder>lineEdit_new_server_password</zorder>
|
||||
|
@ -792,6 +851,8 @@ QPushButton:hover {
|
|||
<zorder>pushButton_back_from_new_server</zorder>
|
||||
<zorder>label_7</zorder>
|
||||
<zorder>label_new_server_wait_info</zorder>
|
||||
<zorder>pushButton_new_server_connect_key</zorder>
|
||||
<zorder>textEdit_new_server_ssh_key</zorder>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_vpn">
|
||||
<property name="styleSheet">
|
||||
|
@ -976,7 +1037,8 @@ background: #282932;
|
|||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">image: url(:/images/settings.png);</string>
|
||||
<string notr="true">image: url(:/images/settings.png);
|
||||
background: transparent</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
|
|
BIN
deploy/data/windows/cygwin/ssh-keygen.exe
Normal file
BIN
deploy/data/windows/cygwin/ssh-keygen.exe
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue