[svn-commits] jrose: branch 11 r375327 - in /branches/11: ./ contrib/scripts/ast_tls_cert

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Oct 23 11:22:15 CDT 2012


Author: jrose
Date: Tue Oct 23 11:22:12 2012
New Revision: 375327

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=375327
Log:
ast_tls_cert script: Better response for various exit conditions to openssl

(closes issue ASTERISK-20260)
Reported by: Daniel O'Connor
Patches:
	ast_tls_cert-update.diff uploaded by Daniel O'Connor (license 6419)
........

Merged revisions 375325 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 375326 from http://svn.asterisk.org/svn/asterisk/branches/10

Modified:
    branches/11/   (props changed)
    branches/11/contrib/scripts/ast_tls_cert

Propchange: branches/11/
------------------------------------------------------------------------------
Binary property 'branch-10-merged' - no diff available.

Modified: branches/11/contrib/scripts/ast_tls_cert
URL: http://svnview.digium.com/svn/asterisk/branches/11/contrib/scripts/ast_tls_cert?view=diff&rev=375327&r1=375326&r2=375327
==============================================================================
--- branches/11/contrib/scripts/ast_tls_cert (original)
+++ branches/11/contrib/scripts/ast_tls_cert Tue Oct 23 11:22:12 2012
@@ -30,20 +30,45 @@
 }
 
 create_ca () {
-	echo "Creating ${CAKEY}"
+	echo "Creating CA key ${CAKEY}"
 	openssl genrsa -des3 -out ${CAKEY} 4096 > /dev/null
-	echo "Creating ${CACERT}"
+	if [ $? -ne 0 ];
+	then
+		echo "Failed"
+		exit 1
+	fi
+	echo "Creating CA certificate ${CACERT}"
 	openssl req -new -config ${CACFG} -x509 -days 365 -key ${CAKEY} -out ${CACERT} > /dev/null
+	if [ $? -ne 0 ];
+	then
+		echo "Failed"
+		exit 1
+	fi
 }
 
 create_cert () {
 	local base=${OUTPUT_DIR}/${OUTPUT_BASE}
-	echo "Creating ${base}.key"
+	echo "Creating certificate ${base}.key"
 	openssl genrsa -out ${base}.key 1024 > /dev/null
-	echo "Creating signing request"
+	if [ $? -ne 0 ];
+	then
+		echo "Failed"
+		exit 1
+	fi
+	echo "Creating signing request ${base}.csr"
 	openssl req -batch -new -config ${CONFIG_FILE} -key ${base}.key -out ${base}.csr > /dev/null
-	echo "Creating ${base}.crt"
+	if [ $? -ne 0 ];
+	then
+		echo "Failed"
+		exit 1
+	fi
+	echo "Creating certificate ${base}.crt"
 	openssl x509 -req -days 365 -in ${base}.csr -CA ${CACERT} -CAkey ${CAKEY} -set_serial 01 -out ${base}.crt > /dev/null
+	if [ $? -ne 0 ];
+	then
+		echo "Failed"
+		exit 1
+	fi
 	echo "Combining key and crt into ${base}.pem"
 	cat ${base}.key > ${base}.pem
 	cat ${base}.crt >> ${base}.pem
@@ -181,6 +206,12 @@
 	CACFG=${OUTPUT_DIR}/ca.cfg
 	create_config ca "${CACFG}" "${DEFAULT_CA_CN}" "${DEFAULT_CA_ORG}"
 	create_ca
+else
+	if [ -z ${CAKEY} ]
+	then
+		echo "-k must be specified if -c is"
+		exit 1
+	fi
 fi
 
 create_cert




More information about the svn-commits mailing list