From a4eb98588550ea4068e3b5791cfc0d8a20ec1067 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Sun, 26 May 2013 11:12:06 -0400 Subject: [PATCH] removing backslash in spaces to underscores, made alias a specific parameter for the create cert script. --- scripts/files/spaces_to_underscores.sh | 2 +- scripts/security/create_certificates.sh | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/scripts/files/spaces_to_underscores.sh b/scripts/files/spaces_to_underscores.sh index 6c955611..69078b6c 100644 --- a/scripts/files/spaces_to_underscores.sh +++ b/scripts/files/spaces_to_underscores.sh @@ -12,7 +12,7 @@ fi while [ $# -gt 0 ]; do file="$1"; shift - newname="$(echo "$file" | tr -s ' ' '_' | tr -d "\~'," | sed -e 's/\([0-9]\)_\./\1./g' | sed -e 's/_-_/-/' )" + newname="$(echo "$file" | tr -s ' ' '_' | tr -d "\\\~'," | sed -e 's/\([0-9]\)_\./\1./g' | sed -e 's/_-_/-/' )" if [ "$file" != "$newname" ]; then # we've effected a name change, so let's actually do it. echo "moving '$file' => '$newname' " diff --git a/scripts/security/create_certificates.sh b/scripts/security/create_certificates.sh index cc98ddb3..72100fd8 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. +alias="$1"; shift +if [ -z "$filename" -o -z "$alias" ]; then + echo This script needs a base portion for the certificate filename to create + echo and the alias 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 an 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 "$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 -- 2.34.1