Created
June 24, 2015 17:52
-
-
Save goodjob1114/5b62897d6e1511758285 to your computer and use it in GitHub Desktop.
simple ssl generate shell script
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 | |
RED='\033[0;31m' | |
GREEN='\033[0;32m' | |
NC='\033[0m' | |
SSL_FOLDER="../ssl" | |
if [ -d "$SSL_FOLDER" ]; then | |
echo "ssl folder existed" | |
else | |
mkdir $SSL_FOLDER | |
fi | |
openssl genrsa -out $SSL_FOLDER/server.key 2048 && \ | |
openssl req -new -key $SSL_FOLDER/server.key -out $SSL_FOLDER/server.csr && \ | |
openssl x509 -req -days 365 -in $SSL_FOLDER/server.csr -signkey $SSL_FOLDER/server.key -out $SSL_FOLDER/server.crt | |
if [ $? -eq 0 ]; then | |
printf "${GREEN}*** gen ssl success ***${NC} \n" | |
rm -f $SSL_FOLDER/server.csr | |
else | |
printf "${RED}??? gen ssl failed ???${NC} \n" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment