SSH Client

Empusas
Posts: 3
Joined: Wed Oct 02, 2019 6:43 pm

Re: SSH Client

Postby Empusas » Wed Oct 02, 2019 9:07 pm

I tried to use the same lib from Jose Rios and the handshake does not work as well:
SSH client initialized.
Initializing TCP-IP adapter...
[OK] TCP-IP adapter initialized.
Waiting Wifi connection to "supernet"...

WiFi connected.
IP address: 192.168.178.57
Connecting to Server "192.168.178.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:1044
load:0x40078000,len:8896
load:0x40080400,len:5816
entry 0x400806ac

Empusas
Posts: 3
Joined: Wed Oct 02, 2019 6:43 pm

Re: SSH Client

Postby Empusas » Fri Oct 04, 2019 4:29 pm

I did a little bit more debugging and change the code slightly to give some more status messages. I get to the point where Rios code says "SSH host handshake success" it fail right after that with authentication failed. But the User/PW provided do work just fine, so I did a little bit more digging into the libssh2.

It fails with error code -43 which is "BAD_SOCKET". I have also some -8 error which means handshake failed.
Rios code is very simple and does not offer any debug options, but libbsh2 has.
SSH client initialized.
Initializing TCP-IP adapter...
[OK] TCP-IP adapter initialized.
Waiting Wifi connection to "supernet"...

WiFi connected.
IP address: 192.168.178.57
Connecting to Server "192.168.178.2:22"...
SSH host connection established.
SSH session created.
SSH host session handshake success.
Authentication by password failed (-43)!
Rebooting system now.

Empusas
Posts: 3
Joined: Wed Oct 02, 2019 6:43 pm

Re: SSH Client

Postby Empusas » Sat Nov 09, 2019 2:11 pm

Meanwhile I have simply switched from Arduino to micropython on my ESP32 for my little project.
There is a version from Boris Lovosevic compiled for the ESP32 with a included SSH client module.
https://github.com/loboris/MicroPython_ ... o/wiki/ssh

This works very well. As I did many other projects in python anyway, there was no big deal switch to micropython.

Today I got my JTAG debug module. If I have more time this winter I may do some more digging into the code from Rios and libssh2 to see where the problem is.

gojimmypi
Posts: 13
Joined: Mon Apr 18, 2022 3:58 pm

Re: SSH Client

Postby gojimmypi » Mon Jun 20, 2022 5:59 pm

I'm a bit late to this party, but I do have an SSH client working for both the ESP8266 as well as the ESP32 using the wolfSSL libraries.

What I created is a "SSH to UART" that upon logging into the embedded SSH server, connects the user to the defined Tx/Rx pins of an externally-connected device.

For instance, here's my "SSH on a Stick" connected to an EdgeRouter-X. https://twitter.com/gojimmypi/status/15 ... 26919?s=20

My ESP32 project is here: https://github.com/gojimmypi/wolfssh/tr ... SSH-Server

My ESP8266 project is here: https://github.com/gojimmypi/wolfssh/tr ... SSH-Server

Both were developed with the VisualGDB extension for Visual Studio. The projects should build just find with the ESP-IDF (V4.4.1, not yet working with 5.x)

I'm currently working on setting up a new wolfssh-examples repo, so these examples will live here very soon:

https://github.com/wolfssl/wolfssh-examples

I have a few blog posts about wolfSSH here: https://gojimmypi.github.io/tag/wolfssh/

Who is online

Users browsing this forum: No registered users and 100 guests