Author: dj
Date: 2009-04-08 22:23:47 -0600 (Wed, 08 Apr 2009)
New Revision: 7814
Added:
trunk/auxfiles/makeblfscas.sh
Log:
Added makeblfscas.sh script to generate BLFS-ca-bundle
Added: trunk/auxfiles/makeblfscas.sh
===================================================================
--- trunk/auxfiles/makeblfscas.sh (rev 0)
+++ trunk/auxfiles/makeblfscas.sh 2009-04-09 04:23:47 UTC (rev 7814)
@@ -0,0 +1,53 @@
+#!/bin/bash
+# Begin mkblfscas.sh
+# Script to populate OpenSSL's CApath from a bundle of PEM formatted CAs
+
+if test -z "${1}"
+then
+ VERSION=`date --utc +%Y%m%d`
+else
+ VERSION="${1}"
+fi
+
+TEMPDIR=`mktemp -d`
+CAFILE="${TEMPDIR}/ca-bundle.crt"
+TARBALL="${PWD}/BLFS-ca-bundle-${VERSION}.tar.bz2"
+CASCRIPT="./mkcabundle.pl"
+
+"${CASCRIPT}" > "${CAFILE}"
+
+mkdir "${TEMPDIR}/certs"
+
+# Get a list of staring lines for each cert
+CERTLIST=`grep -n "^Certificate:$" "${CAFILE}" | cut -d ":" -f 1`
+
+# Get a list of ending lines for each cert
+ENDCERTLIST=`grep -n "^-----END" "${CAFILE}" | cut -d ":" -f 1`
+
+# Start a loop
+for certbegin in `echo "${CERTLIST}"`
+do
+ for certend in `echo "${ENDCERTLIST}"`
+ do
+ if test "${certend}" -gt "${certbegin}"
+ then
+ break
+ fi
+ done
+ sed -n "${certbegin},${certend}p" "${CAFILE}" >
"${TEMPDIR}/certs/${certbegin}"
+ object=`grep -m 1 -o "O=.*, " "${TEMPDIR}/certs/${certbegin}" | sed -e
's...@o=@@' -e 's@,.*@@'`
+ keyhash=`openssl x509 -noout -in "${TEMPDIR}/certs/${certbegin}" -hash`
+ if test -z "$object"
+ then
+ object="NO OBJECT PROVIDED IN DESCRIPTION"
+ fi
+ echo "generated PEM file with hash ${keyhash} for ${object}"
+ mv "${TEMPDIR}/certs/${certbegin}" "${TEMPDIR}/certs/${keyhash}.pem"
+done
+
+cd "${TEMPDIR}"
+tar -jcf "${TARBALL}" certs/
+cd ..
+rm -r "${TEMPDIR}"
+
+# End mkblfscas.sh
Property changes on: trunk/auxfiles/makeblfscas.sh
___________________________________________________________________
Name: svn:executable
+ *
--
http://linuxfromscratch.org/mailman/listinfo/blfs-book
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page