]> git.parisson.com Git - telecaster-server.git/commitdiff
add 80 port to ssh tunnel, use new server
authorGuillaume Pellerin <pellerin@parisson.com>
Mon, 5 May 2025 10:24:06 +0000 (12:24 +0200)
committerGuillaume Pellerin <pellerin@parisson.com>
Mon, 5 May 2025 10:24:06 +0000 (12:24 +0200)
etc/network/if-up.d/reverse_ssh_tunnel

index a3118cf0c2b61b3b40992d7ef1327b5687bcabcf..5c59e495f9c5497002181aaf36c7796ea726dbda 100755 (executable)
@@ -4,6 +4,9 @@
 # ------------------------------
 # See autossh and google for reverse ssh tunnels to see how this works
 
+TC_ID_FILE="/etc/tc-id"
+TC_ID=$(cat "$TC_ID_FILE")
+
 # When this script runs it will allow you to ssh into this machine even if it is behind a firewall or has a NAT'd IP address.
 # From any ssh capable machine you just type ssh -p $PORT_MIDDLEMAN_WILL_LISTEN_ON localusername@middleman
 
 USER_TO_SSH_IN_AS=telecaster
 
 # This is the username and hostname/IP address for the middleman (internet accessible server)
-MIDDLEMAN_SERVER_AND_USERNAME=telecaster@parisson.com
+MIDDLEMAN_SERVER_AND_USERNAME=telecaster@telecaster.parisson.com
 
 # The following two numbers can be whatever you want, but need to be unique if you have multiple reverse ssh tunnels
 # Port that the middleman will listen on (use this value as the -p argument when sshing)
-PORT_MIDDLEMAN_WILL_LISTEN_ON=22012
+PORT_MIDDLEMAN_WILL_LISTEN_ON=220$TC_ID
+
+PORT_MIDDLEMAN_WEB=280$TC_ID
 
 # Connection monitoring port, don't need to know this one
-AUTOSSH_PORT=27554
+AUTOSSH_PORT=270$TC_ID
 
 # Ensures that autossh keeps trying to connect
 AUTOSSH_GATETIME=0
 
 export AUTOSSH_PORT AUTOSSH_GATETIME
 
-su -c "autossh -f -N -R *:${PORT_MIDDLEMAN_WILL_LISTEN_ON}:localhost:22 ${MIDDLEMAN_SERVER_AND_USERNAME} -oLogLevel=error -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no" $USER_TO_SSH_IN_AS
+su -c "autossh -f -N -R *:${PORT_MIDDLEMAN_WILL_LISTEN_ON}:localhost:22 -R *:${PORT_MIDDLEMAN_WEB}:localhost:80 ${MIDDLEMAN_SERVER_AND_USERNAME} -oLogLevel=error -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no" $USER_TO_SSH_IN_AS