1998-12-21 18:52:47 +08:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# redo the hashes for the certificates in your cert path or the ones passed
|
|
|
|
# on the command line.
|
|
|
|
#
|
|
|
|
|
1998-12-21 19:00:56 +08:00
|
|
|
if [ "$SSLEAY"x = "x" -o ! -x "$SSLEAY" ]; then
|
1998-12-21 18:52:47 +08:00
|
|
|
SSLEAY='ssleay'
|
|
|
|
export SSLEAY
|
|
|
|
fi
|
|
|
|
DIR=/usr/local/ssl
|
1998-12-21 18:56:39 +08:00
|
|
|
PATH=$DIR/bin:$PATH
|
1998-12-21 18:52:47 +08:00
|
|
|
|
|
|
|
SSL_DIR=$DIR/certs
|
|
|
|
|
|
|
|
if [ "$*" = "" ]; then
|
|
|
|
CERTS=${*:-${SSL_CERT_DIR:-$SSL_DIR}}
|
|
|
|
else
|
|
|
|
CERTS=$*
|
|
|
|
fi
|
|
|
|
|
|
|
|
IFS=': '
|
|
|
|
for i in $CERTS
|
|
|
|
do
|
|
|
|
(
|
|
|
|
IFS=' '
|
|
|
|
if [ -d $i -a -w $i ]; then
|
|
|
|
cd $i
|
|
|
|
echo "Doing $i"
|
|
|
|
for i in *.pem
|
|
|
|
do
|
|
|
|
if [ $i != '*.pem' ]; then
|
|
|
|
h=`$SSLEAY x509 -hash -noout -in $i`
|
|
|
|
if [ "x$h" = "x" ]; then
|
|
|
|
echo $i does not contain a certificate
|
|
|
|
else
|
|
|
|
if [ -f $h.0 ]; then
|
|
|
|
/bin/rm -f $h.0
|
|
|
|
fi
|
|
|
|
echo "$i => $h.0"
|
|
|
|
ln -s $i $h.0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
)
|
|
|
|
done
|