Added autossh

main
Filip Borum Poulsen 1 year ago
parent d6555e0560
commit 0f3d969c76

@ -0,0 +1,10 @@
Host bpfilip.dk
HostName bpfilip.dk
IdentityFile /home/pi/.ssh/id_rsa
User root
Port 2223
LocalForward 22 127.0.0.1:2222
RemoteForward 2222 127.0.0.1:22
RemoteForward 10.0.1.25:8081 127.0.0.1:8080
GatewayPorts yes
Compression yes

@ -0,0 +1,14 @@
[Unit]
Description=Keeps an SSH tunnel to 'bpfilip.dk' open
After=network-online.target
[Service]
ExecStart=/usr/bin/autossh -M 0 -N -q -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" bpfilip.dk
ExecStop=/usr/bin/killall -s KILL autossh
User=1000
Group=1000
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target

@ -23,8 +23,11 @@ git pull
npm install
sudo cp remote-relay.service /etc/systemd/system/remote-relay.service
sudo cp autossh.service /etc/systemd/system/autossh.service
sudo systemctl daemon-reload
sudo systemctl enable remote-relay.service
sudo systemctl restart remote-relay.service
sudo systemctl enable autossh.service
sudo systemctl restart autossh.service
popd

Loading…
Cancel
Save