pass
This commit is contained in:
parent
054ac805b6
commit
78734e67c6
|
|
@ -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 <<EOT >> /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
|
||||||
Loading…
Reference in New Issue