Skip to content

Add support for SSH_OPTIONS_PROXYJUMP - #10

Merged
fwininger merged 2 commits into
masterfrom
proxy_jump
Aug 26, 2026
Merged

Add support for SSH_OPTIONS_PROXYJUMP#10
fwininger merged 2 commits into
masterfrom
proxy_jump

Conversation

@fmang

@fmang fmang commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

To make life easier in the future I have added a low-level binding to
ssh_options_set and a high-level wrapper class for Session in Ruby.

I haved merged the C initialize method into the allocator and defined a
new Ruby initialize method. Though evil, Session.allocate.connect
should not make the whole Ruby process crash like it does now.

Without authentication the test is not convincing yet, but I could
confirm that session.add_proxy_jump "localhost" establishes a
connection to my host’s SSH server using my user’s default keys.

Calling ssh_options_set every time a new proxy jump is added is a bit
wasteful but multiple jumps are rare and the intended API is:

session.add_proxy_jump "foo", authenticate: -> (jump_session) { … }
session.add_proxy_jump "bar", authenticate: -> (jump_session) { … }

Rather than the counter-intuitive libssh way:

session.proxy_jumps = ["foo", "bar"]
session.append_proxy_jump_callback authenticate: -> (jump_session) { … }
session.append_proxy_jump_callback authenticate: -> (jump_session) { … }

-Wno-unused-parameter silences warnings in Ruby’s headers, which used to
cause noise when building.

fmang added 2 commits August 26, 2026 13:33
To make life easier in the future I have added a low-level binding to
ssh_options_set and a high-level wrapper class for Session in Ruby.

I haved merged the C initialize method into the allocator and defined a
new Ruby initialize method. Though evil, `Session.allocate.connect`
should not make the whole Ruby process crash like it does now.

Without authentication the test is not convincing yet, but I could
confirm that `session.add_proxy_jump "localhost"` establishes a
connection to my host’s SSH server using my user’s default keys.

Calling ssh_options_set every time a new proxy jump is added is a bit
wasteful but multiple jumps are rare and the intended API is:

    session.add_proxy_jump "foo", authenticate: -> (jump_session) { … }
    session.add_proxy_jump "bar", authenticate: -> (jump_session) { … }

Rather than the counter-intuitive libssh way:

    session.proxy_jumps = ["foo", "bar"]
    session.append_proxy_jump_callback authenticate: -> (jump_session) { … }
    session.append_proxy_jump_callback authenticate: -> (jump_session) { … }

-Wno-unused-parameter silences warnings in Ruby’s headers, which used to
cause noise when building.
@fwininger
fwininger merged commit 7ef57f3 into master Aug 26, 2026
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

Successfully merging this pull request may close these issues.

2 participants