Embedded SSH terminal - Page 1
Forum section: electronics / projects

author: Dajgoro
author_rank: Frequent Contributor
timestamp: October 14, 2014, 05:46:36 pm
content: Hi.I am wondering how difficult would it be to have a microcontroller connect to a SSH shell on some linux machine.So if I would have some mcu, and some ethernet module such as a Wiznet chip, how hard would it be to implement the SSH client protocol? Or is there another better way of doing this, without cheating with raspberry pi, and similar embedded linux machines?

author: rob77
author_rank: Super Contributor
timestamp: October 14, 2014, 06:40:19 pm
content: you would need a hell of a powerful micro-controller to do the encryption, and of course porting openssh to a micro-controller would be impossible - so you would have to write your own implementation of ssh protocol and client.embeded linux is the way to go if you need ssh.

author: Dajgoro
author_rank: Frequent Contributor
timestamp: October 14, 2014, 06:55:49 pm
content: Quote from: rob77 on October 14, 2014, 06:40:19 pmHmm, I feared that...

author: Jeroen3
author_rank: Super Contributor
timestamp: October 14, 2014, 07:04:55 pm
content: There are SSL libraries available for microcontrollers, some even have aes and other crypto modules.Since there are openssh variants for the bigger arms (your phone for example), porting it isn't impossible. Running it might be.

author: electronic_eel
author_rank: Regular Contributor
timestamp: October 14, 2014, 07:51:20 pm
content: Don't try to port openssh to a µc. There is dropbear which is a stripped down ssh client & server, e.g. the guys at openwrt use it a lot. But still if you don't have all the libs and interfaces of a linux it isn't going to be easy.IIRC there is a commercial ip and networking lib targeted at µCs which has ssh2 support. But don't remember what the name or development company was. I did not end up using it but switched to a small Linux based solution for the project. Just search for commercial µC ip stacks and you'll probably find it.

author: SirNick
author_rank: Frequent Contributor
timestamp: October 14, 2014, 08:19:50 pm
content: I've been thinking about this recently -- that is, trying to find the smallest software stack necessary to get SSH, and what level of MCU would be required to run it. Basically, you can forget anything 8-bit. You need a Cortex M3, equivalent, or better to even make a worthwhile attempt. You will run into RAM issues unless you have a really well-endowed micro, or opt for external memory.This is definitely the domain of an RTOS if not ucLinux if not embedded Linux. PolarSSL looks like a good alternative to OpenSSL, being designed for the restrictions of an embedded platform, but I haven't gotten far enough to try it out myself.That's about as much as I can contribute for the moment. Hopefully that's enough for you to decide whether you want to bother pursuing it.

author: nctnico
author_rank: Super Contributor
timestamp: October 14, 2014, 10:09:29 pm
content: I've tried PolarSSL but it is a bitch to get running. Even on a 60MHz ARM7TDMI it can take several seconds for the first response to appear. 64kB of RAM is barely enough. You need a BSD style TCP/IP socket layer and implement malloc, realloc and free. An RTOS which time slicing is a good thing to have because PolarSSL will block for considerable amounts of time. Time slicing also means the TCP/IP stack needs to be thread safe.

author: Dajgoro
author_rank: Frequent Contributor
timestamp: October 14, 2014, 10:18:42 pm
content: What would be the easiest way to get a small embeddded linux device working, without using raspberries and similar stuff, something like this:http://www.opencircuits.com/Linuxstamp#Description

author: Paul Moir
author_rank: Frequent Contributor
timestamp: October 14, 2014, 10:38:23 pm
content: There are a bunch of those sort of things on the market. I've used ones from ledato.de but there's lots of others. Beaglebone black, taskit etc. But one common fault you'll find on them is data corruption on power loss. I've gotten around it by using a read-only filesystem, so if that's important and getting up quickly is important try to find a device that has a pre-built read only or otherwise power loss safe distribution. Either that or you get into a UPS.Coincidentally I've used a Raspberry Pi in an embedded application because there's a read only filesystem / blackout safe distribution out there (Industrial Perennial Environment).(EDIT: I think I'm misunderstanding you. Do you mean to just build something like that? It's pretty easy, they have the schematics and everything else you need to copy it there.)

author: nctnico
author_rank: Super Contributor
timestamp: October 14, 2014, 11:26:00 pm
content: I think it is a though job either way mostly because of the software. PolarSSL isn't free for commercial use BTW. I have built Linux devices which use a read-only filesystem based on busybox/buildroot. I have not been able to wreck that by switching it off/on randomly (using a modulated function generator).The shortest route is to get a device like the Linuxstamp but I don't like the slow processor and the 2 layer PCB and there will be some time spend on adding extra software through busybox/buildroot.

author: Seg
author_rank: Regular Contributor
timestamp: October 15, 2014, 12:30:57 am
content: If you have to ask... anything that runs Linux will do it. Busybox, uclibc and dropbear. I did it in 2006 on a belkin router with 2mb flash and 8mb RAM.

author: rob77
author_rank: Super Contributor
timestamp: October 15, 2014, 04:45:37 am
content: Quote from: Jeroen3 on October 14, 2014, 07:04:55 pmssl alone for micros is possible (for example used in secure web - https) but ssh is a different story.and there is no micro-controller in your phone with opensshthat bigger arm is a full-blown processor with MMU and lot's of memory.

author: SirNick
author_rank: Frequent Contributor
timestamp: October 15, 2014, 10:28:22 pm
content: Quote from: nctnico on October 14, 2014, 10:09:29 pmHm, good to know. FWIW, they have their own IP stack as well, so it might be a more turn-key solution if you haven't already committed to uIP or whatever.

author: ve7xen
author_rank: Super Contributor
timestamp: October 15, 2014, 11:56:02 pm
content: CryptLib is ported to several RTOS and includes an SSH client/server implementation. I assume it would work if it fits, it should be pretty lightweight but I haven't tried it.https://www.cs.auckland.ac.nz/~pgut001/cryptlib/