Title: Let user handle keyboard-interactive events by MattCatz · Pull Request #192 · ParallelSSH/ssh2-python · GitHub
Open Graph Title: Let user handle keyboard-interactive events by MattCatz · Pull Request #192 · ParallelSSH/ssh2-python
X Title: Let user handle keyboard-interactive events by MattCatz · Pull Request #192 · ParallelSSH/ssh2-python
Description: Keyboard-interactive events can have multiple steps. Tweak the existing kbd_callback to massage prompts into a format that an end user can handle from python. New public method userauth_keyboardinteractive_callback added to the session class to maintain backwards compatibility. See new example script for usage. I didn't add any new test case since I'm not really sure how it would fit into the existing set-up. To test locally I set spun up a ssh server inside a docker container1 and pointed the example script at it. Below is an example command I used: OTP=$(oathtool --totp -d 6 12345678909876543210) python ./examples/keyboard_interactive_auth.py --host 127.0.0.1 --port 2022 -u sshuser $OTP 552099 hostname Example Dockerfile SSH server with MFA FROM debian:latest RUN apt-get update && apt-get install -y \ openssh-server \ libpam-oath \ oathtool \ && rm -rf /var/lib/apt/lists/* RUN groupadd sshgroup RUN useradd -ms /bin/bash -g sshgroup -p '$1$sshuser$TCmWDAEGpJ.Z.Sj/NN02I.' sshuser RUN echo 'HOTP/T30/6 sshuser - 12345678909876543210' > /etc/users.oath RUN chmod 600 /etc/users.oath RUN echo 'auth required pam_oath.so usersfile=/etc/users.oath window=30 digits=6' >> /etc/pam.d/sshd run cat /etc/pam.d/sshd RUN echo 'ChallengeResponseAuthentication yes \nKbdInteractiveAuthentication yes\n' >> /etc/ssh/sshd_config.d/otp.conf RUN service ssh start EXPOSE 22 CMD ["/usr/sbin/sshd","-D"] Footnotes ↩
Open Graph Description: Keyboard-interactive events can have multiple steps. Tweak the existing kbd_callback to massage prompts into a format that an end user can handle from python. New public method userauth_keyboardint...
X Description: Keyboard-interactive events can have multiple steps. Tweak the existing kbd_callback to massage prompts into a format that an end user can handle from python. New public method userauth_keyboardint...
Opengraph URL: https://github.com/ParallelSSH/ssh2-python/pull/192
X: @github
Domain: patch-diff.githubusercontent.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:284f9b77-c9e7-656d-66f6-798f055cc6c9 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | DF00:263D08:30219A8:40D7F7A:697C6C6C |
| html-safe-nonce | 7418854b37c37e0428b5fcba7024312fbef7a3a3fe6369f6b2323ffc69831a79 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERjAwOjI2M0QwODozMDIxOUE4OjQwRDdGN0E6Njk3QzZDNkMiLCJ2aXNpdG9yX2lkIjoiODAyNDcwNzI5ODM2NDI1NTM0MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | f233db3e822a588fcb3ba2a494d43b0f7ae2f4033747eac0f37a65194aad84df |
| hovercard-subject-tag | pull_request:1524008548 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/ParallelSSH/ssh2-python/pull/192/files |
| twitter:image | https://avatars.githubusercontent.com/u/14895427?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/14895427?s=400&v=4 |
| og:image:alt | Keyboard-interactive events can have multiple steps. Tweak the existing kbd_callback to massage prompts into a format that an end user can handle from python. New public method userauth_keyboardint... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | da4f0ee56809799586f8ee546b27f94fe9b5893edfbf87732e82be45be013b52 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/ParallelSSH/ssh2-python git https://github.com/ParallelSSH/ssh2-python.git |
| octolytics-dimension-user_id | 22918200 |
| octolytics-dimension-user_login | ParallelSSH |
| octolytics-dimension-repository_id | 98586974 |
| octolytics-dimension-repository_nwo | ParallelSSH/ssh2-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 98586974 |
| octolytics-dimension-repository_network_root_nwo | ParallelSSH/ssh2-python |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 5db242b0a5a9a6d9dcaf7ff8f1f7c9605002f57a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width