Page 1 of 2

SSH Client

Posted: Wed Mar 08, 2017 12:51 am
by gregstewart90
I have have a wireless range extender that I would like to configure with the ESP32. I can ssh into the range extender and update configuration files. Is there anyway to ssh into a linux box from the ESP32?

The idea is that I can have the ESP32 look for the default SSID of the range extender. Once it finds it, it can connect and update the configuration files. This way I do not have to manually update the configuration files of the range extender or use the web ui of the range extender.

Thoughts?

Re: SSH Client

Posted: Wed Mar 08, 2017 3:08 am
by WiFive
Not sure what the advantage of using the esp32 for this is over a script on an android phone or something.

Re: SSH Client

Posted: Wed Mar 08, 2017 4:22 am
by ESP_Sprite
We do not have anything out of the box, but maybe you can give porting LibSSH or LibSSH2 a try?

Re: SSH Client

Posted: Thu Mar 09, 2017 9:07 am
by spiramirabilis
Does the extender support TLS over telnet? Thats probably a lot easier to get working quickly.

Re: SSH Client

Posted: Fri Mar 10, 2017 2:59 pm
by gregstewart90
They do support telnet, but I am not sure about TLS over telnet. I'll have to confirm. If so, should I use a library like this one?
https://github.com/seanmiddleditch/libtelnet

How exactly do I get the LibSSH or LibSSH2 library to work on the ESP32? Or any external library for that matter? I use eclipse and code in c.

Re: SSH Client

Posted: Fri Mar 10, 2017 3:03 pm
by preetam
This might help you viewtopic.php?t=815

Re: SSH Client

Posted: Tue Mar 14, 2017 7:14 pm
by gregstewart90
I followed the example you gave, and it worked for the mongoose. When I tried to do the same for libssh, I ran into issues.

I created a directory in my project directory called components, cloned libssh into the components directory, added the file component.mk, and included the library in my project main.c.

Code: Select all

mkdir components
cd components
git clone git://git.libssh.org/projects/libssh.git libssh
cd libssh
nano component.mk //File contains one line: COMPONENT_ADD_INCLUDEDIRS=.
When I include the <libssh/libssh.h> library, the compiler says No such file or directory.

Inside the libssh directory I cloned, I found an include directory. I changed my #include <libssh/libssh.h> to #include <include/libssh/libssh.h>. Now the compiler says:

Code: Select all

fatal error: sys/select.h: No such file or directory
Any ideas? Do I need to build libssh first? If so, how do I build it for the esp32 and include it?

Thanks

Re: SSH Client

Posted: Thu Jun 08, 2017 5:39 pm
by gregstewart90
This post uses libssh2. It works for needs

Re: SSH Client

Posted: Sun Jul 21, 2019 8:49 am
by J-Rios
Here is an Arduino library that implements an SSH client using libssh2:

https://github.com/J-Rios/Arduino-esp32sshclient


It also can be used from ESPIDF Framework too.

Re: SSH Client

Posted: Wed Sep 18, 2019 4:35 am
by phando
I am looking to have an ESP32(client) establish an SHH session and send commands to another system.
When using the lib above and running any of the examples, my ESP32s keep failing to connect in the lets_handshake function.

Code: Select all

int8_t ESP32SSHCLIENT::lets_handshake(void)
I figure it is because the initial connection needs to establish authenticity of the connection. The lines below are what's in the terminal when trying to connect to my SSH server manually.

Code: Select all

The authenticity of host '192.168.1.25 (192.168.1.25)' can't be established.
ECDSA key fingerprint is SHA256:sgeYqimuwjN1Jp/bKelxHjbQKPUIGCt0UYjmSCcmwoo.
Are you sure you want to continue connecting (yes/no)?
Can I introduce a known hosts in the SPIFFS?
Is there a way to say yes to the the initial handshake?
Do any of you have a working example on an ESP?
Do any of you have an example using the longer connect command? I am unsure of the syntax for that connect call.

Code: Select all

 int8_t connect(const char* host, const uint16_t port, const char* user, uint8_t* pubkey, 
 	size_t pubkeylen, uint8_t* privkey, size_t privkeylen, const char* key_passphrase);
Thanks!