Skip to content

Commit b88eed6

Browse files
committed
Imrove strict-kex interoperability
This commit changes AsyncSSH to no longer send MSG_IGNORE during a key exchange (both initial and when rekeying). With the strict-kex feature, MSG_IGNORE is no longer allowed during initial kex exchange, but some implementations also error out if they see MSG_IGNORE during rekeying. This change should improve interoperability in that case. Thanks go to GitHub user emeryalden for reporting this issue and helping to track down the specific issue that caused rekeying to fail!
1 parent 4b45479 commit b88eed6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

asyncssh/connection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1741,7 +1741,7 @@ def send_packet(self, pkttype: int, *args: bytes,
17411741
self._send_kexinit()
17421742
self._kexinit_sent = True
17431743

1744-
if (((pkttype in {MSG_SERVICE_REQUEST, MSG_SERVICE_ACCEPT} or
1744+
if (((pkttype in {MSG_DEBUG, MSG_SERVICE_REQUEST, MSG_SERVICE_ACCEPT} or
17451745
pkttype > MSG_KEX_LAST) and not self._kex_complete) or
17461746
(pkttype == MSG_USERAUTH_BANNER and
17471747
not (self._auth_in_progress or self._auth_complete)) or
@@ -1751,7 +1751,7 @@ def send_packet(self, pkttype: int, *args: bytes,
17511751

17521752
# If we're encrypting and we have no data outstanding, insert an
17531753
# ignore packet into the stream
1754-
if self._send_encryption and pkttype not in (MSG_IGNORE, MSG_EXT_INFO):
1754+
if self._send_encryption and pkttype > MSG_KEX_LAST:
17551755
self.send_packet(MSG_IGNORE, String(b''))
17561756

17571757
orig_payload = Byte(pkttype) + b''.join(args)

0 commit comments

Comments
 (0)