Gluu Server CE Cert import
๐ฏ Purpose
This guide explains how to securely fetch a self-signed or internal TLS certificate from your Gluu server (gluu.mslspartners.com), import it into the Java truststore, and restart Gluu services to establish trusted HTTPS communication internally.
๐งฐ Prerequisites
gluu.mslspartners.com
๐ Java truststore password (default: changeitย or custom)
๐ฆ Installed tools: openssl, keytool, awk
๐ Step-by-Step Instructions
1๏ธโฃ Create a Script File
nano /root/import-gluu-cert.sh
2๏ธโฃ 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 it exists)..."
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 complete!"
3๏ธโฃ Make the Script Executable
chmod +x /root/import-gluu-cert.sh
4๏ธโฃ Run the Script
/root/import-gluu-cert.sh
๐ Verifying Certificate Import
๐ Check Certificate in Truststore:
keytool -list -keystore /opt/jre/lib/security/cacerts -storepass changeit | grep gluu-remote
๐ Confirm Active Truststore:
/opt/jre/bin/java -XshowSettings:properties -version 2>&1 | grep trustStore
๐ Check Issuer and Subject:
openssl x509 -in /etc/certs/gluu-full-chain.crt -noout -issuer -subject
๐ Troubleshooting
gluu-full-chain.crt.
๐ Missing file?ย Double-check /etc/certs/ย exists and is writable.
๐ Permission denied?ย Make sure youโre running commands as root.
๐ Service won't restart?ย Check logs under /opt/gluu/jetty/<component>/logs/.
๐ Notes
/root/restart-gluu.sh.