Last active
June 25, 2019 08:01
-
-
Save jeremija/65678cdb371d9d77956f1cbfd516ee90 to your computer and use it in GitHub Desktop.
Create root CA and certificates
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 | |
DOMAIN=$1 | |
MERGED="$DOMAIN-merged.crt" | |
echo "Generating private key for certificate signing request" > /dev/stderr | |
openssl genrsa -out $DOMAIN.key 2048 | |
echo "Creating a certificate signing request" > /dev/stderr | |
openssl req -new -key $DOMAIN.key -out $DOMAIN.csr \ | |
-subj "/C=US/ST=New York/L=New York/O=NYU LMC/OU=IIME/CN=$DOMAIN" | |
echo "Generating certificate" > /dev/stderr | |
openssl x509 -req -in $DOMAIN.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out $DOMAIN.crt -days 500 -sha256 | |
echo "Merging certificate to single file [$MERGED]" > /dev/stderr | |
cat $DOMAIN.crt rootCA.pem > $DOMAIN-merged.crt | |
echo "Done" > /dev/stderr |
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 | |
echo "Generating root CA private key" > /dev/stderr | |
openssl genrsa -out rootCA.key 2048 | |
echo "Generating root CA certificate" > /dev/stderr | |
openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 1024 -out rootCA.pem \ | |
-subj '/C=US/ST=New York/L=New York/O=NYU LMC/OU=IIME/CN=nyumc.org' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment