Bug 3124

Summary: Add a token to expand to remote hostname without domain name
Product: Portable OpenSSH Reporter: mmoya
Component: sshAssignee: Assigned to nobody <unassigned-bugs>
Status: NEW ---    
Severity: enhancement    
Priority: P5    
Version: 8.2p1   
Hardware: amd64   
OS: All   

Description mmoya 2020-02-25 20:02:07 AEDT
Add a token (say %H) for expanding the remote hostname *without* the domain name.

This feature will be useful to make config more clear when setting up access through a bastion host.

Right now, getting the remote hostname (without domain name) can be achieved with a shell hack.

Example config:

```
Host *.proj
  ConnectTimeout 5
  IdentityFile ~/.ssh/id_ecdsa-proj

Host *.prod.proj
  ProxyCommand ssh 1.2.3.4 -W $(echo %h | cut -d. -f1):%p

Host *.staging.proj
  ProxyCommand ssh 2.3.4.5 -W $(echo %h | cut -d. -f1):%p
```

compare that to something like:

```
Host *.proj
  Hostname %H  # a hypothetical new token expanding to the host part of the remote hostname
  ConnectTimeout 5
  IdentityFile ~/.ssh/id_ecdsa-proj

Host *.prod.proj
  ProxyJump 1.2.3.4

Host *.staging.proj
  ProxyJump 2.3.4.5
```

Thanks