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

Be aware of ~/.ssh/config #12

Closed
DannyBen opened this issue Jun 16, 2022 · 14 comments
Closed

Be aware of ~/.ssh/config #12

DannyBen opened this issue Jun 16, 2022 · 14 comments

Comments

@DannyBen
Copy link

I was trying to configure a server in sake.yaml, by simply using the hostname as it is written in my ~/.ssh/config, but realized this does not work.

Example sake.yaml:

servers:
  myserver:
    host: myserver

Example ~/.ssh/config:

Host myserver
  Hostname 123.123.123.123
  User root

Can this be made to work?

This was referenced Jun 17, 2022
@alajmo
Copy link
Owner

alajmo commented Jun 17, 2022

It sounds like a good idea, initially, I didn't want to introduce another config (keep the state in one location), but it might be helpful to resolve hosts.

@DannyBen
Copy link
Author

Well, it is a matter of perspective I guess.

The ~/.ssh/config is the standard place for SSH related configuration, and not only for host resolution. In particular, my SSH config has also users, and wildcards to enforce some other SSH nuances across multiple configuration blocks - such as SSH agent forwarding etc. I wonder if the SSH library used by sake already has a way to load the native SSH config.

@alajmo
Copy link
Owner

alajmo commented Jun 17, 2022

Two libraries come to mind to help with this, https://github.com/mikkeloscar/sshconfig and https://github.com/kevinburke/ssh_config. I'm not using any 3rd party SSH library, but the crypto/ssh library provided by go (they only provide agent and knownhosts capability).

One interesting note would be to allow regular hosts defined in ssh_config (only for exact hostnames), so you could skip defining anything at all in the servers section in sake.

@eppixx
Copy link

eppixx commented Jul 19, 2022

The current config also does not allow everything possible with ssh alone. For example I'm using JumpProxy ("-J"-Option). That is currently not possible (at least haven't found it).

@alajmo
Copy link
Owner

alajmo commented Jul 20, 2022

Bastion/Jumphost is not yet supported but is next on the list to implement, and I'll look at more ssh options configs to support.

@alajmo
Copy link
Owner

alajmo commented Aug 26, 2022

Should be fixed now with v0.10.3.

@alajmo alajmo closed this as completed Aug 26, 2022
@alajmo
Copy link
Owner

alajmo commented Sep 16, 2022

The current config also does not allow everything possible with ssh alone. For example I'm using JumpProxy ("-J"-Option). That is currently not possible (at least haven't found it).

Should work now with https://github.com/alajmo/sake/releases/tag/v0.11.0

@DannyBen
Copy link
Author

DannyBen commented Sep 16, 2022

I am sorry - I must be missing something.
The original topic of this ticket does not seem to work still.

The error I am getting is something like this:

myserver | myserver | root | 22   | dial tcp: lookup myserver on 127.0.0.53:53: server misbehaving

@alajmo
Copy link
Owner

alajmo commented Sep 16, 2022

So it seems to resolve to the correct IP (also I assume you mistyped earlier, should be HostName and not Hostname - seems ssh lowercase in the backend, didn't know this)?
Are you trying to connect to a K8s node? If so, perhaps this could help you

So, try changing the port to :6443

@alajmo alajmo reopened this Sep 16, 2022
@DannyBen
Copy link
Author

Well - not trying to connect to a k8s host. Just a plain old remote server.
If ssh sometjing works, I expect sake to be able to accept just something as a server name, and inherit everything my ~/.ssh/config had to say.

However, I totally understand if this is not the design intention.

@alajmo
Copy link
Owner

alajmo commented Sep 16, 2022

I would like it to work with everything that's supported in ssh (and I try to follow their semantics as much as possible), and will try to implement as much as possible, but since I'm relying on Go's crypto/ssh library, some things are not yet available, like (like ControlMaster golang/go#32958). I've also filed a bug with IP6 addresses in known hosts golang/go#53463 (comment)).

Concerning your issue, I haven't been able to replicate it, if you could paste the ssh configs which impact how you connect (and try replacing Hostname with HostName, that's a separate issue that I need to fix), it would be of great help.

@DannyBen
Copy link
Author

With HostName capitalization, it works.

@alajmo
Copy link
Owner

alajmo commented Sep 17, 2022

Great, thanks for the feature suggestion and finding another small issue with the capitalization.

@alajmo alajmo closed this as completed Sep 17, 2022
@alajmo
Copy link
Owner

alajmo commented Oct 9, 2022

Fixed to support lowercase (as ssh does) attributes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants