Apache Karaf
Overview
Apache Karaf is a modern, polymorphic OSGi-based application and runtime container from the Apache Software Foundation (Apache-2.0). It provides hot deployment, dynamic configuration, a rich provisioning system and a powerful SSH management console for running modular Java applications and microservices.
The SecureAnyCloud image ships Karaf 4.4.11 as a single systemd service on OpenJDK 17. The stock karaf/karaf default login is never shipped. A unique console credential is generated on the VM's first boot, so no two deployments share a password and nothing is baked into the image.
What you get:
- Apache Karaf 4.4.11 (pinned, SHA-256 verified binary distribution, Apache-2.0) at
/opt/karaf. - OpenJDK 17 (
openjdk-17-jdk-headless) as the Java runtime. - Karaf SSH management console on TCP
8101. - A per-VM
karafconsole credential, rotated at first boot intoetc/users.properties. - The default
karaf/karafcredential removed, with wrong-credential logins rejected. apache-karaf.servicerunning as an unprivilegedkarafuser.- Hardened Ubuntu 24.04 LTS base, patched at build time.
- 24/7 SecureAnyCloud support.
Prerequisites
- An Azure VM launched from this SecureAnyCloud image (recommended size Standard_B2s or larger).
- A network security group (NSG) allowing inbound TCP 22 (SSH) and TCP 8101 (Karaf console) from only the admin networks that need them.
- SSH access as
azureuser. sshpassor an SSH client on your workstation to reach the Karaf console.
Restrict TCP 8101 in your NSG to your administrative subnets. Do not expose the Karaf console to the whole internet.
Verify Karaf is running
SSH in as azureuser. Confirm that the service is active and the console is listening on 8101. Karaf takes about 30-60 seconds to fully start on first boot.
sudo systemctl status apache-karaf.service --no-pager -n 0
sudo ss -tln | grep 8101Expected output:
● apache-karaf.service - Apache Karaf OSGi runtime (sac) Loaded: loaded (/etc/systemd/system/apache-karaf.service; enabled; preset: enabled) Active: active (running) since Sun 2026-07-19 08:05:15 UTC; 1min 20s ago Docs: https://secureanycloud.com/stacks/apache-karaf/ Main PID: 2155 (karaf) Tasks: 76 (limit: 4661) Memory: 266.6M (peak: 270.3M) LISTEN 0 50 *:8101 *:*Read the per-VM console credential
The karaf username and its randomly generated password are written to a root-only credentials file at first boot. Read the file:
sudo cat /root/karaf-credentials.txtExpected output. Your password differs because it is unique to this VM:
# apache-karaf — Per-VM Credentials
# Apache Karaf OSGi runtime — administer over the SSH console on port 8101.
# From your workstation (open port 8101 in your Azure NSG first):
# ssh -p 8101 karaf@<your-vm-ip>
# then run e.g. feature:list system:version bundle:list
# KARAF_SSH_USER=karaf KARAF_SSH_PASSWORD=<set-at-first-boot> KARAF_SSH_HOST=<your-vm-ip> KARAF_SSH_PORT=8101Connect to the Karaf console
Use the generated credential to log in to the Karaf SSH console and confirm the runtime version. Run this on the VM itself:
PASS=$(sudo grep '^KARAF_SSH_PASSWORD=' /root/karaf-credentials.txt | cut -d= -f2-) sshpass -p "$PASS" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
-o PreferredAuthentications=password -o PubkeyAuthentication=no \
-p 8101 karaf@127.0.0.1 'system:version'Expected output:
4.4.11To connect from a remote workstation, open TCP 8101 in your NSG first. Then replace 127.0.0.1 with the VM's IP, or use the bundled client: /opt/karaf/bin/client -a 8101 -h <vm-ip> -u karaf.
List installed features and bundles
The Karaf console exposes the full provisioning and bundle model. List the installed features:
PASS=$(sudo grep '^KARAF_SSH_PASSWORD=' /root/karaf-credentials.txt | cut -d= -f2-) sshpass -p "$PASS" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
-o PreferredAuthentications=password -o PubkeyAuthentication=no \
-p 8101 karaf@127.0.0.1 'feature:list -i'Expected output (installed features):
Name | Version | Required | State | Repository | Description -------------+---------+----------+---------+-----------------+------------------------------------ feature | 4.4.11 | x | Started | standard-4.4.11 | Features Support shell | 4.4.11 | x | Started | standard-4.4.11 | Karaf Shell deployer | 4.4.11 | x | Started | standard-4.4.11 | Karaf Deployer bundle | 4.4.11 | x | Started | standard-4.4.11 | Provide Bundle support config | 4.4.11 | x | Started | standard-4.4.11 | Provide OSGi ConfigAdmin support jaas | 4.4.11 | x | Started | standard-4.4.11 | Provide JAAS support log | 4.4.11 | x | Started | standard-4.4.11 | Provide Log support system | 4.4.11 | x | Started | standard-4.4.11 | Provide System support management | 4.4.11 | x | Started | standard-4.4.11 | Provide a JMX MBeanServer ssh | 4.4.11 | x | Started | standard-4.4.11 | Provide a SSHd server on KarafThe default login is rejected
The stock karaf/karaf credential is never shipped. Try to log in with it. The login fails:
if sshpass -p 'karaf' ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
-o PreferredAuthentications=password -o PubkeyAuthentication=no \
-o ConnectTimeout=10 -p 8101 karaf@127.0.0.1 'system:version' 2>/dev/null; then echo 'UNEXPECTED: default credential accepted' else echo 'default karaf/karaf credential correctly rejected' fiExpected output:
default karaf/karaf credential correctly rejectedComponents
Component Path
Karaf home /opt/karaf (link to /opt/apache-karaf-4.4.11)
Users file /opt/karaf/etc/users.properties (mode 0600 karaf:karaf)
Users template /usr/local/share/sac/karaf-users.properties.template
systemd unit /etc/systemd/system/apache-karaf.service
First-boot unit /etc/systemd/system/apache-karaf-firstboot.service
Credentials /root/karaf-credentials.txt (mode 0600 root:root)
Service user karaf (unprivileged, nologin)
Java runtime OpenJDK 17 (/usr/lib/jvm/java-17-openjdk-amd64)
Security hardening
- Restrict the NSG so TCP 8101 only reaches your administrative subnets.
- Add more users by editing
/opt/karaf/etc/users.properties(user = password,_g_:grouplines), or from the console withjaas:commands. Then log in again. - Deploy applications by dropping OSGi bundles or KAR files into
/opt/karaf/deploy, or withbundle:install/feature:installfrom the console. - Enable password encryption in
/opt/karaf/etc/org.apache.karaf.jaas.cfg(encryption.enabled = true) sousers.propertiesstores hashed passwords. - Patch regularly:
sudo apt-get update && sudo apt-get upgrade && sudo reboot.
Licensing
Apache Karaf is distributed under the Apache-2.0 licence by the Apache Software Foundation and is free to use. SecureAnyCloud provides the pre-built, hardened image and commercial support separately. SecureAnyCloud is not affiliated with or endorsed by the Apache Software Foundation. Questions: sales@secureanycloud.com.
Deploy on Azure
Launch Apache Karaf on Ubuntu 24.04 LTS on Azure with 24/7 support from SecureAnyCloud.
View this image
Need Help?
Our support team is available 24/7.
sales@secureanycloud.com
Overview
Apache Karaf is a modern, polymorphic OSGi-based application and runtime container from the Apache Software Foundation (Apache-2.0). It provides hot deployment, dynamic configuration, a rich provisioning system and a powerful SSH management console for running modular Java applications and microservices.
Deploy applications as OSGi bundles or higher-level Karaf features, or drop artifacts into the deploy directory to hot-deploy them. Administer the whole runtime interactively over a secure SSH console.
The SecureAnyCloud image ships Karaf 4.4.11 as a single systemd service on OpenJDK 17. The stock karaf/karaf default login is never shipped. A unique console credential is generated on the instance's first boot, so no two deployments share a password and nothing is baked into the Amazon Machine Image.
What you get:
- Apache Karaf 4.4.11 (pinned, SHA-256 verified binary distribution, Apache-2.0) at
/opt/karaf. - OpenJDK 17 (
openjdk-17-jdk-headless) as the Java runtime. - Karaf SSH management console on TCP
8101. - A per-instance
karafconsole credential, rotated at first boot intoetc/users.properties. - The default
karaf/karafcredential removed, with wrong-credential logins rejected. - A per-instance SSH host key for the console, generated at first boot.
apache-karaf.servicerunning as an unprivilegedkarafuser.- A hardened, fully patched base operating system.
- 24/7 SecureAnyCloud support.
Prerequisites
- An EC2 instance launched from this SecureAnyCloud AMI (recommended type m5.large or larger). Karaf is a JVM runtime, so give it adequate memory.
- A security group allowing inbound TCP 22 (SSH) from your admin network, and TCP 8101 (the Karaf console) opened only to your trusted operator network.
- An SSH client on your workstation, plus
sshpassif you want to script console logins.
The recommended security group opens only SSH (port 22). The Karaf console on TCP 8101 is deliberately not opened to the internet. Add an inbound rule for TCP 8101 scoped to your administrative CIDR only. Never expose the Karaf console to the whole internet.
Connecting to your instance
SSH to the instance as the default login user for the operating-system variant you launched:
OS variant SSH login user
Ubuntu 24.04 ubuntu
ssh ubuntu@<public-ip>Verify Karaf is running
SSH in. Confirm that the service is active and the console is listening on 8101. Karaf takes about 30-60 seconds to fully start on first boot.
sudo systemctl status apache-karaf.service --no-pager -n 0
sudo ss -tln | grep 8101Expected output:
● apache-karaf.service - Apache Karaf OSGi runtime (sac) Loaded: loaded (/etc/systemd/system/apache-karaf.service; enabled; preset: enabled) Active: active (running) since Wed 2026-07-22 04:29:46 UTC; 3min 18s ago Docs: https://secureanycloud.com/stacks/apache-karaf/ Main PID: 2315 (karaf) Tasks: 76 (limit: 4520) Memory: 302.3M (peak: 302.3M) LISTEN 0 50 *:8101 *:*Read the per-instance console credential
The karaf username and its randomly generated password are written to a root-only credentials file at first boot. The file is mode 0600 and owned by root, so only root can read it. Check its permissions:
sudo ls -l /root/karaf-credentials.txt
sudo stat -c 'perms=%a owner=%U:%G' /root/karaf-credentials.txtExpected output:
-rw------- 1 root root 623 Jul 22 04:29 /root/karaf-credentials.txt perms=600 owner=root:rootTo read the generated password, run sudo cat /root/karaf-credentials.txt and keep the password private. The file records KARAF_SSH_USER, KARAF_SSH_PASSWORD, KARAF_SSH_HOST and KARAF_SSH_PORT. Your password is unique to this instance.
Connect to the Karaf console
Use the generated credential to log in to the Karaf SSH console and confirm the runtime version. Run this on the instance itself:
PASS=$(sudo grep '^KARAF_SSH_PASSWORD=' /root/karaf-credentials.txt | cut -d= -f2-) sshpass -p "$PASS" ssh -n -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
-o PreferredAuthentications=password -o PubkeyAuthentication=no \
-p 8101 karaf@127.0.0.1 'system:version'Expected output:
4.4.11To connect from a remote workstation, open TCP 8101 in your security group to your operator CIDR first. Then replace 127.0.0.1 with the instance's IP, or use the bundled client: /opt/karaf/bin/client -a 8101 -h <public-ip> -u karaf.
List installed features and bundles
The Karaf console exposes the full provisioning and bundle model. List the installed features:
PASS=$(sudo grep '^KARAF_SSH_PASSWORD=' /root/karaf-credentials.txt | cut -d= -f2-) sshpass -p "$PASS" ssh -n -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
-o PreferredAuthentications=password -o PubkeyAuthentication=no \
-p 8101 karaf@127.0.0.1 'feature:list -i'Expected output (installed features, abbreviated):
Name | Version | Required | State | Repository | Description -------------+---------+----------+---------+-----------------+------------------------------------ feature | 4.4.11 | x | Started | standard-4.4.11 | Features Support shell | 4.4.11 | x | Started | standard-4.4.11 | Karaf Shell deployer | 4.4.11 | x | Started | standard-4.4.11 | Karaf Deployer bundle | 4.4.11 | x | Started | standard-4.4.11 | Provide Bundle support config | 4.4.11 | x | Started | standard-4.4.11 | Provide OSGi ConfigAdmin support jaas | 4.4.11 | x | Started | standard-4.4.11 | Provide JAAS support system | 4.4.11 | x | Started | standard-4.4.11 | Provide System support management | 4.4.11 | x | Started | standard-4.4.11 | Provide a JMX MBeanServer ssh | 4.4.11 | x | Started | standard-4.4.11 | Provide a SSHd server on KarafTo add capability, run feature:install <name> (for example feature:install scr to add Declarative Services). Install OSGi bundles with bundle:install, or hot-deploy by dropping a bundle or KAR file into /opt/karaf/deploy.
The default login is rejected
The stock karaf/karaf credential is never shipped. Try to log in with the default password. The login fails:
if sshpass -p 'karaf' ssh -n -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
-o PreferredAuthentications=password -o PubkeyAuthentication=no \
-o ConnectTimeout=10 -p 8101 karaf@127.0.0.1 'system:version' 2>/dev/null; then echo 'UNEXPECTED: default credential accepted' else echo 'default karaf/karaf credential correctly rejected' fiExpected output:
default karaf/karaf credential correctly rejectedComponents
Component Path
Karaf home /opt/karaf (link to /opt/apache-karaf-4.4.11)
Users file /opt/karaf/etc/users.properties (mode 0600 karaf:karaf)
Users template /usr/local/share/sac/karaf-users.properties.template
Deploy directory /opt/karaf/deploy (drop bundles or KAR files here to hot-deploy)
systemd unit /etc/systemd/system/apache-karaf.service
First-boot unit /etc/systemd/system/apache-karaf-firstboot.service
Credentials /root/karaf-credentials.txt (mode 0600 root:root)
Service user karaf (unprivileged, nologin)
Java runtime OpenJDK 17 (/usr/lib/jvm/java-17-openjdk-amd64)
Security hardening
- Restrict the security group so TCP 8101 only reaches your administrative CIDR. The recommended security group does not open it to the internet.
- Deploy in a private subnet and reach the console through a bastion or VPN where possible.
- Add more users by editing
/opt/karaf/etc/users.properties(user = password,_g_:grouplines), or from the console withjaas:commands. Then log in again. - Deploy applications by dropping OSGi bundles or KAR files into
/opt/karaf/deploy, or withbundle:install/feature:installfrom the console. - Enable password encryption in
/opt/karaf/etc/org.apache.karaf.jaas.cfg(encryption.enabled = true) sousers.propertiesstores hashed passwords. - Encrypt at rest by enabling EBS encryption on the instance's volumes.
- Patch regularly:
sudo apt-get update && sudo apt-get upgrade && sudo reboot.
Backup and maintenance
- Configuration lives in
/opt/karaf/etc. Back up that directory to preserve your users, features configuration and any custom*.cfgfiles. - Deployed artifacts dropped into
/opt/karaf/deployshould be kept in your own source control or artifact repository. - Upgrades: install OS updates with apt-get, and track new Karaf releases from the Apache project. SecureAnyCloud ships updated images as new AMI versions.
Licensing
Apache Karaf is distributed under the Apache-2.0 licence (SPDX Apache-2.0) by the Apache Software Foundation and is free to use. SecureAnyCloud provides the pre-built, hardened image and commercial support separately. SecureAnyCloud is not affiliated with or endorsed by the Apache Software Foundation. All product and company names are trademarks or registered trademarks of their respective holders. Questions: sales@secureanycloud.com.
Deploy on AWS
Launch Apache Karaf on AWS with 24/7 support from SecureAnyCloud.
View on Marketplace
Need Help?
Our support team is available 24/7.
sales@secureanycloud.com