I have a config file ~/.ssh/config
that looks something like this:
Host *.texas
User john
Host *.texas !gateway.texas
HostName %h.unitedstates.com
ProxyJump gateway.texas
Host gateway.texas
HostName ssh.texas.unitedstates.com
Host dallas austin
HostName %h.texas
RemoteCommand zsh -l
In summary, I expect that ssh dallas
resolves to something like ssh -J ssh.texas.unitedstates.com john@dallas.texas.unitedstates.com zsh -l
while ssh houston.texas
resolves to ssh -J john@ssh.texas.unitedstates.com john@houston.texas.unitedstates.com
. The second example works as expected but not the first one (unresolved hostname). I suspect that it has something to do with the %h.texas
which should in turn be resolved as %h.unitedstates.com
Could anyone help?
Thanks!
Best Answer
As mentioned in the comments, by default recursive hostname resolution is not possible, but several options can help, including Match and CanonicalDomains/CanonicalHostName. In the end, I turned the problem around with something like this:
More information on Canonicalization and on Match.