Skip to content

Commit c8fae7f

Browse files
committed
Add ssh2-python keyboard_interactive supporting
1 parent c7fc51a commit c8fae7f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pssh/clients/native/single.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def __init__(self, host,
6161
_auth_thread_pool=True, keepalive_seconds=60,
6262
identity_auth=True,
6363
ipv6_only=False,
64+
keyboard_interactive=False,
6465
):
6566
"""
6667
:param host: Host name or IP to connect to.
@@ -107,6 +108,8 @@ def __init__(self, host,
107108
for the host or raise NoIPv6AddressFoundError otherwise. Note this will
108109
disable connecting to an IPv4 address if an IP address is provided instead.
109110
:type ipv6_only: bool
111+
:param keyboard_interactive: (Optional) Set to True to enable authentication as keyboard-interactive
112+
:type keyboard_interactive: bool
110113
111114
:raises: :py:class:`pssh.exceptions.PKeyFileError` on errors finding
112115
provided private key.
@@ -119,6 +122,7 @@ def __init__(self, host,
119122
self.alias = alias
120123
self.host = host
121124
self.port = port if port is not None else 22
125+
self.keyboard_interactive=keyboard_interactive
122126
if proxy_host is not None:
123127
_port = port if proxy_port is None else proxy_port
124128
_pkey = pkey if proxy_pkey is None else proxy_pkey
@@ -260,7 +264,10 @@ def _pkey_from_memory(self, pkey_data):
260264
)
261265

262266
def _password_auth(self):
263-
self.session.userauth_password(self.user, self.password)
267+
if self.keyboard_interactive:
268+
self.session.userauth_keyboardinteractive(self.user, self.password)
269+
else:
270+
self.session.userauth_password(self.user, self.password)
264271

265272
def _open_session(self):
266273
chan = self._eagain(self.session.open_session)

0 commit comments

Comments
 (0)