Skip to content

Drop Net::SSH::Gateway dependency #1185

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

Merged
merged 3 commits into from
Mar 15, 2019
Merged

Conversation

kke
Copy link
Contributor

@kke kke commented Mar 15, 2019

The Net::SSH::Gateway class is rather simple, but still a bit inflexible.

For example, it does not allow reusing an existing connection and a new one will be always opened for each gateway.

Port forwarding on Net::SSH is quite simple:

"Um, all I want to do is X, just show me how!"

X == "forward connections on a local port to a remote host"

Net::SSH.start("host", "user", :password => "password") do |ssh|
  ssh.forward.local(1234, "www.google.com", 80)
  ssh.loop { true }
end

The IOError rescue retries are there to make it automatically reconnect both self + tunnel in case the tunnel has died. (The current connection does not know if the underlying tunnel has disconnected until it tries to send / receive)

This on its own doesn't fix anything (because it's missing all the host/bastion dereferencing et all), but having this could simplify #1090 and #1003

@kke kke added the enhancement New feature or request label Mar 15, 2019
@kke kke requested a review from jakolehm March 15, 2019 13:05
Copy link
Contributor

@jakolehm jakolehm left a comment

Choose a reason for hiding this comment

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

Looks pretty good 👍 E2e still shows some errors/backtraces.

@kke
Copy link
Contributor Author

kke commented Mar 15, 2019

I think the exception is different on Linux vs mac.

I get these with DEBUG_TRANSPORT=true

D, [2019-03-15T15:19:32.414816 #43061] DEBUG -- Pharos::Transport::SSH[192.168.100.101]: Received Errno::EBADF (expected when tunnel has been closed)
D, [2019-03-15T15:19:32.414916 #43061] DEBUG -- Pharos::Transport::SSH[192.168.100.101]: Closed SSH event loop
D, [2019-03-15T15:19:32.414874 #43061] DEBUG -- Pharos::Transport::SSH[192.168.100.101]: Closed port forward on 65534
D, [2019-03-15T15:19:32.415257 #43061] DEBUG -- Pharos::Transport::SSH[192.168.100.102]: Received Errno::EBADF (expected when tunnel has been closed)
D, [2019-03-15T15:19:32.415334 #43061] DEBUG -- Pharos::Transport::SSH[192.168.100.102]: Closed SSH event loop
D, [2019-03-15T15:19:32.415294 #43061] DEBUG -- Pharos::Transport::SSH[192.168.100.102]: Closed port forward on 65533

Added IOError to the rescue and the exceptions seem to be gone from e2e output now.

Copy link
Contributor

@jakolehm jakolehm left a comment

Choose a reason for hiding this comment

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

LGTM

@jakolehm jakolehm merged commit 4012ed7 into master Mar 15, 2019
@jakolehm jakolehm deleted the feature/drop_net_ssh_gateway branch March 15, 2019 13:49
@jakolehm jakolehm mentioned this pull request Mar 19, 2019
@jakolehm jakolehm mentioned this pull request Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants