Closed Bug 878972 Opened 11 years ago Closed 7 years ago

Write a ssh client using TCP sockets (Port ssh client?)

Categories

(Firefox OS Graveyard :: General, enhancement)

All
Gonk (Firefox OS)
enhancement
Not set
normal

Tracking

(b2g18?)

RESOLVED WONTFIX
Tracking Status
b2g18 ? ---

People

(Reporter: gkw, Unassigned)

References

Details

(Keywords: feature)

I was chatting with Fabrice in-person, and it would be nice to have a bash shell (or shell of some sort) present in Firefox OS, by ssh'ing into localhost.

This will be a nice prerequisite to having the entire toolchain (gcc/clang) on it, then compiling Firefox OS on Firefox OS, and debugging Firefox OS on Firefox OS. Especially since we might have Firefox OS on laptops:

https://blog.mozilla.org/ligong/2013/06/03/foxconn-joins-the-firefox-os-eco-system/


We could also ssh into remote hosts, for that matter. There is a FireSSH (Firefox add-on) at:

https://addons.mozilla.org/en-us/firefox/addon/firessh/

that might be useful.
If there's some way I can help, let me know ^_^
We (with some others peoples) have made a pad to shape that :) https://etherpad.mozilla.org/UiQA0T4Xer
My solution using 'Anyterm': https://support.mozilla.org/de/questions/1006954
Temporary solution using webshell, which offers onscreen keyboard and functions:
http://piie.net/index.php?section=firefoxos
I would like to start working on this. Can someone please suggest the next steps?
I came across this @https://github.com/Mozilla-Student-Projects/Projects-Tracker/issues. I have reached out to Yoric and Antoine also in this regard..
I'm still available to help out - I can't work on it fulltime as I'm occupied with my main job but I will gladly assist in anyone who wants to take point and lead the effort.
I've got a SSH Client working; It needs some code cleanup before it's ready, though.
@David, is up on github?  I'd be happy to help.
https://github.com/chuckwagoncomputing/fxos-firemote

Things that need to be done:
(1) The UI for saved servers and settings was kind of thrown together; it might be worthwhile to switch to a card-based design.
(2) Someone with more IndexedDB experience than I ought to look over the DB code and ensure that it is AOK.
(3) I cut public key auth out of paramikojs (https://github.com/chuckwagoncomputing/paramikojs); and copy, paste, and keyboard shortcuts out of cli.js. They are completely functional, but ought to be checked over for unused code.
(4) Comments.
Depends on: 1117182
I bring you good news that will cause great joy for (hopefully) all the fxos-ers in need of an SSH-client: After installing FXOS 2.6 I found it working again \o/

Device: Flame
Platform Version: 45.0a1
Build Identifier: 20151105150203
Tested with App: https://github.com/chuckwagoncomputing/fxos-firemote

Can anyone confirm?

If this is a stable status I'll get rid of Android at last.
Thanks a lot! 

cc https://bugzilla.mozilla.org/show_bug.cgi?id=1117182 done
@David thanks for taking this on - I'm glad you took the time to make something useful for FxOS

> (3) I cut public key auth out of paramikojs (https://github.com/chuckwagoncomputing/paramikojs); and copy, paste, and keyboard shortcuts out of cli.js. They are completely functional, but ought to be checked over for unused code.

Couple items I noticed off the bat:
- afaict, you don't keep a list of known hosts anymore and just accept the server without giving the user a view of the hash and the option to reject the server when logging onto it for the first time...
- knownhosts - "Unknown Keys" is necessary so that you don't clobber entries you don't know how to parse
Public Key support, see also https://github.com/paramiko/paramiko/issues/435
- Why no RSA Key support?
- You can remove the SFTP support I suppose but I imagine somebody will ask for support on FxOS soon enough.  Goes along with my next comment.

In general, it's a little tough to review your code changes since the changes weren't made to the upstream paramikojs library.  Was there a reason that your changes couldn't be integrated with the existing library, to improve it and so that your code stays in sync as security issues and bugs arise?  Much like the original Python Paramiko library it's meant to be versatile and useful in a variety of situations - I would have rather that the base library stay centralized vs. forking.  Some clarity on your decision there would be helpful. Were there changes that were truly hard breaking FxOS?

Briefly on the code surrounding ParamikoJS:
You're using code like document.getElementById('servers').innerHTML which is a poor idea all around.  The major concern there is that somebody could inject something malicious.  Afaict, it currently is perhaps 'fine' - but that opens up a vector in the future if somebody accidentally adds other unknown/unsafe content.

Also, it's impossible to review your code outside of ParamikoJS since it was mass added in a commit called 'add code': https://github.com/chuckwagoncomputing/fxos-firemote/commit/8545195825e534693dedaf29fe77842da3ff8082
I cannot therefore look to see what the differences are to help you see if there are any problems that might be there.  So for example, if I wanted to see if there was anything in cli.js that you added (that might also be useful upstream) or that might be problematic it would be a very manual process right now. 
One idea might be to start with a fork and add commits from there. 

Hope that helps.
Thanks Mime. This is the kind of critique I need.
1. I plan on adding known hosts back in.
2. I'm working on Public Key support.
3. I may/should add SFTP support back in.

My reason for cutting away non-basic features was to make it simpler to get a working, basic SSH app. In hindsight it may have not been such a good idea.

What is a good clean method of manipulating the markup from JS?

Regarding "add code.": I guess I haven't learned my lesson yet.

Thanks again for the help.
There appears to be another bug with Firemote that Nino Vranešič found while testing so ETA for publishing is probably two weeks at least, depending on how much spare time I can find.
Yeah, no problem.  Sorry for my delay actually in giving feedback in the first place. :-/

> What is a good clean method of manipulating the markup from JS?

Well, it's slightly more cumbersome but you can generate the html by doing 
document.createElement('div') and setting the `textContent` property when appropriate.  You can also get fancier using new Web Components <template> : https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template

> Regarding "add code.": I guess I haven't learned my lesson yet.

I'm still learning as well fwiw!  No worries, mate.

> There appears to be another bug with Firemote that Nino Vranešič
> found while testing so ETA for publishing is probably two weeks at
> least, depending on how much spare time I can find.

Ok, gotcha.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.