Is it possible to access the host as a variable in an ssh alias in order to extend the hostname?
I'm trying to create an SSH alias in my .ssh/config file that will match any host which ends .vpn and expand the hostname to [name].vpn.domainname.com
I'm able to match any .vpn domain by specifiing the host as Host *.vpn but I'm having trouble extending the domain.
Ideally I want something like:
Host *.vpn HostName $HOST.domainname.com
I've had a look around but I can't find any examples of SSH aliases like this.
Is this sort of alias possible with an SSH alias? If so how can it be done? If not, any other ideas how I could achieve this result?
I really want to stop having to type out the full domains, and it would be nice not to have to add 50 or so aliases for each of the machines on the vpn.
From the ssh_config(5) man page:
If the hostname contains the character sequence ‘%h’, then this will be replaced with the host name specified on the commandline [...].
Host *.vpn HostName %h.domainname.com