This commit is contained in:
Philipp Kolberg 2025-04-21 02:16:01 +02:00 committed by GitHub
commit 059c7ce2e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -951,7 +951,7 @@ def start_ssh_tunnel(username, remote_address, ssh_port, ssh_password, local_rem
logfile=fd, timeout=20, encoding='utf-8') logfile=fd, timeout=20, encoding='utf-8')
# Match only "(yes/no" in order to handle both (yes/no) and (yes/no/[fingerprint]) # Match only "(yes/no" in order to handle both (yes/no) and (yes/no/[fingerprint])
i = child.expect([r'(?i)password:', r'\(yes\/no', r'.*[$#] ', pexpect.EOF]) i = child.expect([r'(?i)password:', r'\(yes\/no', r'.*[$#] ', r'Permission denied \(publickey,password\)', pexpect.EOF])
if i == 0: if i == 0:
child.sendline(ssh_password) child.sendline(ssh_password)
try: try:
@ -988,6 +988,8 @@ def start_ssh_tunnel(username, remote_address, ssh_port, ssh_password, local_rem
raise ValueError('Incorrect password') raise ValueError('Incorrect password')
except pexpect.TIMEOUT: except pexpect.TIMEOUT:
pass pass
elif i == 3:
raise Exception("SSH tunneling failed: please enable password authentication in your SSH client config.")
except Exception as ex: except Exception as ex:
if debug: if debug:
print("ERROR: running local SSH client [{}] failed connecting to {}: {}".format(command, args, ex)) print("ERROR: running local SSH client [{}] failed connecting to {}: {}".format(command, args, ex))