8

I'm interested how I can use Apache Felix with SSH? I want to access Felix shell from remote computer using SSH. I know that there is a telnet support but it's too unsafe. Is there any solution?

uraimo
  • 19,081
  • 8
  • 48
  • 55
Peter Penzov
  • 1,126
  • 134
  • 430
  • 808

1 Answers1

4

Yes, there is one, as described here (the guide is relative to eclipse's equinox but it doesn't matter) using a combination of gogo shell, apache mina sshd server and three equinox console bundles (core+ssh plugin+jaas plugin for ssh authentication) you will be able to connect to mina's ssh server and your commands related to OSGi will be executed by the gogo shell.

You'll need these bundles:

  • GoGo Shell: org.apache.felix.gogo.command.jar, org.apache.felix.gogo.runtime.jar, org.apache.felix.gogo.shell.jar
  • Equinox console Bundles: org.eclipse.equinox.console.jar, org.eclipse.equinox.console.supportability.jar, org.eclipse.equinox.console.jaas.fragment.jar
  • Apache Mina: org.apache.mina.core.jar, org.apache.sshd.core.jar
  • And for logging slf4j-api.jar and a slf4j-api_impl.jar

As described here, you will also need these properties in your Felix configuration file:

osgi.console.enable.builtin=false 
osgi.console.ssh=<port> 
osgi.console.ssh.useDefaultSecureStorage=true 

The equinox JAAS bundle will search for a org.eclipse.equinox.console.authentication.config file, that will enable the login module:

equinox_console { 
    org.eclipse.equinox.console.jaas.SecureStorageLoginModule REQUIRED; 
}; 

I'm not quite sure where this will be searched using Felix (i'm not sure this is done in a standard OSGi way), but the conf directory is a good guess.

The user equinox/equinox will already be present, other users can be created with the console commands provided.

Edit: For the equinox console/supportability bundle you can get the Mars release from here expanding the section Add-on Bundles:

org.eclipse.equinox.console_1.1.100.v20141023-1406.jar

You'll also need the supportability bundle that you can get from here(the last version is from 2011).

uraimo
  • 19,081
  • 8
  • 48
  • 55
  • I managed to create this https://www.dropbox.com/s/rkd9phus29yb3dd/server.zip?dl=0 but I get this errors: http://pastebin.com/XhihQDcb – Peter Penzov Jun 25 '15 at 07:17
  • `missing requirement [org.apache.mina.core [1](R 1.0)] osgi.wiring.package; (&(osgi.wiring.packa ge=org.slf4j)` you need the slf4j jars, used for logging. – uraimo Jun 25 '15 at 08:16
  • I fixed this problem. https://www.dropbox.com/s/a7gyz1bd29yhan7/server_2.rar?dl=0 But there is a new issue: `org.osgi.framework.BundleException: Unable to resolve org.eclipse.equinox.console` – Peter Penzov Jun 29 '15 at 08:57
  • For every "unable to resolve"/"missing requirement" you have to install the jar of the library that contains that package, in that case the equinox console bundle `org.eclipse.equinox.console.jar`. It's a bit hard to find, i'm updating my answer. – uraimo Jul 01 '15 at 06:45