From 78734e67c61444d0a9c4ea12c98da77901ceb160 Mon Sep 17 00:00:00 2001 From: Ilya Mukhortov Date: Tue, 17 Oct 2023 09:37:46 +1000 Subject: [PATCH] pass --- bash_scripts/install-reverse-proxy.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 bash_scripts/install-reverse-proxy.sh diff --git a/bash_scripts/install-reverse-proxy.sh b/bash_scripts/install-reverse-proxy.sh new file mode 100755 index 0000000..35ac7d2 --- /dev/null +++ b/bash_scripts/install-reverse-proxy.sh @@ -0,0 +1,26 @@ +set -e + +apt install --assume-yes autossh +ssh-keygen -f ~/.ssh/proxy-server +ssh-copy-id -i ~/.ssh/proxy-server.pub -p 22 proxy_user@188.225.79.4 + +read -p "Enter port for proxy server: " proxy_port + +cat <> /etc/systemd/system/remote-autossh.service +[Unit] +Description=AutoSSH service for remote tunnel +After=network-online.target +Wants=network-online.target systemd-networkd-wait-online.service + +[Service] +User=root +Restart=on-failure +RestartSec=1min +ExecStart=/usr/bin/autossh -N -R $proxy_port:localhost:22 -i /root/.ssh/proxy-server proxy_user@188.225.79.4 + +[Install] +WantedBy=multi-user.target +EOT + +systemctl daemon-reload && systemctl start remote-autossh +systemctl enable remote-autossh.service