Karaf
Karaf is one of the central system components for the BPC. It is open-source software from the Apache Software Foundation
The software documentation can be found here.
A preconfigured version of Apache Karaf is provided as part of the BPC installation.
Configuration
Target Configuration for Karaf
By default, the Karaf configuration is located in the directory <BPC-INSTALL-DIR>/karaf/etc.
During a Karaf update, this directory may be replaced or expanded with new default configurations.
Therefore, it is recommended that you avoid making customer-specific adjustments directly in the Karaf`etc` files whenever possible, and instead set them via the central configuration file bpc.env.sh or bpc.env.cmd.
Environment variables can be used to selectively override individual values from Karaf configuration files.
This makes customizations more update-friendly and eliminates the need to manually transfer them to new etc files during a Karaf update.
For configurations that cannot be set appropriately using individual environment variables, it may be useful to store files outside the Karaf installation and reference them from the central configuration file.
An example of this is customizing the ` jetty.xml`.
For more information, see Overriding Values from etc Files and Customizing jetty.xml.
|
The Karaf Service Wrapper does not take the central |
Memory (RAM)
The amount of memory allocated to Karaf is set via the environment variable EXTRA_JAVA_OPTS.
This environment variable is also used when employing central configuration via bpc.env.sh.
For OpenSearch, however, the environment variable OPENSEARCH_JAVA_OPTS is used.
Please also refer to the RAM examples for the available hardware under System Requirements.
Console
You can check the current system status via the Karaf console. In addition, configurations can be viewed and adjusted directly.
|
A Karaf Console Commands Cheat Sheet is available for frequently used Karaf console commands. |
Access
Access to the console is possible both locally and remotely.
Authentication takes place via Karaf user accounts.
The predefined "admin" role can log in, but comprehensive administrative tasks can only be performed in combination with additional roles.
These roles are grouped together in the predefined group g:admingroup.
For detailed information, see Apache Karaf Documentation - Security.
Karaf Client
In the Karaf directory, under bin/client (or bin/client.bat for Windows), there is a client for the console.
This client enables both local and remote access to the console.
See also Apache Karaf Documentation - Connect.
SSH
The Karaf console is also available directly via the SSH protocol.
Unless otherwise configured (see Central configuration file), port 8101 is available for this purpose.
External Access via SSH
By default, SSH access is restricted to the host localhost.
If it is necessary to make Karaf accessible via external connections, this can be done by adjusting the setting org.apache.karaf.shell.sshHost.
The value 0.0.0.0 allows connections from all IP addresses.
The change can be made either via the configuration file <BPC-INSTALL-DIR>/karaf/etc/org.apache.karaf.shell.cfg, the Karaf console, or the central configuration file.
We recommend using the central configuration file. To do this, enable the line that is commented out by default:
-
Unix systems
-
Windows systems
export ORG_APACHE_KARAF_SHELL_SSHHOST=0.0.0.0
SET ORG_APACHE_KARAF_SHELL_SSHHOST=0.0.0.0
If you also need to adjust the SSH port, use the central configuration file as well. You can find an example under Setting the SSH Port.
|
For optimal security, always use the most restrictive settings that still allow your workflow. |
Access Using the Private/Public Key Method
Follow these steps:
-
Creating the Key Pair:
Run the following command to create a new key pair. Alternatively, you can use an existing key pair.
ssh-keygen -t rsa -f karaf.id_rsa -
Enter the public key in
keys.properties.
The filekeys.propertiesin the<BPC-INSTALL-DIR>/karaf/etcdirectory allows you to assign an SSH key to a user. User-key pairs are defined in the following format:user=key,rolekeys.propertiesFile containing the SSH public keyvirtimo=<SSH-Public-Key>,_g_:admingroup _g_\:admingroup = group,admin,manager,viewer,systembundles,sshIf the file’s syntax is not followed, authentication will fail and a connection cannot be established.
Make sure the SSH public key does not contain any spaces.SSH access requires the role
ssh. Ensure that the user in question is assigned this role either directly or through a group.
-
Establish an SSH connection:
ssh -p 8101 -i karaf.id_rsa virtimo@localhost
Access with Username/Password
As an alternative to the public/private key method, authentication can also be performed using a username and password.
To do this, use the file users.properties in the <BPC-INSTALL-DIR>/karaf/etc directory.
Follow these steps:
-
Add the user and password to
users.properties. See Using users.properties for Karaf Access. -
Ensure that the added user is assigned the role
ssh. -
Establish a connection via SSH. Here is an example using the user
virtimo:
ssh -p 8101 virtimo@localhost
|
For detailed information, see the Apache Karaf Documentation - Security. |