Created
July 8, 2021 16:26
-
-
Save 0x3b0c/9e13ff441a536b2681dc1c641968cb3c to your computer and use it in GitHub Desktop.
update cert and key (issued via acme.sh) directly into youtrack built.in keystore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
KEYTOOL=/opt/youtrack/internal/java/linux-x64/bin/keytool | |
# Get the password from /opt/youtrack/conf/internal/bundle.properties | |
# (additional-keystore-password field) | |
JKS_PASS=CHANGEIT | |
# Get the current alias name from keystore.jks | |
JKS_ALIAS=securekeystorealias | |
JKS_FILE=/opt/youtrack/conf/internal/keystore.jks | |
P12_FILE=/opt/youtrack/conf/internal/pkcs.p12 | |
CERT_FILE=/root/.acme.sh/youtrack.marcocavanna.it/youtrack.marcocavanna.it.cer | |
KEY_FILE=/root/.acme.sh/youtrack.marcocavanna.it/youtrack.marcocavanna.it.key | |
echo Packing cer and key into pkcs12 store | |
openssl pkcs12 -export \ | |
-password pass:$JKS_PASS \ | |
-in ${CERT_FILE} \ | |
-inkey ${KEY_FILE} \ | |
-name ${JKS_ALIAS} \ | |
-out ${P12_FILE} | |
echo Deleting old entry from YouTrack store | |
${KEYTOOL} -delete \ | |
-keystore ${JKS_FILE} \ | |
-alias ${JKS_ALIAS} \ | |
-storepass $JKS_PASS | |
echo Importing into YouTrack store | |
${KEYTOOL} -importkeystore \ | |
-destkeystore ${JKS_FILE} \ | |
-srckeystore ${P12_FILE} \ | |
-srcstorepass $JKS_PASS \ | |
-deststorepass $JKS_PASS | |
echo YouTrack restarting | |
systemctl restart youtrack |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment