forked from department-of-veterans-affairs/vets-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimport-va-certs.sh
executable file
·37 lines (30 loc) · 1003 Bytes
/
import-va-certs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#! /usr/bin/env bash
set -euo pipefail
(
cd /usr/local/share/ca-certificates/
curl -LO https://cacerts.digicert.com/DigiCertTLSRSASHA2562020CA1-1.crt.pem
curl -LO https://digicert.tbs-certificats.com/DigiCertGlobalG2TLSRSASHA2562020CA1.crt
wget \
--level=1 \
--quiet \
--recursive \
--no-parent \
--no-host-directories \
--no-directories \
--accept="VA*.cer" \
http://aia.pki.va.gov/PKI/AIA/VA/
for cert in *.{cer,pem}
do
if file "${cert}" | grep 'PEM'
then
cp "${cert}" "${cert}.crt"
else
openssl x509 -in "${cert}" -inform der -outform pem -out "${cert}.crt"
fi
rm "${cert}"
done
update-ca-certificates --fresh
# Display VA Internal certificates that are now trusted
awk -v cmd='openssl x509 -noout -subject' '/BEGIN/{close(cmd)};{print | cmd}' < /etc/ssl/certs/ca-certificates.crt \
| grep -iE '(VA-Internal|DigiCert)'
)