-
-
Save lifeblood/ed54acb4821ea34c4647d3d5b7d40a6b 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