My company has three separate jump hosts. Something like: jump1.example.com, jump2.example.com, and jump3.example.com
All internal servers must be accessed through these jumphosts:
local ---> jump1.example.com ---> internal.example.com We have lots of internal servers, so to simplify I created a config file like so:
.ssh/config:
Host jump1.example.com jump2.example.com jump3.example.com ForwardAgent yes ProxyCommand none Host *.example.com PubkeyAuthentication yes User sbarnett IdentityFile ~/.ssh/id_rsa IdentitiesOnly yes ProxyCommand ssh -q -W %h:%p jump1.example.com Note that my public key is located on every one of these machines, so this setup works perfectly. I can type ssh internal.example.com and it will properly proxy through jump1.example.com and connect with my private key
Here's what I want to do, though: Instead of typing jump1.example.com or internal.example.com, I'd like to just type ssh jump1 or ssh internal
I know that this can be configured per host like so:
Host internal HostName internal.example.com PubkeyAuthentication yes User sbarnett IdentityFile ~/.ssh/id_rsa IdentitiesOnly yes ProxyCommand ssh -q -W %h:%p jump1.example.com However if I try the much simpler:
Host internal HostName internal.example.com Then my generic config options (under *.example.com) are not loaded when I try to use ssh internal -- so it doesn't use the proxy and doesn't use the identity file, preventing me from connecting.
Is there a way to say "if the host name is *.example.com (not necessarily the host) then apply these settings"?
Bonus points for a way to redirect * to *.example.com if and only if * does not exist (e.g. - when connecting to [email protected] I don't want it to redirect to [email protected])