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/org.eclipse.virgo.kernel.userregion.properties file and add the bundles to base bundles list:
baseBundles = \
 file:lib/kernel/org.eclipse.virgo.kernel.userregion-3.0.0.M05.jar@start,\
 file:lib/kernel/org.eclipse.virgo.kernel.osgicommand-3.0.0.M05.jar@start,\
 file:lib/kernel/mina-core-2.0.1.jar@start,\
 file:lib/kernel/org.apache.felix.gogo.command-0.8.0.jar@start,\
 file:lib/kernel/org.apache.felix.gogo.runtime-0.8.0.jar@start,\
 file:lib/kernel/org.apache.felix.gogo.shell-0.8.0.jar@start,\
 file:lib/org.eclipse.equinox.console.supportability_1.0.0.N20110608-2000.jar@start,\
 file:lib/kernel/sshd-core-0.5.0.jar@start
  • In lib/org.eclipse.virgo.kernel.launch.properties 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:

    osgi.hook.configurators.include=\
     org.eclipse.virgo.osgi.extensions.equinox.hooks.ExtensionsHookConfigurator
  • 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/org.eclipse.virgo.kernel.launch.properties:
#osgi.console=2401
  • Add the following property entries to lib/org.eclipse.virgo.kernel.launch.properties:
osgi.console.ssh=2422
osgi.console.enable.builtin=false
osgi.console.ssh.useDefaultSecureStorage=true
  • 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/dmk.sh 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%\org.eclipse.virgo.kernel.users.properties"
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"
set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% -Djava.io.tmpdir="%TMP_DIR%"
 


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.

id_rsa.pub: invalid format, error in libcrypto

After I upgraded my Linux and got Python 3.10 by default, it turned out that Ansible 2.9 will no longer run and is unsupported together with...