2010-04-01 18:22:04 +02:00
|
|
|
#!/bin/bash
|
|
|
|
# print fingerprints of new or changed certificates
|
|
|
|
set -e
|
|
|
|
cleanup()
|
|
|
|
{
|
|
|
|
rm -rf new{,.files} old{,.files}
|
|
|
|
}
|
|
|
|
showcert()
|
|
|
|
{
|
|
|
|
openssl x509 -in "$1" -noout -subject -fingerprint -nameopt multiline,utf8,-esc_msb \
|
2014-06-04 10:39:37 +02:00
|
|
|
| sed -ne 's/ *commonName *= / CN=/p; s/.*Fingerprint=/ sha1=/p'
|
|
|
|
sed -ne '/^# \(openssl\|distrust\|alias\)/s/^#/ /p' < "$1"
|
2010-04-01 18:22:04 +02:00
|
|
|
}
|
|
|
|
cleanup
|
|
|
|
trap cleanup EXIT
|
|
|
|
mkdir old new
|
|
|
|
cd old
|
|
|
|
echo old...
|
2013-07-02 15:57:37 +02:00
|
|
|
ln -s ../.osc/certdata.txt
|
2018-07-06 16:41:33 +02:00
|
|
|
python3 ../certdata2pem.py > stdout 2> stderr
|
2019-11-24 11:23:31 +01:00
|
|
|
ls -1 cert-* | sort > ../old.files
|
2010-04-01 18:22:04 +02:00
|
|
|
cd ..
|
|
|
|
cd new
|
|
|
|
echo new...
|
2013-07-02 15:57:37 +02:00
|
|
|
ln -s ../certdata.txt
|
2018-07-06 16:41:33 +02:00
|
|
|
python3 ../certdata2pem.py > stdout 2> stderr
|
2019-11-24 11:23:31 +01:00
|
|
|
ls -1 cert-* | sort > ../new.files
|
2010-04-01 18:22:04 +02:00
|
|
|
cd ..
|
|
|
|
echo '----------------------------'
|
|
|
|
while read line; do
|
|
|
|
IFS='#' eval set -- \$line
|
|
|
|
old="$1"
|
|
|
|
new="$2"
|
|
|
|
common="$3"
|
|
|
|
if [ -n "$old" ]; then
|
2014-06-04 10:39:37 +02:00
|
|
|
echo "- $old"
|
2012-05-03 14:41:21 +02:00
|
|
|
showcert old/$old
|
2010-04-01 18:22:04 +02:00
|
|
|
elif [ -n "$new" ]; then
|
2014-06-04 10:39:37 +02:00
|
|
|
echo "+ $new"
|
2010-04-01 18:22:04 +02:00
|
|
|
showcert new/$new
|
|
|
|
elif ! cmp "old/$common" "new/$common"; then
|
2014-06-04 10:39:37 +02:00
|
|
|
echo "~ $common"
|
2010-04-01 18:22:04 +02:00
|
|
|
showcert old/$common
|
2011-01-31 14:45:35 +01:00
|
|
|
showcert new/$common
|
|
|
|
diff -u old/$common new/$common || true
|
2010-04-01 18:22:04 +02:00
|
|
|
fi
|
|
|
|
done < <(comm --output-delimiter='#' old.files new.files)
|