@@ -132,22 +132,28 @@ func parseClientTrustResults(saltOutput []byte, unreachable map[string]bool) (
132132// CA file holds a certificate matching a given SHA-256 fingerprint.
133133// It prints "OK" on a match and "MISSING" otherwise.
134134const clientTrustCheckScript = `
135- caFile="/etc/pki/trust/anchors/RHN-ORG-TRUSTED-SSL-CERT"
135+ found=MISSING
136136
137- # Without the managed CA file the minion cannot trust the new CA yet.
138- [ -f "$caFile" ] || { echo MISSING; exit 0; }
137+ for caFile in \
138+ /etc/pki/trust/anchors/RHN-ORG-TRUSTED-SSL-CERT \
139+ /etc/pki/ca-trust/source/anchors/RHN-ORG-TRUSTED-SSL-CERT \
140+ /usr/local/share/ca-certificates/RHN-ORG-TRUSTED-SSL-CERT.crt; do
141+ # Skip the locations that do not apply to this minion's OS.
142+ [ -f "$caFile" ] || continue
139143
140- # Split the (possibly multi-cert) CA file into one file per certificate.
141- d=$(mktemp -d)
142- trap 'rm -rf "$d"' EXIT
143- csplit -z -s -f "$d/cert-" "$caFile" '/-----BEGIN CERTIFICATE-----/' '{*}' 2>/dev/null
144+ # Split the (possibly multi-cert) CA file into one file per certificate.
145+ d=$(mktemp -d)
146+ csplit -z -s -f "$d/cert-" "$caFile" '/-----BEGIN CERTIFICATE-----/' '{*}' 2>/dev/null
144147
145- # Report OK as soon as one of the certificates matches the expected fingerprint.
146- found=MISSING
147- for cert in "$d"/cert-*; do
148- fp=$(openssl x509 -in "$cert" -noout -fingerprint -sha256 2>/dev/null | cut -d= -f2)
149- [ "$fp" = "%[1]s" ] && found=OK
148+ # Report OK as soon as one of the certificates matches the expected fingerprint.
149+ for cert in "$d"/cert-*; do
150+ fp=$(openssl x509 -in "$cert" -noout -fingerprint -sha256 2>/dev/null | cut -d= -f2)
151+ [ "$fp" = "%[1]s" ] && found=OK
152+ done
153+
154+ rm -rf "$d"
150155done
156+
151157echo "$found"
152158`
153159
0 commit comments