X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=scripts%2Fsecurity%2Fcreate_certificates.sh;h=af8daaf957822bd61658e7ab49f87b10ba51faa5;hb=b0b56f01f9ce0e9dae933e4b5c5792cc2ad04f67;hp=cc98ddb37251ca6281c9b1fc500cafac142e795c;hpb=0775113f1158b3c1fff439028c316324fcac9750;p=feisty_meow.git diff --git a/scripts/security/create_certificates.sh b/scripts/security/create_certificates.sh index cc98ddb3..af8daaf9 100644 --- a/scripts/security/create_certificates.sh +++ b/scripts/security/create_certificates.sh @@ -1,10 +1,12 @@ filename="$1"; shift -if [ -z "$filename" ]; then - echo This script needs a base portion for the certificate filename to create. +cert_alias="$1"; shift +if [ -z "$filename" -o -z "$cert_alias" ]; then + echo "This script needs a base portion for the certificate filename to create" + echo "and the alias (or short name) for the certificate." echo For example: - echo $0 DrakeKey - echo would create DrakeKey.pem and DrakeKey.pfx. + echo -e "\t$(basename $0 .sh) DrakeKey \"DrakeContainer\"" + echo would create DrakeKey.pem and DrakeKey.pfx with a cert alias of DrakeContainer. exit 1 fi @@ -12,10 +14,10 @@ fi openssl req -x509 -nodes -days 3650 \ -newkey rsa:1024 -keyout ${filename}.pem -out ${filename}.pem -# export PFX file. -openssl pkcs12 -export -out ${filename}.pfx -in ${filename}.pem -name "Drake Container Certificate" +# export the PEM to a PFX file. +openssl pkcs12 -export -out ${filename}.pfx -in ${filename}.pem -name "$cert_alias" -# export the PFX to a certificate file. this can be given to other folks. +# export the PEM to a DER certificate file. openssl x509 -inform pem -in ${filename}.pem -outform der -out ${filename}.cer