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.
|
|
|
|
#
|
|
|
|
|
1999-01-02 23:52:11 +08:00
|
|
|
if [ "$OPENSSL"x = "x" -o ! -x "$OPENSSL" ]; then
|
|
|
|
OPENSSL='openssl'
|
|
|
|
export OPENSSL
|
1998-12-21 18:52:47 +08:00
|
|
|
fi
|
1999-05-07 07:46:26 +08:00
|
|
|
DIR=/usr/local/ssl
|
1998-12-21 18:56:39 +08:00
|
|
|
PATH=$DIR/bin:$PATH
|
1998-12-21 18:52:47 +08:00
|
|
|
|
1999-01-02 23:52:11 +08:00
|
|
|
if [ ! -f "$OPENSSL" ]; then
|
1998-12-22 23:59:57 +08:00
|
|
|
found=0
|
|
|
|
for dir in . `echo $PATH | sed -e 's/:/ /g'`; do
|
1999-01-02 23:52:11 +08:00
|
|
|
if [ -f "$dir/$OPENSSL" ]; then
|
1998-12-22 23:59:57 +08:00
|
|
|
found=1
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ $found = 0 ]; then
|
1999-03-09 18:08:17 +08:00
|
|
|
echo "c_rehash: rehashing skipped ('openssl' program not available)" 1>&2
|
1998-12-22 23:59:57 +08:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
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
|
1999-01-02 23:52:11 +08:00
|
|
|
h=`$OPENSSL x509 -hash -noout -in $i`
|
1998-12-21 18:52:47 +08:00
|
|
|
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
|