Skip to content

Instantly share code, notes, and snippets.

@vasi
Last active April 17, 2024 00:07
Show Gist options
  • Save vasi/24509a3ca96c07522c73ef23cdb94196 to your computer and use it in GitHub Desktop.
Save vasi/24509a3ca96c07522c73ef23cdb94196 to your computer and use it in GitHub Desktop.

Connect to dali via either local or remote DNS, depending on whether it appears locally. Sucks that I can't set my router to customize DNS, but so it goes, and this works fine.

To use, put in ~/.ssh/config:

Host dali
  ProxyCommand bash -c "nc $(dali-name) 22"

Can then forward other hosts thorugh the DMZ, eg:

Host foo
  ProxyCommand ssh -A -W %h:%p dali
#!/bin/sh
hostkey=$(ssh-keygen -F dali | grep ssh-ed25519 | awk '{print $3}')
scankey=$(ssh-keyscan -T 1 -t ssh-ed25519 dali 2>/dev/null | awk '{print $3}')
if [ "$hostkey" = "$scankey" ]; then
echo dali
else
echo home.vsky.ca
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment