diff --git a/client/core/scripts_registry.cpp b/client/core/scripts_registry.cpp
index 9610f0a68..44f07e541 100644
--- a/client/core/scripts_registry.cpp
+++ b/client/core/scripts_registry.cpp
@@ -11,6 +11,7 @@ QString amnezia::scriptFolder(amnezia::DockerContainer container)
case DockerContainer::OpenVpnOverCloak: return QLatin1String("openvpn_cloak");
case DockerContainer::OpenVpnOverShadowSocks: return QLatin1String("openvpn_shadowsocks");
case DockerContainer::WireGuard: return QLatin1String("wireguard");
+ case DockerContainer::WebSiteInTor: return QLatin1String("website_tor");
default: return "";
}
}
diff --git a/client/protocols/protocols_defs.h b/client/protocols/protocols_defs.h
index e70dae0f3..cc97d8c1d 100644
--- a/client/protocols/protocols_defs.h
+++ b/client/protocols/protocols_defs.h
@@ -131,7 +131,8 @@ enum class DockerContainer {
OpenVpn,
OpenVpnOverShadowSocks,
OpenVpnOverCloak,
- WireGuard
+ WireGuard,
+ WebSiteInTor
};
DockerContainer containerFromString(const QString &container);
diff --git a/client/resources.qrc b/client/resources.qrc
index 3c2c26c20..c1f1c14b4 100644
--- a/client/resources.qrc
+++ b/client/resources.qrc
@@ -67,5 +67,7 @@
server_scripts/wireguard/run_container.sh
server_scripts/wireguard/start.sh
server_scripts/wireguard/template.conf
+ server_scripts/website_tor/configure_container.sh
+ server_scripts/website_tor/run_container.sh
diff --git a/client/server_scripts/website_tor/configure_container.sh b/client/server_scripts/website_tor/configure_container.sh
new file mode 100644
index 000000000..ecb72e6cb
--- /dev/null
+++ b/client/server_scripts/website_tor/configure_container.sh
@@ -0,0 +1,13 @@
+# Wireguard config
+sudo docker exec -i $CONTAINER_NAME bash -c '\
+mkdir -p /opt/amnezia/wireguard; \
+cd /opt/amnezia/wireguard || exit 1; \
+WIREGUARD_SERVER_PRIVATE_KEY=$(wg genkey) && echo $WIREGUARD_SERVER_PRIVATE_KEY > /opt/amnezia/wireguard/wireguard_server_private_key.key; \
+WIREGUARD_SERVER_PUBLIC_KEY=$(echo $WIREGUARD_SERVER_PRIVATE_KEY | wg pubkey) && echo $WIREGUARD_SERVER_PUBLIC_KEY > /opt/amnezia/wireguard/wireguard_server_public_key.key; \
+WIREGUARD_PSK=$(wg genpsk) && echo $WIREGUARD_PSK > /opt/amnezia/wireguard/wireguard_psk.key; \
+echo -e "\
+[Interface]\\n\
+PrivateKey = $WIREGUARD_SERVER_PRIVATE_KEY \\n\
+Address = $WIREGUARD_SUBNET_IP/$WIREGUARD_SUBNET_CIDR \\n\
+ListenPort = $WIREGUARD_SERVER_PORT \\n\
+" >/opt/amnezia/wireguard/wg0.conf'
diff --git a/client/server_scripts/website_tor/run_container.sh b/client/server_scripts/website_tor/run_container.sh
new file mode 100644
index 000000000..8be442ea9
--- /dev/null
+++ b/client/server_scripts/website_tor/run_container.sh
@@ -0,0 +1,3 @@
+# Run container
+sudo docker run -d -p 80:80 --restart always --name amnezia-wp-tor tutum/wordpress
+sudo docker run -d --link amnezia-wp-tor --name amnezia-tor goldy/tor-hidden-service
diff --git a/client/ui/mainwindow.cpp b/client/ui/mainwindow.cpp
index e4d5b2b3c..22e6ef7a0 100644
--- a/client/ui/mainwindow.cpp
+++ b/client/ui/mainwindow.cpp
@@ -778,18 +778,18 @@ ErrorCode MainWindow::doInstallAction(const std::function &action,
ErrorCode e = action();
qDebug() << "doInstallAction finished with code" << e;
- if (e) {
- if (page) page->setEnabled(true);
- if (button) button->setVisible(true);
- if (info) info->setVisible(false);
+// if (e) {
+// if (page) page->setEnabled(true);
+// if (button) button->setVisible(true);
+// if (info) info->setVisible(false);
- QMessageBox::warning(this, APPLICATION_NAME,
- tr("Error occurred while configuring server.") + "\n" +
- errorString(e));
+// QMessageBox::warning(this, APPLICATION_NAME,
+// tr("Error occurred while configuring server.") + "\n" +
+// errorString(e));
- progress->hide();
- return e;
- }
+// progress->hide();
+// return e;
+// }
// just ui progressbar tweak
timer.stop();
@@ -1473,6 +1473,64 @@ void MainWindow::setupProtocolsPageConnections()
qDebug() << "Protocol saved with code:" << e << "for" << selectedServerIndex << selectedDockerContainer;
});
+
+
+ connect(ui->pushButton_proto_tor_web_site_cont_install, &QPushButton::clicked, this, [this](bool checked){
+ DockerContainer container = DockerContainer::WebSiteInTor;
+ if (checked) {
+ ErrorCode e;
+
+ e = ServerController::runScript(ServerController::sshParams(m_settings.serverCredentials(selectedServerIndex)),
+ "sudo docker stop amnezia-tor");
+
+ e = ServerController::runScript(ServerController::sshParams(m_settings.serverCredentials(selectedServerIndex)),
+ "sudo docker rm -f amnezia-tor");
+
+ e = ServerController::runScript(ServerController::sshParams(m_settings.serverCredentials(selectedServerIndex)),
+ "sudo docker stop amnezia-wp-tor");
+
+ e = ServerController::runScript(ServerController::sshParams(m_settings.serverCredentials(selectedServerIndex)),
+ "sudo docker rm -f amnezia-wp-tor");
+
+ e = doInstallAction([this, container](){
+ return ServerController::setupContainer(m_settings.serverCredentials(selectedServerIndex), container);
+ },
+ ui->page_server_protocols, ui->progressBar_protocols_container_reinstall,
+ nullptr, nullptr);
+
+
+ QString stdOut;
+ auto cbReadStdOut = [&](const QString &data, QSharedPointer proc) {
+ stdOut += data + "\n";
+ };
+ auto cbReadStdErr = [&](const QString &data, QSharedPointer proc) {
+ stdOut += data + "\n";
+ };
+
+ e = ServerController::runScript(ServerController::sshParams(m_settings.serverCredentials(selectedServerIndex)),
+ "sudo docker exec -i amnezia-tor onions",
+ cbReadStdOut, cbReadStdErr);
+
+ qDebug() << "amnezia-tor onions" << stdOut;
+
+ QStringList l = stdOut.split(",");
+ for (QString s : l) {
+ if (s.contains(":80")) {
+ ui->label_tor_web_site->setText(s);
+ }
+ }
+
+ }
+ else {
+ ui->pushButton_proto_tor_web_site_cont_install->setEnabled(false);
+ ErrorCode e = ServerController::removeContainer(m_settings.serverCredentials(selectedServerIndex), container);
+ m_settings.removeContainerConfig(selectedServerIndex, container);
+ ui->pushButton_proto_tor_web_site_cont_install->setEnabled(true);
+
+ }
+
+ //updateProtocolsPage();
+ });
}
void MainWindow::setupNewServerPageConnections()
diff --git a/client/ui/mainwindow.ui b/client/ui/mainwindow.ui
index 0cbd7c6df..789131bf3 100644
--- a/client/ui/mainwindow.ui
+++ b/client/ui/mainwindow.ui
@@ -274,7 +274,7 @@ QPushButton:hover {
- 17
+ 16
@@ -4962,9 +4962,9 @@ border: none;
0
- 0
- 381
- 511
+ -47
+ 371
+ 558
@@ -5622,6 +5622,90 @@ QPushButton:!checked {
+ -
+
+
+
+ 0
+ 100
+
+
+
+
+
+
+
+ QLayout::SetMinAndMaxSize
+
+
-
+
+
-
+
+
+ TOR Web site
+
+
+
+ -
+
+
+
+ 36
+ 24
+
+
+
+
+ 24
+ 24
+
+
+
+ PointingHandCursor
+
+
+ QPushButton {
+ background: transparent;
+ padding: 0px;
+ margin: 0px;
+}
+QPushButton:checked {
+ image: url(:/images/connect_button_connected.png);
+}
+QPushButton:!checked {
+ image: url(:/images/connect_button_disconnected.png);
+}
+
+
+
+
+
+
+ true
+
+
+
+
+
+ -
+
+
+
-
+
+
+ Not installed
+
+
+ Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse
+
+
+
+
+
+
+
+
+
-
@@ -5825,8 +5909,8 @@ QToolBox::tab:hover {
0
0
- 360
- 360
+ 100
+ 30
@@ -5989,8 +6073,8 @@ background: #282932;
0
0
- 360
- 360
+ 100
+ 30
@@ -6185,8 +6269,8 @@ background: #282932;
0
0
- 360
- 360
+ 100
+ 30
@@ -6575,8 +6659,8 @@ color: #15CDCB;
0
0
- 360
- 360
+ 100
+ 30