[Freeswitch-svn] [commit] r7265 - freeswitch/trunk/scripts

Freeswitch SVN stkn at freeswitch.org
Thu Jan 17 05:14:55 EST 2008


Author: stkn
Date: Thu Jan 17 05:14:54 2008
New Revision: 7265

Modified:
   freeswitch/trunk/scripts/gentls_cert.in

Log:
Add -out option to specify filename for new cert, some other minor improvements

Modified: freeswitch/trunk/scripts/gentls_cert.in
==============================================================================
--- freeswitch/trunk/scripts/gentls_cert.in	(original)
+++ freeswitch/trunk/scripts/gentls_cert.in	Thu Jan 17 05:14:54 2008
@@ -8,12 +8,19 @@
 COMMON_NAME="FreesSWITCH CA"
 ALT_NAME="DNS:test.freeswitch.org"
 ORG_NAME="FreeSWITCH"
+OUTFILE="agent.pem"
 
 umask 037
 
 setup_ca() {
 	echo "Creating new CA..."
 
+	if [ -e "${CONFDIR}/CA/cacert.pem" ] || [ -e "${CONFDIR}/CA/cakey.pem" ]
+	then
+		echo "existing CA found in \"${CONFDIR}/CA\"!"
+		exit 1
+	fi
+
 	if [ ! -d "${CONFDIR}/CA" ]; then
 		mkdir -p -m 750 "${CONFDIR}/CA" || exit  1
 	fi
@@ -69,9 +76,12 @@
 	echo "ORG_NAME: \"${ORG_NAME}\""
 	echo "ALT_NAME: \"${ALT_NAME}\""
 	echo
+	echo "Certificate filename \"${OUTFILE}\""
+	echo
 	echo "[Enter \"OK\" to accept]"
 	read val
 	if [ "${val}" != "OK" ]; then
+		echo "Aborted"
 		return 2
 	fi
 
@@ -91,7 +101,7 @@
 		-extensions ext -days ${DAYS} -sha1 >/dev/null || exit 1
 
 	cat "${CONFDIR}/CA/cacert.pem" > "${CONFDIR}/cafile.pem"
-	cat "${TMPFILE}.crt" "${TMPFILE}.key" > "${CONFDIR}/agent.pem"
+	cat "${TMPFILE}.crt" "${TMPFILE}.key" > "${CONFDIR}/${OUTFILE}"
 
 	rm "${TMPFILE}.cfg" "${TMPFILE}.crt" "${TMPFILE}.key" "${TMPFILE}.req"
 
@@ -99,7 +109,7 @@
 }
 
 remove_ca() {
-	echo "Cleaning CA"
+	echo "Removing CA"
 
 	if [ ! -d "${CONFDIR}/CA" ]; then
 		rm "${CONFDIR}/CA/"*
@@ -126,6 +136,10 @@
 			shift
 			ORG_NAME="$1"
 			;;
+		-out)
+			shift
+			OUTFILE="$1"
+			;;
 	esac
 	shift
 done
@@ -157,14 +171,17 @@
 		  * commands:
 
 		    setup  - Setup new CA
-		    create - Create new certificate (overwriting old!)
 		    remove - Remove CA
 
+		    create - Create new certificate (overwriting old!)
+
+
 		  * options:
 
 		   -cn       Set common name
 		   -alt      Set alternative name (use prefix 'DNS:' or 'URI:')
 		   -org      Set organization name
+		   -out      Filename for new certificate (create only)
 
 		EOF
 		exit 1



More information about the Freeswitch-svn mailing list