View Single Post
Old 11-17-2010, 05:15 AM   #1
vdp is clearly one to watchvdp is clearly one to watchvdp is clearly one to watchvdp is clearly one to watchvdp is clearly one to watchvdp is clearly one to watchvdp is clearly one to watchvdp is clearly one to watchvdp is clearly one to watchvdp is clearly one to watchvdp is clearly one to watch
Posts: 39
Karma: 10842
Join Date: Aug 2010
Device: Kindle DXG
KindleTERM - a SSH client kindlet


I wrote a quick and dirty hack based on the MidpSSH J2ME SSH/telnet client, to make it run on Kindle. Well, I am somewhat hesitant on the 'quick' part, since it took me a good amount of time during the last 3 weeks, but it is certainly dirty . You can find the git repo on GitHub.

Thanks to Andrew de Quincey for making possible writing kindlets without the highly restricted Amazon development kit.

I've only had the opportunity to test it on my Kindle DXG, so I don't know how well it performs on other models.

I will describe the installation process in case someone is willing to try it.

The usual disclaimer applies: You should not take the steps described below unless you are comfortable about messing with your device and potentially bricking it. DO IT ON YOUR OWN RISK - if something goes wrong I will probably not be able to help you.

1) Copy the developer.keystore in /var/local/java/keystore directory. I wanted to use the AdQ's keystore used for KIF but unfortunatelly Ant's signjar task fails with message:

[signjar] jarsigner: Certificate chain not found for: dkadq.  dkadq must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.
I am not all that familiar with the Java keystores so I am not sure yet what the problem is.
If someone have an idea how to fix it you are wellcome.

2) The Kindle framework's sandbox should be relaxed somewhat to allow SSH connections.
In /opt/amazon/ebook/security/external.policy after "grant signedBy "Kindlet" {" add the lines
permission "localhost:1024-", "accept, connect, listen";
permission "", "connect, accept";
permission "localhost", "connect, accept";
These changes permit connections to the kindlet, and from the kindlet to the localhost and usbnet host ip. Perhaps here is the place to say (as already mentioned by others on this forum) that the Amazon 3G access should be considered privilege rather than right, so I will not support any attempts to exploit the free 3G.

3) Copy the KindleTERM.azw2 to the 'documents' directory.

Known bugs and limitations:

- I am not sure if this is the case if you only make connections to the kindle (localhost), but I discovered that the connections from Kindle to other hosts are automatically disconnected after 2 or so minutes. If you want to prevent this you should stop netwatchd daemon.
/etc/init.d/netwatchd stop
- MidpSSH tries to emulate a DEC vt320 terminal. It seems that it is not that common type of terminal so neither my Ubuntu 9.04 nor the Kindle have a terminfo description. I tried different terminfo files (e.g. the one from none of them work as it should for example in VIM. Don't know if the reason is the imperfect emulation in terminal.VT320 class, the way I use it in kindle.KindleTerminal or terminfo entries needs tweaking. Every help on this issue is very wellcome.

- Key events handling is far from perfect. For example there is still no way to emulate "TAB" on the device's keyboard. It should be trivial to fix though. I implemented also a "remote keyboard" feature - the kindlet listens to port 3333 for key events. On the host machine you can start:
java -cp KindleTERM.azw2 kindle.RemoteKeyboard
and the keys you press when it's window is on focus are relayed to the kindlet.
It needs a java property file, named in the current working directory:
port 3333
This feature is a potential security hole if you use it on a WiFi-enabled Kindle, so you should change your firewall accordingly.

- If you choose to save session info it is saved in plain text in the kindlet's 'work' directory so it is a security risk also.

Last edited by ixtab; 10-09-2013 at 05:02 AM.
vdp is offline   Reply With Quote