Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inheritance isn't working #54

Closed
davidpelaez opened this issue Sep 8, 2015 · 4 comments
Closed

Inheritance isn't working #54

davidpelaez opened this issue Sep 8, 2015 · 4 comments
Assignees
Labels

Comments

@davidpelaez
Copy link

I tried using inheritance but I cannot make it work. I even made the file the smallest possible, here's what I have in ~/.ssh/assh.yml

hosts:

  common:
    IdentityFile: ~/.ssh/production.pem
    HostName: 1.2.3.4

  aloha:
    User: ubuntu
    Inherits:
    - common

aash build:

# ssh config generated by advanced-ssh-config

# host-based configuration
Host aloha
  User ubuntu

Host common
  HostName 1.2.3.4
  IdentityFile ~/.ssh/production.pem

# global configuration
Host *
  ProxyCommand assh proxy %h %p

and ssh aloha results in ssh: Could not resolve hostname aloha: nodename nor servname provided, or not known

I checked for syntactical error in the yaml file but I cannot see anything, is this a bug or an error of mine? :(

@moul
Copy link
Owner

moul commented Sep 8, 2015

Actually, the inheritance isn't exported to ~/.ssh/config, it's only used when proxying to an host

I will try to export inheritances to ~/.ssh/config, I just need to benchmark it before :)

@moul moul added the Bug label Sep 8, 2015
@moul moul self-assigned this Sep 8, 2015
@davidpelaez
Copy link
Author

It's ok that it's not exported, but the proxy doesn't seem to be using it either because I don't reach the connection point. Or is it because of the lack of a HostName that I never reaches the proxy? Is there a current way you would recommend to make the sample config work?

@moul
Copy link
Owner

moul commented Sep 8, 2015

Using the latest commit, you can see the computed host:

$ assh -D proxy test-bbb
DEBU[0000] Loading config file '/Users/moul/.ssh/assh.yml'
DEBU[0000] Loading config file '/Users/moul/.ssh/assh.d/hosts.yml'
DEBU[0000] Loading config file '/Users/moul/.ssh/assh.d/test.yml'
INFO[0000] Host test-bbb
INFO[0000]   ControlMaster auto
INFO[0000]   ControlPath ~/tmp/.ssh/cm/%h-%p-%r.sock
INFO[0000]   ControlPersist yes
INFO[0000]   HostName 1.2.3.4
INFO[0000]   IdentityFile ~/.ssh/id_rsa
INFO[0000]   Port 22
INFO[0000]   PreferredAuthentications hostbased,publickey,keyboard-interactive,password
INFO[0000]   PubkeyAuthentication yes
INFO[0000]   ServerAliveCountMax 5
INFO[0000]   TCPKeepAlive yes
INFO[0000]   User ubuntu
INFO[0000]   VisualHostKey yes
DEBU[0000] Writing SSH config file to "/Users/moul/.ssh/config"
DEBU[0000] Trying gateways: [direct]
DEBU[0000] Connecting to 1.2.3.4:22
hosts:
  test-aaa:
    HostName: 1.2.3.4
    IdentityFile: ~/.ssh/id_rsa

  test-bbb:
    User: ubuntu
    Inherits:
    - test-aaa

defaults:
  ControlMaster: auto
  ControlPath: ~/tmp/.ssh/cm/%h-%p-%r.sock
  ControlPersist: yes
  EscapeChar: ~
  GSSAPIKeyExchange: no
  Gateways:
    - direct
  IdentifyFile: ~/.ssh/id_rsa
  Port: 22
  PreferredAuthentications: hostbased,publickey,keyboard-interactive,password
  PubkeyAuthentication: yes
  ServerAliveCountMax: 5
  ServerAliveInterval: 30
  TCPKeepAlive: yes
  User: root
  VisualHostKey: yes

Haha, I just discovered some new ignored keys because of case sensitivity :)

However, inheritance seams to works quite well, can you run: assh -D proxy aloha ?

@moul
Copy link
Owner

moul commented Sep 8, 2015

Hum, I found the issue, the inheritance correctly work in assh, however, some settings are needed in the .ssh/config file, i.e: User, IdentityFile, basically everything not related to HostName, Port, Gateway, etc

So I will finally need to compute each host before saving the ~/.ssh/config file :)

@moul moul closed this as completed in 99677a6 Sep 9, 2015
moul added a commit that referenced this issue Sep 9, 2015
Fix inheritance for all fields (fix #54)
@moul moul removed the in progress label Sep 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants