Miyoshi-Ryota / async-ssh2-tokio

asynchronous and easy-to-use high level ssh client library for rust
Apache License 2.0
67 stars 27 forks source link

Add support for keyboard-interactie auth. #63

Closed mateuszkj closed 1 month ago

mateuszkj commented 2 months ago

What

This change adds support for the keyboard-interactive authentication method described in RFC 4256.

Implementation

This solution introduces the AuthKeyboardInteractive builder, which can be converted into an AuthMethod.

let kbi = AuthKeyboardInteractive::new()
    .with_response("Password: ", "abt")
    .with_response("OTP: ", "12345");

let auth = AuthMethod::with_keyboard_interactive(kbi);
...

This implementation allows defining responses to known and exact prompts.

Implementation Considerations

Although my solution addresses my problem, it might be too limited for others. Here are some considerations:

If the answer to any of these questions is yes, I am willing to implement those changes.

mateuszkj commented 1 month ago

@Miyoshi-Ryota Thanks for merging it.

If you need help with any implementation, feel free to contact me. I'm also considering adding SSH-agent support, so there might be a need for an async credential provider then.