Skip to content

Instantly share code, notes, and snippets.

@EmbeddedAndroid
Created March 27, 2020 18:30
Show Gist options
  • Save EmbeddedAndroid/3258e1fc0e7f301f3f00d531be43ff9b to your computer and use it in GitHub Desktop.
Save EmbeddedAndroid/3258e1fc0e7f301f3f00d531be43ff9b to your computer and use it in GitHub Desktop.
SSH Reverse Tunnel Dockerfile Entrypoint
#!/bin/sh
chmod 600 /root/.ssh/pkey.pem
echo "${SERVER_HOSTNAME},$(getent hosts ${SERVER_HOSTNAME} | awk '{ print $1 }') ${SERVER_ALGO} ${SERVER_HOST_KEY}" > /tmp/known_hosts
autossh -M 0 -o "ServerAliveInterval 10" -o "ServerAliveCountMax 2" -o "UserKnownHostsFile /tmp/known_hosts" $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment