tor site
This commit is contained in:
parent
1baf36282e
commit
08b2824ff0
7 changed files with 185 additions and 23 deletions
|
@ -11,6 +11,7 @@ QString amnezia::scriptFolder(amnezia::DockerContainer container)
|
||||||
case DockerContainer::OpenVpnOverCloak: return QLatin1String("openvpn_cloak");
|
case DockerContainer::OpenVpnOverCloak: return QLatin1String("openvpn_cloak");
|
||||||
case DockerContainer::OpenVpnOverShadowSocks: return QLatin1String("openvpn_shadowsocks");
|
case DockerContainer::OpenVpnOverShadowSocks: return QLatin1String("openvpn_shadowsocks");
|
||||||
case DockerContainer::WireGuard: return QLatin1String("wireguard");
|
case DockerContainer::WireGuard: return QLatin1String("wireguard");
|
||||||
|
case DockerContainer::WebSiteInTor: return QLatin1String("website_tor");
|
||||||
default: return "";
|
default: return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,8 @@ enum class DockerContainer {
|
||||||
OpenVpn,
|
OpenVpn,
|
||||||
OpenVpnOverShadowSocks,
|
OpenVpnOverShadowSocks,
|
||||||
OpenVpnOverCloak,
|
OpenVpnOverCloak,
|
||||||
WireGuard
|
WireGuard,
|
||||||
|
WebSiteInTor
|
||||||
};
|
};
|
||||||
|
|
||||||
DockerContainer containerFromString(const QString &container);
|
DockerContainer containerFromString(const QString &container);
|
||||||
|
|
|
@ -67,5 +67,7 @@
|
||||||
<file>server_scripts/wireguard/run_container.sh</file>
|
<file>server_scripts/wireguard/run_container.sh</file>
|
||||||
<file>server_scripts/wireguard/start.sh</file>
|
<file>server_scripts/wireguard/start.sh</file>
|
||||||
<file>server_scripts/wireguard/template.conf</file>
|
<file>server_scripts/wireguard/template.conf</file>
|
||||||
|
<file>server_scripts/website_tor/configure_container.sh</file>
|
||||||
|
<file>server_scripts/website_tor/run_container.sh</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
13
client/server_scripts/website_tor/configure_container.sh
Normal file
13
client/server_scripts/website_tor/configure_container.sh
Normal file
|
@ -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'
|
3
client/server_scripts/website_tor/run_container.sh
Normal file
3
client/server_scripts/website_tor/run_container.sh
Normal file
|
@ -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
|
|
@ -778,18 +778,18 @@ ErrorCode MainWindow::doInstallAction(const std::function<ErrorCode()> &action,
|
||||||
ErrorCode e = action();
|
ErrorCode e = action();
|
||||||
qDebug() << "doInstallAction finished with code" << e;
|
qDebug() << "doInstallAction finished with code" << e;
|
||||||
|
|
||||||
if (e) {
|
// if (e) {
|
||||||
if (page) page->setEnabled(true);
|
// if (page) page->setEnabled(true);
|
||||||
if (button) button->setVisible(true);
|
// if (button) button->setVisible(true);
|
||||||
if (info) info->setVisible(false);
|
// if (info) info->setVisible(false);
|
||||||
|
|
||||||
QMessageBox::warning(this, APPLICATION_NAME,
|
// QMessageBox::warning(this, APPLICATION_NAME,
|
||||||
tr("Error occurred while configuring server.") + "\n" +
|
// tr("Error occurred while configuring server.") + "\n" +
|
||||||
errorString(e));
|
// errorString(e));
|
||||||
|
|
||||||
progress->hide();
|
// progress->hide();
|
||||||
return e;
|
// return e;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// just ui progressbar tweak
|
// just ui progressbar tweak
|
||||||
timer.stop();
|
timer.stop();
|
||||||
|
@ -1473,6 +1473,64 @@ void MainWindow::setupProtocolsPageConnections()
|
||||||
|
|
||||||
qDebug() << "Protocol saved with code:" << e << "for" << selectedServerIndex << selectedDockerContainer;
|
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<QSsh::SshRemoteProcess> proc) {
|
||||||
|
stdOut += data + "\n";
|
||||||
|
};
|
||||||
|
auto cbReadStdErr = [&](const QString &data, QSharedPointer<QSsh::SshRemoteProcess> 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()
|
void MainWindow::setupNewServerPageConnections()
|
||||||
|
|
|
@ -274,7 +274,7 @@ QPushButton:hover {
|
||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>17</number>
|
<number>16</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="page_start">
|
<widget class="QWidget" name="page_start">
|
||||||
<widget class="QLabel" name="label_25">
|
<widget class="QLabel" name="label_25">
|
||||||
|
@ -4962,9 +4962,9 @@ border: none;
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>-47</y>
|
||||||
<width>381</width>
|
<width>371</width>
|
||||||
<height>511</height>
|
<height>558</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
@ -5622,6 +5622,90 @@ QPushButton:!checked {
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QFrame" name="frame_tor_web_site">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>100</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_19">
|
||||||
|
<property name="sizeConstraint">
|
||||||
|
<enum>QLayout::SetMinAndMaxSize</enum>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_75">
|
||||||
|
<property name="text">
|
||||||
|
<string>TOR Web site</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_proto_tor_web_site_cont_install">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>36</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="cursor">
|
||||||
|
<cursorShape>PointingHandCursor</cursorShape>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">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);
|
||||||
|
}
|
||||||
|
</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QFrame" name="frame_wireguard_settings_2">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_20">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_tor_web_site">
|
||||||
|
<property name="text">
|
||||||
|
<string>Not installed</string>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -5825,8 +5909,8 @@ QToolBox::tab:hover {
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>360</width>
|
<width>100</width>
|
||||||
<height>360</height>
|
<height>30</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
|
@ -5989,8 +6073,8 @@ background: #282932;
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>360</width>
|
<width>100</width>
|
||||||
<height>360</height>
|
<height>30</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="label">
|
<attribute name="label">
|
||||||
|
@ -6185,8 +6269,8 @@ background: #282932;
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>360</width>
|
<width>100</width>
|
||||||
<height>360</height>
|
<height>30</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="label">
|
<attribute name="label">
|
||||||
|
@ -6575,8 +6659,8 @@ color: #15CDCB;
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>360</width>
|
<width>100</width>
|
||||||
<height>360</height>
|
<height>30</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="label">
|
<attribute name="label">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue