2014年6月1日 星期日

Launch DroidSSh as service on CyanogenMod

       I am find the way that launch the sshd as service for long time, I hope the sshd will not been destroy while system low memory while launch as service, it need more exam. Even the CyanogenMod build in the sshd, but I'm bad luck ... it show me "Segmentation fault" or "void endpwent()(3) is not implemented on Android" on my two difference device, finally I found the easiest way for the goal.

The DroidSSH is always stable on my two device, it never complain any problem to me, it is a option of my goal and it is only success of my trying, ok let beginning.

1. Install the DroidSSH from Google Play and launch it, it will spend more time at first run, the others procedure you may setting your device with DroidSSH or your terminal emulation.

2. Create the directory /data/local/userinit.d
3. Create file /data/local/userinit.d/90sshd and edit it.
4. paste the contents bellow



# ================ start ===================
#!/system/bin/sh

umask 077
/data/data/berserker.android.apps.sshdroid/dropbear/dropbear -H /data/user -Y "PASSWORD" -S -p 22 -r /data/data/berserker.android.apps.sshdroid/dropbear/dropbear.key.rsa -d /data/data/berserker.android.apps.sshdroid/dropbear/dropbear.key.dss

#================= end ===================

 5. Change the permission and group

chmod 755 /data/local/userinit.d/90sshd
chgrp shell /data/local/userinit.d/90sshd


 Ok, it finish, reboot your device, it will start as service.


Note: 
1. -H mean the home directory of user.
2. -Y specify the password, you should change it.


My reference:

2014年5月26日 星期一

Port Jetty to android launch from dalvikvm


There is a project named i-Jetty that you can install from google play, and another droidSSH let you control your android device remote, the two app can make your old android device to become a server. In general, the android app will be release if system busy, low memory or in deep sleep, it mean you will lost SSH control if Http service busy from i-jetty, another reason why I port it to launch by native dalvikvm is no log in i-Jetty interface.

I download the source of Jetty-8.1.15 and import to android sdk to see what are not support by android system, that is what I found:

  • The following package not support by android.
    • javax.annotation: it parse annotation something like @ServletFilter(urlPatterns={"/myurl"} in your servlet code.
    • javax.naming:  see document
    • java.lang.management: see document
  •  The KeyStroe provider not support from dalvikvm launcher.
    • Neither JKS or BKS keystore provider exist: It support SSL connection object(which make HTTPS connection) need the provider.
    • I found the keystore.so in android system, it may a hint for you.



there is my package file, it not support HTTPS although the package are include, so don't use it in bank systems ...