- Change the username and password for Apache Karaf admin user
What you will learn:
- Overwrite default Karaf configuration files
- Use Maven filtered resources
By default, the admin user has the username/password of karaf/karaf. For branding purposes, we want to rename the username/password of dekantar/dekantar .
Step 1: Define username/password
Define the username/password as Maven properties in the pom.xml
<properties> <dekantar.username>dekantar</dekantar.username> <dekantar.password>dekantar</dekantar.password> </properties>
Step 2: Turn on Maven filtered resources
Filtered resource will substitute Maven variables in text files with the property values
<resources> <resource> <directory>src/main/resources</directory> <filtering>false</filtering> <includes> <include>**/*</include> </includes> </resource> <resource> <directory>src/main/filtered-resources</directory> <filtering>true</filtering> <includes> <include>**/*</include> </includes> </resource> </resources>
The filtering is true property turns on variable substitution in the src/main/filtered-resources directory.
See https://github.com/juttayaya/karaf/blob/master/karaf3/custom-karaf/custom-karaf-server/pom.xml for full example.
Step 3: Overwrite default Karaf security file
The default Karaf security file is etc/user.properties. To overwrite, create the file src/main/filtered-resources/etc/user.properties.
The content of etc/user.properties is
${dekantar.username} = ${dekantar.password},_g_:admingroup
_g_\:admingroup = group,admin,manager,viewer,webconsole
The variable substitution results in the output
dekantar = dekantar,_g_:admingroup
_g_\:admingroup = group,admin,manager,viewer,webconsole
Don't worry about the clear text password. Karaf will automatically encrypt it on first login.
See https://github.com/juttayaya/karaf/blob/master/karaf3/custom-karaf/custom-karaf-server/src/main/filtered-resources/etc/users.properties for full example
Step 4: Test it
After building the Karaf server, start it via command
cd $KARAF_DIR/bin
./start
Then log in with the new username
ssh dekantar@localhost -p8101
Superlative offers reliable download experience online ssstiktok Users find it extremely convenient for saving short videos quickly with high quality output and smooth performance that works well across different devices without any interruptions or delays making it highly useful platform
ReplyDeleteI truly appreciate the Cats Blender Plugin for making avatar preparation and model optimization incredibly simple. The intuitive tools, time-saving automation, and smooth workflow help both beginners and experienced Blender users complete projects with greater efficiency and confidence.
ReplyDeletePositive energy surrounds every Wavelength Game session because the exciting gameplay encourages communication and enjoyable teamwork from beginning to end.
ReplyDeleteLovely collection of guides R6 Marketplace helps visitors understand safe trading through detailed yet simple explanations. The website continues providing dependable information that benefits the gaming community.
ReplyDeleteReally fun learning platform Tightrope Trivia encourages players to expand their knowledge through enjoyable gameplay and creative quizzes. Every visit offers something new to discover.
ReplyDelete