Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
APACHE KARAF COOKBOOK

You're reading from   APACHE KARAF COOKBOOK Over 60 recipes to help you get the most out of your Apache Karaf deployments

Arrow left icon
Product type Paperback
Published in Aug 2014
Publisher
ISBN-13 9781783985081
Length 260 pages
Edition 1st Edition
Tools
Arrow right icon
Toc

Table of Contents (12) Chapters Close

Preface 1. Apache Karaf for System Builders FREE CHAPTER 2. Making Smart Routers with Apache Camel 3. Deploying a Message Broker with Apache ActiveMQ 4. Hosting a Web Server with Pax Web 5. Hosting Web Services with Apache CXF 6. Distributing a Clustered Container with Apache Karaf Cellar 7. Providing a Persistence Layer with Apache Aries and OpenJPA 8. Providing a Big Data Integration Layer with Apache Cassandra 9. Providing a Big Data Integration Layer with Apache Hadoop 10. Testing Apache Karaf with Pax Exam Index

Reconfiguring SSH access to Apache Karaf

Using Apache Karaf via its local console provides the user with superb command and control capabilities over their OSGi container. Apache Karaf's remote console extends this experience to remote consoles, and as such, presents systems builders with an opportunity to further harden their systems. In this recipe, we'll change Karaf's default remote connection parameters.

Getting ready

The ingredients of this recipe include the Apache Karaf distribution kit, access to JDK, and a source code editor. The sample configuration for this recipe is available at https://github.com/jgoodyear/ApacheKarafCookbook/tree/master/chapter1/chapter1-recipe6.

How to do it…

  1. The first step is editing the shell configuration. Apache Karaf ships with a default shell configuration file. It's a good practice to edit entries in the etc/org.apache.karaf.shell.cfg file to point to the non-default ports as a security precaution. Consider the following code:
    #
    # Via sshPort and sshHost you define the address you can login into Karaf.
    #
    sshPort = 8102
    sshHost = 192.168.1.110

    In the preceding sample configuration, we defined the port for SSH access to 8102 and set sshHost to an IP address of the host machine (the default value, 0.0.0.0, means the SSHD service is bound to all network interfaces). Restricting access to particular network interfaces can help reduce unwanted access.

  2. The next step is restarting Karaf. After editing the configuration, we must restart Karaf. Once restarted, you'll be able to connect to Karaf using an SSH client command as follows:
    ssh –p 8102 karaf@127.0.0.1
    

    Upon connection, you'll be prompted for your password.

There's more…

Changing the default remote access configuration is a good start. However, system builders should also consider changing the default karafuser/password combination found in the users.properties file.

You might also decide to generate a server SSH key file to simplify remote access. Information regarding this configuration can be found at http://karaf.apache.org/manual/latest/users-guide/remote.html.

You have been reading a chapter from
APACHE KARAF COOKBOOK
Published in: Aug 2014
Publisher:
ISBN-13: 9781783985081
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime