diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-01-19 00:19:29 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-01-19 00:19:29 +0000 |
commit | f8247040e6231c4b3b5099ea3a526348b7941566 (patch) | |
tree | 0cc92ad6ebf6ae49a62f6e7ef8ec819121d63630 /trunk/contrib/scripts/astgenkey | |
parent | d88e56c61ce2042544c1a8a71c93b69ab2e6ffba (diff) |
Creating tag for the release of asterisk-1.6.0-beta1v1.6.0-beta1
git-svn-id: http://svn.digium.com/svn/asterisk/tags/1.6.0-beta1@99163 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'trunk/contrib/scripts/astgenkey')
-rw-r--r-- | trunk/contrib/scripts/astgenkey | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/trunk/contrib/scripts/astgenkey b/trunk/contrib/scripts/astgenkey new file mode 100644 index 000000000..637604896 --- /dev/null +++ b/trunk/contrib/scripts/astgenkey @@ -0,0 +1,61 @@ +#!/bin/sh +# +# Usage: astgenkey [ -q ] [ -n ] [keyname] +# +DES3=-des3 +if [ "$1" = "-q" ]; then + QUIET='y' + if [ "$2" = "-n" ]; then + DES3= + KEY=$3 + else + KEY=$2 + fi +elif [ "$1" = "-n" ]; then + DES3= + if [ "$2" = "-q" ]; then + QUIET='y' + KEY=$3 + else + KEY=$2 + fi +else + KEY=$1 +fi + +if [ "$QUIET" != 'y' ]; then + echo "" + echo "This script generates an RSA private and public key pair" + echo "in PEM format for use by Asterisk. You will be asked to" + echo "enter a passcode for your key multiple times. Please" + echo "enter the same code each time. The resulting files will" + echo "need to be moved to /var/lib/asterisk/keys if you want" + echo "to use them, and any private keys (.key files) will" + echo "need to be initialized at runtime either by running" + echo "Asterisk with the '-i' option, or with the 'init keys'" + echo "command once Asterisk is running." + echo "" + echo "Press ENTER to continue or ^C to cancel." + read BLAH +fi + +while [ "$KEY" = "" ]; do + echo -n "Enter key name: " + read KEY +done + +rm -f ${KEY}.key ${KEY}.pub + +echo "Generating SSL key '$KEY': " +openssl genrsa -out ${KEY}.key ${DES3} 1024 +openssl rsa -in ${KEY}.key -pubout -out ${KEY}.pub + +if [ -f "${KEY}.key" ] && [ -f "${KEY}.pub" ]; then + if [ "$QUIET" != 'y' ]; then + echo "Key creation successful." + echo "Public key: ${KEY}.pub" + echo "Private key: ${KEY}.key" + fi +else + echo "Unknown error creating keys." +fi |