J-Rios / Arduino-esp32sshclient

Arduino library for ESP32 that implements an SSH client to connect and execute commands in a remote Server.
GNU General Public License v3.0
45 stars 13 forks source link

Initial Connections #3

Open jandolina opened 5 years ago

jandolina commented 5 years ago

My esps have been unable to connect to the various ssh servers I have pointed them at. Is there a way to set up a known hosts file or accept the initial verification fingerprint during connection? Is there more initial setup needed than just ssh_client.connect?

Can I introduce a known_hosts from the ESP32 SPIFFS? Is there a way to say 'yes' to the the initial handshake?

Thanks!

Sergio-tix commented 4 years ago

Does not work. Used 3 different servers. Connected to Synology, Raspberry, router.

rst:0x1 (POWERON_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_REO_V2))
waiting for download
ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371 

ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:9720
ho 0 tail 12 room 4
load:0x40080400,len:6352
entry 0x400806b8
SSH client initialized.
Initializing TCP-IP adapter...
  [OK] TCP-IP adapter initialized.
Waiting Wifi connection to "www"...

WiFi connected.
IP address: 192.168.1.16
Connecting to Server "192.168.1.2:22"...
SSH host connection established.
SSH session created.
Failure establishing SSH session: -125
Rebooting system now.

ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:9720
ho 0 tail 12 room 4
load:0x40080400,len:6352
entry 0x400806b8
SSH client initialized.
Initializing TCP-IP adapter...
  [OK] TCP-IP adapter initialized.
Waiting Wifi connection to "www"...
dorsetdrew commented 4 years ago

WiFi connected. IP address: 192.168.1.16 Connecting to Server "192.168.1.2:22"... SSH host connection established. SSH session created. Failure establishing SSH session: -125 Rebooting system now.

... Same result here. Tried 3 different SSH servers, always just get the same -125 which appears to be a timeout

trebur commented 2 years ago

i have the same problem any ideas ?

borissov commented 2 years ago

Need to be updated libssh2 library. You can try my fork for test: https://github.com/borissov/arduino-esp32sshclient/

trebur commented 2 years ago

Thank You i will try it

trebur commented 2 years ago

Hi borissov, I have tested the git lib https://github.com/borissov/arduino-esp32sshclient/ I have followed SendCommandToSSH as far as possible but I get the following error when opening the session

SSH: LIB2 Client connected before exec Connecting to Server "192.168.6.144:22"... SSH host connection established. SSH session created. Failure establishing SSH session: -8 Rebooting system now.

any ideas ? What does it it mean -8 ?

borissov commented 2 years ago

I have no idea, I'm not sure is it updated lib properly but work with my Mac mini... I plan to rewrite my script with native libssh2 .

YundaoJing commented 1 year ago

In J-Rios's Arduino-esp32sshclient, Failure establishing SSH session: -8 is meaning that "LIBSSH2_ERROR_KEY_EXCHANGE_FAILURE" in "libssh2.h". Check your linux sshd configuration files (/etc/ssh/sshd_config) for any of the following:

KexAlgorithms diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1
HostKeyAlgorithms ssh-rsa,ssh-dss

After I delet them, it successfully connected to ssh.

And I find that borissov's Arduino-esp32sshclient can not successfully connected to ssh without these codes in sshd_config