knipknap / exscript

A Python module making Telnet and SSH easy
MIT License
364 stars 136 forks source link

cannot connect towards legacy Cisco router, need -oKexAlgorithms=+diffie-hellman-group1-sha1 option #190

Closed fpuleio closed 5 years ago

fpuleio commented 5 years ago

Hi, i am trying to connect towards some old routers, but connection fails due to: "no matching key exchange method found. Their offer: diffie-hellman-group1-sha1"

when i try from bash shell, I can force the algorithm: (user) user@automation:/etc/ssh$ ssh user@1.2.3.4 Unable to negotiate with 1.2.3.4 port 22: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1 (user) user@automation:/etc/ssh$ ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 user@1.2.3.4 ... Are you sure you want to continue connecting (yes/no)?

I was wondering if the same is possible within exscript i know i should change the sshd_config file, but i d like to do this attempt within a try- except instance, rather than enable it on the global ssh config

thanks in advance for the help!

fpuleio commented 5 years ago

found a soft solution i changed only the virtual env config , adding in the home directory: /.ssh/config with text:

Host *
    Cipher 3des-cbc
    KexAlgorithms +diffie-hellman-group1-sha1
    User <username>