10 hours ago · Tech · hide · 0 comments

I’m a few years into my homelab. (might go into a bit more detail about that at some point!), and I often need to ssh into one of my servers. At home, I can just do this by using a domain name like: ssh ahoy.m.example.ca ssh bread.m.example.ca I have set up Split-Horizon DNS at home using DNSMasq, so these domains resolve but only at home. When I’m outside, I use a a ‘bastion’ server that I can ssh into and hop to another server. It’s on a ‘secret’ port. To automatically tell SSH to go via the bastion server, I have this in my ~/.ssh/config: Host *.m.example.ca ForwardAgent yes User evert ProxyCommand ssh -q -W %h:%p -l evert bastion.example.ca -p 6767 bastion.example.ca does resolve to a real IP (my home IP). The annoyance with this is that if I use one of the above commands, I always go through the bastion whether I’m home or not. I recently found about about the Match and ProxyJump command, and cludged together this: Match host *.m.example.ca exec "! getent hosts %h >/dev/null"…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.