Skip to content

Instantly share code, notes, and snippets.

@arellano-gustavo
Last active May 19, 2020 19:09
Show Gist options
  • Save arellano-gustavo/1718b474e97c2ffd3a5de6c7212f2c22 to your computer and use it in GitHub Desktop.
Save arellano-gustavo/1718b474e97c2ffd3a5de6c7212f2c22 to your computer and use it in GitHub Desktop.
Generate nexus ssl certificate from lets encript output
#!/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