pahaz / sshtunnel

SSH tunnels to remote server.
MIT License
1.23k stars 184 forks source link

BUG: allow_agent isn't working. #281

Open ItamarIn opened 1 year ago

ItamarIn commented 1 year ago

When I passed allow_agent=False to SSHTunnelForwarder object it still trying to connect using ssh keys. even the documentation said it will pass look_for_keys=False

output:

17:01:17.620 | Connected (version 2.0, client OpenSSH_for_Windows_8.9) 17:01:17.777 | Authentication (publickey) failed. 17:01:17.820 | Connected (version 2.0, client OpenSSH_for_Windows_8.9) 17:01:17.971 | Authentication (publickey) failed. 17:01:18.015 | Connected (version 2.0, client OpenSSH_for_Windows_8.9) 17:01:18.173 | Authentication (password) successful!

version: 0.4.0

cosimo commented 1 year ago

A workaround, in case other people stumble on this, can be:

import paramiko

server = SSHTunnelForwarder(
    remote_host,
    # https://stackoverflow.com/questions/54213831/paramiko-or-sshtunnel-and-ssh-agent-without-entering-passphrase
    ssh_pkey=paramiko.agent.Agent().get_keys(),
    ...       
)