Skip to content
This repository has been archived by the owner on Dec 16, 2020. It is now read-only.

Issue #12 - Support ssh gateways. #13

Closed
wants to merge 1 commit into from
Closed

Issue #12 - Support ssh gateways. #13

wants to merge 1 commit into from

Conversation

rteabeault
Copy link
Contributor

Looking for feedback...

This commit provides support for connecting to the destination host via an SSH gateway.

  • connector_port_open? implementation for winrm and ssh
  • the ssh implementation checks if it can connect to the gateway if the gateway is given. If
    it is not given then connect directly to the destination.
  • host_commander#connector_for now calls the connector_port_open? for winrm and then ssh.
  • port_open? moved to host_connector so it could be called from the winrm and ssh host connectors.
  • ssh connector's run method now creates a gateway connection if the gateway value is in the :ssh options.

This commit provides support for connecting to the destination host via an SSH gateway.
- connector_port_open? implementation for winrm and ssh
- the ssh implementation checks if it can connect to the gateway if the gateway is given. If
  it is not given then connect directly to the destination.
- host_commander#connector_for now calls the connector_port_open? for winrm and then ssh.
- port_open? moved to host_connector so it could be called from the winrm and ssh host connectors.
- ssh connector's run method now creates a gateway connection if the gateway value is in the :ssh options.

if options[:ssh][:gateway]
gw_host, gw_user = options[:ssh][:gateway].split("@").reverse
gw_host, gw_port = gw_host.split(":")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'm okay with the format of user@host:port, but its a bit different than what might be expected. I think it might be worth having some error checking here to make sure the variables are split appropriately.

@rteabeault
Copy link
Contributor Author

Would you rather the config be something like

ssh: {
  gateway: {
    user: "foo",
    host: "bar.com",
    port: 1234
  }
}

I picked the format user@host:port because it is the format that knife ssh uses. We can add some error checking but because of the possible characters allowed in a user and host name it may not be 100% correct.

@rteabeault
Copy link
Contributor Author

@KAllan357, any thoughts on my previous comment?

@jefmsmit
Copy link

I personally like the user@host:port better because it conforms to the knife ssh style. Any other thoughts?

@jefmsmit
Copy link

Whoops, should have added @KAllan357 and @rteabeault since they're the most familiar.

@capoferro
Copy link
Contributor

@KAllan357 @reset @ivey This seems reasonable to me. We've unfortunately let this PR languish. I will spend some time tomorrow to see if this can be rebased easily.

Any thoughts on why this might not be ready for merge pending a rebase?

@capoferro
Copy link
Contributor

Rebased on master in #26

@capoferro
Copy link
Contributor

Closing this one in favor of #26 (same commit, rebased)

@capoferro capoferro closed this May 5, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants