rollbar / terraform-provider-rollbar

Terraform provider for Rollbar
https://rollbar.com
MIT License
28 stars 13 forks source link

Unknown Authority Error Triggered by Connecting to Non-Default $ROLLBAR_API_URL #204

Closed msgSend closed 3 years ago

msgSend commented 3 years ago

The certificate used by a testing endpoint is valid and the CA is in the list of known authorities when manually queried via cURL, but is not accepted by the provider and returns the following error: x509: certificate signed by unknown authority.

jmcvetta commented 3 years ago

@msgSend Please include steps for reproducing the bug when opening an Issue.

jmcvetta commented 3 years ago

From Slack conversation, the non-default URL used was https://api-staging.rollbardev.com/

jmcvetta commented 3 years ago

Example failure:

$ ROLLBAR_API_URL=https://api-staging.rollbardev.com terraform plan
rollbar_team.test_team_0: Refreshing state... [id=704936]

Error: Get "https://api-staging.rollbardev.com/api/1/projects": x509: certificate signed by unknown authority

Error: Get "https://api-staging.rollbardev.com/api/1/team/704936": x509: certificate signed by unknown authority
jmcvetta commented 3 years ago

Certificate fails also fails to verify for me using httpie:

$ http GET https://api-staging.rollbardev.com/api/1/projects

http: error: SSLError: HTTPSConnectionPool(host='api-staging.rollbardev.com', port=443): Max retries exceeded with url: /api/1/projects (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)'))) while doing GET request to URL: https://api-staging.rollbardev.com/api/1/projects
jmcvetta commented 3 years ago

The openssl tool also fails to verify this cert:

$ openssl s_client -connect api-staging.rollbardev.com:443
CONNECTED(00000003)
depth=0 CN = *.rollbardev.com
verify error:num=20:unable to get local issuer certificate
verify return:1
depth=0 CN = *.rollbardev.com
verify error:num=21:unable to verify the first certificate
verify return:1
---
Certificate chain
 0 s:CN = *.rollbardev.com
   i:C = GB, ST = Greater Manchester, L = Salford, O = Sectigo Limited, CN = Sectigo RSA Domain Validation Secure Server CA
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIGOzCCBSOgAwIBAgIQKahrfJ3Q7c04GDYdJChdIjANBgkqhkiG9w0BAQsFADCB
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= Greater Manchester, L = Salford, O = Sectigo Limited, CN = Sectigo RSA Domain Validation Secure Server CA

---
No client certificate CA names sent
Peer signing digest: SHA256
Peer signature type: RSA-PSS
Server Temp Key: X25519, 253 bits
---
SSL handshake has read 2089 bytes and written 398 bytes
Verification error: unable to verify the first certificate
---
New, TLSv1.3, Cipher is TLS_AES_256_GCM_SHA384
Server public key is 2048 bit
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
Early data was not sent
Verify return code: 21 (unable to verify the first certificate)
---
jmcvetta commented 3 years ago

Based on the output shown above, I suspect the server at https://api-staging.rollbardev.com may be misconfigured.

@msgSend @mrunalk who is responsible for host api-staging.rollbardev.com, so we can include them in this conversation?

jmcvetta commented 3 years ago

@msgSend when can I expect an update on this? The staging server's cert appears to be misconfigured. Who is responsible for that system?

msgSend commented 3 years ago

@jmcvetta, I apologize for the very delayed response. I think you're spot on about the issue, it looks like the certificate chain wasn't added to the configuration. I have added it and it appears that everything is happy now. Consequently, I think we can close this out. Please reopen if you feel the need to do so.

CONNECTED(00000005)
depth=2 C = US, ST = New Jersey, L = Jersey City, O = The USERTRUST Network, CN = USERTrust RSA Certification Authority
verify return:1
depth=1 C = GB, ST = Greater Manchester, L = Salford, O = Sectigo Limited, CN = Sectigo RSA Domain Validation Secure Server CA
verify return:1
depth=0 CN = *.rollbardev.com
verify return:1
---
Certificate chain
 0 s:/CN=*.rollbardev.com
   i:/C=GB/ST=Greater Manchester/L=Salford/O=Sectigo Limited/CN=Sectigo RSA Domain Validation Secure Server CA
 1 s:/C=GB/ST=Greater Manchester/L=Salford/O=Sectigo Limited/CN=Sectigo RSA Domain Validation Secure Server CA
   i:/C=US/ST=New Jersey/L=Jersey City/O=The USERTRUST Network/CN=USERTrust RSA Certification Authority
---