Only download CRL once #16
+8
-2
@@ -535,7 +535,7 @@ download_crls_for_chain() {
|
|||||||
assert "[ -f $CERT_FILE ]" "Precondition: Certificate file $CERT_FILE must exist."
|
assert "[ -f $CERT_FILE ]" "Precondition: Certificate file $CERT_FILE must exist."
|
||||||
|
|
||||||
echo -n > "$OUTPUT_FILE"
|
echo -n > "$OUTPUT_FILE"
|
||||||
local CRL_TMP="$TMP_DIR"/crl_tmp.crl
|
|
||||||
#remove files from possible previous runs
|
#remove files from possible previous runs
|
||||||
rm -f "$TMP_DIR"/*.extracted.pem.cer
|
rm -f "$TMP_DIR"/*.extracted.pem.cer
|
||||||
#extract all contained certificates into separate files
|
#extract all contained certificates into separate files
|
||||||
@@ -553,7 +553,13 @@ download_crls_for_chain() {
|
|||||||
local URL=$(openssl x509 -inform PEM -in $EXTRACTED_CERT -text -noout \
|
local URL=$(openssl x509 -inform PEM -in $EXTRACTED_CERT -text -noout \
|
||||||
| awk '/CRL Distribution Points:/{f=1} f && /URI:/ {print; exit}' \
|
| awk '/CRL Distribution Points:/{f=1} f && /URI:/ {print; exit}' \
|
||||||
| sed 's/^.*URI://1')
|
| sed 's/^.*URI://1')
|
||||||
if curl -L "$URL" --output "$CRL_TMP" &> "$OUT_STREAM"; then
|
local CRL_TMP="$TMP_DIR"/crl_tmp.$(echo "$URL" | sha256sum -z | awk '{printf "%s",$1}').crl
|
||||||
|
local CURL_EXIT_CODE=0
|
||||||
|
if [ ! -f $CRL_TMP ]; then
|
||||||
|
curl -L "$URL" --output "$CRL_TMP" &> "$OUT_STREAM"
|
||||||
|
CURL_EXIT_CODE=$?
|
||||||
|
fi
|
||||||
|
if [ $CURL_EXIT_CODE -eq 0 ]; then
|
||||||
if openssl crl -in "$CRL_TMP" -inform DER -noout &> "$OUT_STREAM"; then
|
if openssl crl -in "$CRL_TMP" -inform DER -noout &> "$OUT_STREAM"; then
|
||||||
openssl crl -in "$CRL_TMP" -inform DER >> "$OUTPUT_FILE"
|
openssl crl -in "$CRL_TMP" -inform DER >> "$OUTPUT_FILE"
|
||||||
elif openssl crl -in "$CRL_TMP" -inform PEM -noout &> "$OUT_STREAM"; then
|
elif openssl crl -in "$CRL_TMP" -inform PEM -noout &> "$OUT_STREAM"; then
|
||||||
|
|||||||
Reference in new issue
Block a user