Gluu Server CE Cert import
๐ฏ Purpose
This guide outlines the process to securely log into the Gluu Server virtual machine (VM), retrieve the Gluu server's TLS certificate, import it into the Java truststore, and restart services to enable trusted internal HTTPS communication.
๐ย Logging into the Gluu VM
ssh root@your-gluu-server-iproot๐งฐ Prerequisites
gluu.mslspartners.comchangeitopensslkeytoolawk๐ Step-by-Step Instructions
1๏ธโฃ Create the Script
nano /root/import-gluu-cert.sh2๏ธโฃ Paste the Script Below
#!/bin/bash
DOMAIN="gluu.mslspartners.com"
CERT_PATH="/etc/certs/gluu-full-chain.crt"
KEYSTORE_PATH="/opt/jre/lib/security/cacerts"
KEYSTORE_PASS="changeit"
ALIAS="gluu-remote"
echo "๐ Fetching certificate from $DOMAIN..."
openssl s_client -showcerts -connect ${DOMAIN}:443 </dev/null \
| awk '/BEGIN CERT/,/END CERT/ { print }' > "$CERT_PATH"
if [[ $? -ne 0 ]]; then
echo "โ Failed to retrieve certificate."
exit 1
fi
echo "๐๏ธ Removing old certificate (if any)..."
keytool -delete -alias "$ALIAS" -keystore "$KEYSTORE_PATH" -storepass "$KEYSTORE_PASS" 2>/dev/null
echo "โ Importing new certificate..."
keytool -import -alias "$ALIAS" \
-keystore "$KEYSTORE_PATH" \
-trustcacerts -file "$CERT_PATH" \
-storepass "$KEYSTORE_PASS" -noprompt
echo "๐ Restarting Gluu services..."
/root/restart-gluu.sh
echo "โ
Import and restart complete!"
3๏ธโฃ Make the Script Executable
chmod +x /root/import-gluu-cert.sh4๏ธโฃ Run the Script
/root/import-gluu-cert.sh๐ Verifying Certificate Import
๐งพ Check Truststore Entry:
keytool -list -keystore /opt/jre/lib/security/cacerts -storepass changeit | grep gluu-remote๐ Check Active Truststore in Java:
/opt/jre/bin/java -XshowSettings:properties -version 2>&1 | grep trustStore๐ Confirm Issuer/Subject:
openssl x509 -in /etc/certs/gluu-full-chain.crt -noout -issuer -subject๐ Troubleshooting
root/opt/gluu/jetty/<app>/logs/๐ Notes
/root/restart-gluu.sh๐ Step 1: SSH intoInto the Host ServerMachine
UseFrom SSHyour tolocal terminal, connect to your Gluu server:server host:
ssh root@your-gluu-server-ip
Replace your-gluu-server-ip with theyour actual IPย address or hostname.
๐งญ๐ฆ Step 2: EnterLog In to the Gluu Chroot Environment
ToGluu manageruns Gluu,inside youa mustchroot entercontainer. theEnter isolatedit environment:with:
/sbin/gluu-serverd login
OnceYouโll inside,know youyou're willinside seewhen theyour prompt change,changes (e.g.:
[gluu@gluu ~]#).
๐๐ Step 3: Navigate tothe Gluu DirectoriesFile Structure
ComponentsCore like oxAuth, Identity, IDP, etc.,services areย found under:
cd /opt/gluu/jetty/
๐๐ Step 4: CheckView Logsย for Troubleshooting
To viewCheck the lastmost 50recent log lines offor a service'sservice. logExample file, run:(oxAuth):
tail -n 50 /opt/gluu/jetty/oxauth/logs/oxauth.log
Replace oxauthย with the appropriate service name as needed.
โป๏ธ๐ Step 5: Restart Gluu Services
If
Option youA: haveUsing a restart script:Script
/root/restart-gluu.sh
Or
Option restartB: specificManual servicesService manually:Restart
cd /opt/gluu/jetty/oxauthย &&
nohup java -jar ../../jetty/start.jar > oxauth.log 2>&1 &
Repeat for other services like identity, idp, etc.
๐๐ Step 6: VerifyCheck Running Java Trust StoreServices
keytoolUse -listthis -keystoreto /etc/ssl/certs/java/cacertsverify -storepassif 'changeit'services |are grep gluu
๐ฆ Step 7: Check Java Processes
active:
ps aux | grep java | grep -v grep
๐ก๐ Tip:Step 7: Verify Java Truststore for Certificates
Ensure custom certs are loaded:
keytool -list -keystore /etc/ssl/certs/java/cacerts -storepass 'your-password' | grep gluu
๐ช Step 8: Exit the Gluu Chroot Environment
To return to the regular Linux shell:
exit
This returns you to the main server shell.
โ
๐ Summary
Login:๐ ๏ธ Use/sbin/gluu-serverd loginย to manage Gluu internalsServices:๐งญLocatedServicesinlocated at/opt/gluu/jettyjetty/Logs:๐ Logs help debug services under/logs
tailkeytool to keytoolcertificates
๐ง๐ก ForTip: persistentAlways issues,ensure validate SSLyour certificates andare inspecttrusted by oxauth.logandthe oxtrust.log.JVM for SSL-based connections to succeed!