Last active
May 19, 2020 19:09
-
-
Save arellano-gustavo/1718b474e97c2ffd3a5de6c7212f2c22 to your computer and use it in GitHub Desktop.
Generate nexus ssl certificate from lets encript output
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/bash | |
cd /etc/letsencrypt/archive/ | |
echo "Recreando el directorio temporal" | |
rm -rf temporal | |
cp -r ci.ultrasist.net temporal | |
cd temporal | |
CLAVE=password | |
echo "Generando pkcs12" | |
openssl pkcs12 \ | |
-export \ | |
-in fullchain1.pem \ | |
-inkey privkey1.pem \ | |
-out keystore.pkcs12 \ | |
-passin pass:$CLAVE \ | |
-passout pass:$CLAVE | |
# https://github.com/bradbeck/nexus-https/blob/master/Dockerfile#L8 | |
# PRIVATE_KEY_PASSWORD=password | |
echo "Archivo pkcs12 generado" | |
echo "Generando keystore" | |
RUTA=/etc/letsencrypt/archive/temporal | |
docker run -it \ | |
-v $RUTA:/ok \ | |
gustavoarellano/jdk18 \ | |
/usr/java/jdk1.8.0_65/bin/keytool \ | |
-importkeystore \ | |
-storepass $CLAVE \ | |
-keypass $CLAVE \ | |
-srcstorepass $CLAVE \ | |
-srckeystore ok/keystore.pkcs12 \ | |
-srcstoretype PKCS12 \ | |
-destkeystore ok/keystore.jks | |
echo "Keystore creado" | |
echo "Copiando los archivos a servidor remoto.." | |
scp -i ../llave.pem key*.* [email protected]:/home/ubuntu/services/nexus/nexus-store/certificates | |
echo "Archivos copiados !" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment