Skip to content
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

Add ssh2-python keyboard_interactive supporting #390

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion pssh/clients/native/single.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def __init__(self, host,
_auth_thread_pool=True, keepalive_seconds=60,
identity_auth=True,
ipv6_only=False,
keyboard_interactive=False,
):
"""
:param host: Host name or IP to connect to.
Expand Down Expand Up @@ -107,6 +108,8 @@ def __init__(self, host,
for the host or raise NoIPv6AddressFoundError otherwise. Note this will
disable connecting to an IPv4 address if an IP address is provided instead.
:type ipv6_only: bool
:param keyboard_interactive: (Optional) Set to True to enable authentication as keyboard-interactive
:type keyboard_interactive: bool

:raises: :py:class:`pssh.exceptions.PKeyFileError` on errors finding
provided private key.
Expand All @@ -119,6 +122,7 @@ def __init__(self, host,
self.alias = alias
self.host = host
self.port = port if port is not None else 22
self.keyboard_interactive = keyboard_interactive
if proxy_host is not None:
_port = port if proxy_port is None else proxy_port
_pkey = pkey if proxy_pkey is None else proxy_pkey
Expand Down Expand Up @@ -260,7 +264,10 @@ def _pkey_from_memory(self, pkey_data):
)

def _password_auth(self):
self.session.userauth_password(self.user, self.password)
if self.keyboard_interactive:
self.session.userauth_keyboardinteractive(self.user, self.password)
else:
self.session.userauth_password(self.user, self.password)

def _open_session(self):
chan = self._eagain(self.session.open_session)
Expand Down