TritonDataCenter / sdc-docker

Docker Engine for Triton
Mozilla Public License 2.0
183 stars 49 forks source link

sdc-docker-setup.sh silently fails for certificate errors #56

Closed jamesabbottsmith closed 2 years ago

jamesabbottsmith commented 8 years ago

I had incorrectly set the docker hostname in the cloud api to the IP address, not a hostname. This caused curl to fail when pulling out ca.pem from the docker host.

This would have been easy to spot, except that this error gets thrown away and sdc-docker-setup.sh appears to complete successfully.

sdc-docker-setup.sh:250
    curl $CURL_OPTS $curlOpts --connect-timeout 10 \
        --url "$dockerHttpsUrl/ca.pem" -o $outFile 2>/dev/null

I removed '2>/dev/null' and then I could clearly see what was broken

# bash sdc-docker-setup.sh URL NAME KEY
...
Docker service endpoint is: tcp://10.12.14.13:2376
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (60) SSL certificate problem: Invalid certificate chain
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.
travispaul commented 2 years ago

sdc-docker-setup.sh -k can be used to bypass certificate validation. However, Triton CLI is the preferred method to configure Docker clients:

$ triton profile docker-setup
...
$ eval "$(triton env --docker)"

Due to the age of this issue and the fact that we're moving away fromsdc-docker-setup.sh (it also has some issues on newer OpenSSL versions) I'm going to go ahead and close this issue.