-
-
Notifications
You must be signed in to change notification settings - Fork 173
Fix SSH Client to respond to keyboard-interactive when target has optional 2FA #1273
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
Conversation
…ional 2fa Signed-off-by: Sam Toxopeus <sam@toxopeus.it>
The test failure seems to be because the test ssh server ratelimits after wg attempts kb-interactive which then leads to a timeout. Given the current flow it will always attempt it once per connection if mentioned as possible method and key or password fails. Ideally you'd pick up on the partial success result, so it only attempts is if pw or key already succeeded individually. However AuthResult does not seem to provide this feedback, any idea for a workaround to still pick that up? @Eugeny |
russh indeed doesn't expose the partial_success flag yet. But I think I've fixed your issue in #1274 - can you please merge or rebase? Previously Warpgate would try the same RSA key three times with different hash algs, exhausting OpenSSH's auth attempt budget. |
Ah I made a mistake in merging indeed, you caught it quicker than me xD I wonder if it actually works like this, as at the end we will still worst case attempt n*2 attempts when we also attempt keyboard-interactive for every failed connection. Oh well lets see what the test does. |
It should work in reality except the cases where the auth limit is <=4 or (very artificial)
I'll try to add support for partial_success to russh soon 😅 |
Indeed, succeeds now. Thanks for your help! Support for Also overall Warpgate really is an awesome project, thanks for all your time and dedication in it 😄. And its been a nice way so far for me to dig some more into rust, as I usually work with different toolchains. |
Thanks! And thanks for contributing as always If the stars align I'll have time to try adding partial_success tonight |
This PR fixes #1272 for both public key and password targets.
When a keyboard-interactive prompt is offered it will respond with empty responses to given prompts. For targets with enforced 2FA via TOTP for example, this will fail as the code is not correct and the session will terminate. For targets that have 2FA enabled, but don't enforce it this will ensure the connection will be setup as sshd expects those empty responses.