My personal views, thoughts and opinions.

Wednesday, June 15, 2011

Apache Gogo and SSH in Eclipse Virgo

Step 1: Download Gogo shell
To run the Gogo you will need three bundles from Apache Felix downloads:

Step 2: Equinox and RFC-147
To enable  RFC-147 integration in Equinox you will need some console supportability features that are provided by the Console supportability project in Equinox Incubator.

Download the Incubator build that includes the bundle we'll need. Extract only the supportability JAR (org.eclipse.equinox.console.supportability) from plugins folder.

Step 3: Enabling SSH Support
First download Apache Mina's binary distribution for SSHD, and then from the lib directory of the archive extract these two bundles:
  • sshd-core
  • mina-core

Step 4: Setting up Virgo
  • Copy the console supportability bundle (org.eclipse.equinox.console.supportability) in lib directory
  • Place the rest of the bundles (3xGogo, SSHD and Mina) in lib/kernel directory
  • Edit config/ file and add the bundles to base bundles list:
baseBundles = \
  • In lib/ remove the old Virgo shell  by deleting the line org.eclipse.virgo.osgi.console.telnet.hook.TelnetHookConfigurator. The hooks entry should look like this afterwards:

  • Delete (or move outside lib) the bundle lib/org.eclipse.virgo.osgi.console-3.0.0.M05.jar
Step 5: Configuring Virgo
  • Comment or delete osgi.console property in lib/
  • Add the following property entries to lib/
  • Add in config/org.eclipse.virgo.kernel.authentication.config file JAAS configuration for the SSH:
equinox_console { 
    org.eclipse.equinox.console.jaas.SecureStorageLoginModule REQUIRED; 
  • Edit the bin/dmk.bat or bin/ file to add org.eclipse.equinox.console.jaas.file and ssh.server.keystore VM system properties. After the changes the file should look as follows: 
set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% -Dorg.eclipse.virgo.kernel.authentication.file="%CONFIG_DIR%\"
set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% -Dorg.eclipse.equinox.console.jaas.file="%CONFIG_DIR%/store"
set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% -Dssh.server.keystore="%CONFIG_DIR%/hostkey.ser"

Step 6: Connecting to Virgo
Fire your favourite SSH client on the specified port (2422 for instance).
  • Login with the default user and password (equinox/equinox) 
  • Create a new user and password

Step 7: Fun with Gogo
Check the features provided by GoGo and Equinox Console Supportability:
  • Tab Completion / Line editing
  • Built-in commands like lb, ls, cat to name a few
  • Create some scripts
  • Create some commands using RFC-147

Step 8: Disconnecting

Do not use "exit" since this will exit Virgo/OSGi framework. To end the session you'll have to close the console window. There is no command to close the session currently.

Google+ Followers