moul/assh

variables in HostName not working

eiginn opened this issue · 3 comments

May be doing something wrong here but %h does not appear to be working for HostName directive.
here is a simplified version of the conf and debug output. This is with the go version

$ assh -D proxy somehost401
DEBU[0000] Loading config file '/home/eiginn/.ssh/assh.yml' 
INFO[0000] Host somehost401                                   
INFO[0000]   AddressFamily inet                         
INFO[0000]   ForwardAgent no                            
INFO[0000]   HostName %h.some.zone                       
INFO[0000]   IdentitiesOnly yes
INFO[0000]   IdentityFile ~/.ssh/id_rsa
INFO[0000]   Port 22                                    
INFO[0000]   PubkeyAuthentication yes                   
INFO[0000]   ServerAliveCountMax 6                      
INFO[0000]   TCPKeepAlive yes                           
INFO[0000]   User eiginn
DEBU[0000] Writing SSH config file to "/home/eiginn/.ssh/config" 
DEBU[0000] Connecting without gateway                   
DEBU[0000] Connecting to %h.some.zone:22                 
FATA[0000] Proxy error: dial tcp: missing brackets in address %h.some.zone:22 



assh.yml

hosts:

  template:
    User: eiginn
    AddressFamily: inet
    PubkeyAuthentication: yes
    ForwardAgent: yes
    IdentityFile: ~/.ssh/id_rsa

  "somehost[0-7]*":
    HostName: "%h.some.zone"
    Inherits:
      - template


defaults:
  Port: 22
  ForwardAgent: no
  TCPKeepAlive: yes
  ServerAliveInterval: 15
  ServerAliveCountMax: 6
  IdentitiesOnly: yes
moul commented

Which result to you expect ?

ssh somehost401 -> somehost401.some.zone, right ?

yeah.
The relevant normal ssh conf:

Host somehost*
    IdentityFile ~/.ssh/id_rsa
    User eiginn
    ForwardAgent yes
    Hostname %h.some.zone
    AddressFamily inet

Host *
    ForwardAgent no
    TCPKeepAlive yes
    ServerAliveInterval 15
    ServerAliveCountMax 6
    IdentitiesOnly yes
moul commented

Ok got it :)