Created
May 14, 2020 11:56
-
-
Save sherifabdlnaby/202d6e65a6cc79fb53b6a3771e3ab782 to your computer and use it in GitHub Desktop.
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
# Exit on Error | |
set -e | |
OUTPUT_DIR=/secrets | |
CA_FILE=$OUTPUT_DIR/elastic-stack-ca.p12 | |
CERT_FILE=$OUTPUT_DIR/elastic-certificates.p12 | |
printf "====== Generating Elasticsearch Certifications ======\n" | |
printf "=====================================================\n" | |
if [ -f "$CA_FILE" ]; then | |
echo "Removing current Certificate Authority (CA)..." | |
rm $CA_FILE | |
fi | |
if [ -f "$CERT_FILE" ]; then | |
echo "Removing current Certificate (P12)..." | |
rm $CERT_FILE | |
fi | |
elasticsearch-certutil ca -s --pass "" --out $CA_FILE | |
elasticsearch-certutil cert -s --ca $CA_FILE --ca-pass "" --out $CERT_FILE --pass "" | |
chmod 0644 $CA_FILE | |
chmod 0644 $CERT_FILE | |
printf "Certificate Authority created at $CA_FILE\n" | |
printf "Certificate created at $CERT_FILE\n" | |
printf "=====================================================\n" | |
printf "SSL Certifications generation completed successfully.\n" | |
printf "=====================================================\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment