Skip to content

Commit

Permalink
(maint) Add retries to curl calls in ssl.sh
Browse files Browse the repository at this point in the history
 - Adds 5 retries (including connection refused) at 2 second intervals
   to the curl commands being used to download the CA and handle other
   cert related negotiation.

 - We're experiencing issues under LCOW where DNS resolution works in
   early waiter scripts, but subsequently fails when handling certs.

   This may be due to an unresolved bug in libnetwork OR it may be due
   to the fact that the Docker DNS resolver is not designed to handle
   heavy loads and may intermittently fail requests.
  • Loading branch information
Iristyle committed Apr 30, 2019
1 parent 151f20a commit 847a107
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions shared/ssl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ CRLFILE="${SSLDIR}/crl.pem"
CA="https://${PUPPETSERVER_HOSTNAME}:8140/puppet-ca/v1"
CERTSUBJECT="/CN=${CERTNAME}"
CERTHEADER="-----BEGIN CERTIFICATE-----"
CURLFLAGS="--silent --show-error --cacert ${CACERTFILE}"
CURLFLAGS="--silent --show-error --cacert ${CACERTFILE} --retry 5 --retry-connrefused --retry-delay 2"

### Print configuration for troubleshooting
msg "Using configuration values:"
Expand All @@ -73,7 +73,7 @@ msg "* WAITFORCERT: '${WAITFORCERT}' seconds"

### Get the CA certificate for use with subsequent requests
### Fail-fast if curl errors or the CA certificate can't be parsed
curl --insecure --silent --show-error --output "${CACERTFILE}" "${CA}/certificate/ca"
curl --insecure --silent --show-error --output "${CACERTFILE}" --retry 5 --retry-connrefused --retry-delay 2 "${CA}/certificate/ca"
if [ $? -ne 0 ]; then
error "cannot reach CA host '${PUPPETSERVER_HOSTNAME}'"
elif ! openssl x509 -subject -issuer -noout -in "${CACERTFILE}"; then
Expand Down

0 comments on commit 847a107

Please sign in to comment.