Skip to content

Instantly share code, notes, and snippets.

@oogali
Created December 27, 2015 17:23
Show Gist options
  • Save oogali/47492bafbe683a92fdb9 to your computer and use it in GitHub Desktop.
Save oogali/47492bafbe683a92fdb9 to your computer and use it in GitHub Desktop.
c_rehash hack for FreeBSD
#!/bin/sh
if [ $# -ne 1 ]; then
echo "${0} <directory of PEMs>"
exit 1
fi
certdir=${1}
if [ -z "${certdir}" ]; then
echo "Must specify path to directory of PEMs"
exit 1
fi
if [ ! -d "${certdir}" ]; then
echo "Directory does not exist"
exit 1
fi
(
cd ${1} &&
for f in *.pem ; do
ln -s ${f} $(openssl x509 -hash -noout -in ${f}).0
done
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment