Be aware of `~/.ssh/config`
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?
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.
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.
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.
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).
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.
Should be fixed now with v0.10.3.
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
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
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
- https://stackoverflow.com/questions/63326973/unable-to-connect-to-the-server-dial-tcp-lookup-masterip-on-127-0-0-5353-ser
- https://github.com/kelseyhightower/kubernetes-the-hard-way/issues/630
So, try changing the port to :6443
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.
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 https://github.com/golang/go/issues/32958). I've also filed a bug with IP6 addresses in known hosts https://github.com/golang/go/issues/53463#issuecomment-1165748226).
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.
With HostName capitalization, it works.
Great, thanks for the feature suggestion and finding another small issue with the capitalization.
Fixed to support lowercase (as ssh does) attributes.