greg_vaslo
06/30/2022, 8:36 PMHTTPSConnectionPool(host='<http://hub.meltano.com|hub.meltano.com>', port=443): Max retries exceeded with url: /meltano/api/v1/plugins/loaders/index (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1131)')))will_johnson
06/30/2022, 9:00 PMgreg_vaslo
06/30/2022, 9:12 PMwill_johnson
06/30/2022, 9:15 PMwill_johnson
06/30/2022, 9:16 PMgreg_vaslo
06/30/2022, 9:17 PMgreg_vaslo
06/30/2022, 9:18 PMaaronsteers
06/30/2022, 9:28 PMgreg_vaslo
06/30/2022, 9:31 PMchristoph
06/30/2022, 11:55 PMrequest via the REQUESTS_CA_BUNDLE environment variable. Depending on your Linux distribution, your custom Root CA Cert store will be in different locations, but basically, as long as you set the REQUESTS_CA_BUNDLE to the path that contains to the PEM file (e.g. /etc/ssl/certs/ca-certificates.crt on Debian/Ubuntu which is managed by update-ca-certificates to merge your internal custom Enterprise Root CAs) that has your complete customized Root CA bundle, then at least the majority of Python requests calls will work (Meltano SDK plugins won't work though, until we can do some more testing and work on this PR: https://github.com/meltano/sdk/issues/633)
With Python on Windows, the REQUESTS_CA_BUNDLE variable will still work, but on Windows you don't get the luxury of having the OS provide you a convenient file location where Windows would store the custom Root CA Cert store bundle for you in PEM format. You will need to generate such a file on Windows yourself (which is possible with certutil to dump your custom Windows Root CA Cert stores into a PEM formatted file)greg_vaslo
07/01/2022, 1:28 AMchristoph
07/01/2022, 2:01 AMwill_johnson
07/01/2022, 5:21 PMgreg_vaslo
07/05/2022, 9:31 PMgreg_vaslo
07/05/2022, 9:33 PMAll, I've come back again to look at this issue. I decided to try a few environments from the same PC. I started with the last version of Meltano v1 (1.105.0). I was able to install this and had no issues loading the taps and targets I needed. If I install a fresh environment with 2.0 or beyond, I run into the same issue as mentioned above. Is this because of the change to pull directly from Meltano hub? Is there a way to go back to pulling wherever it was pulling from before 2.0? I'm not getting much help from corporate IT. I'll also check in the Slack and see if there are any final ideas and will try just starting in 1.105.0 and then upgrading after I install the extractor and loader.christoph
07/05/2022, 10:07 PMcurl command will simply make a connection to the Meltano Plugin Inventory document and the command will spit out a lot of useful verbose logging information (-v) which will also include a section about the Server Certificate.
curl -s -o /dev/null -v <https://discovery.meltano.com/discovery.yml>
Just run this above command on the same system where you are experiencing the meltano problem.
The out put will include some lines that show the Server Certificate like this:
* Server certificate:
* subject: CN=<http://discovery.meltano.com|discovery.meltano.com>
* start date: Jun 29 18:33:00 2022 GMT
* expire date: Oct 28 21:59:54 2022 GMT
* subjectAltName: host "<http://discovery.meltano.com|discovery.meltano.com>" matched cert's "<http://discovery.meltano.com|discovery.meltano.com>"
* issuer: C=US; ST=California; L=San Francisco; O=Cloudflare, Inc.; OU=Gateway Intermediate ECC Certificate Authority
* SSL certificate verify ok.
In this example output from my laptop, the important line is this one:
issuer: C=US; ST=California; L=San Francisco; O=Cloudflare, Inc.; OU=Gateway Intermediate ECC Certificate Authority
In my example, I have a Zero Trust Network Agent (from Cloudflare) installed on my computer which does the intercepting, which is why the issuer of the SSL Server Certificate for <http://discovery.meltano.com|discovery.meltano.com> shows up as CloudFlare Inc. (Gateway Intermediate ECC Certificate Authority), which is actually not the Issuing Authority which Meltano has used to install the real SSL Server Certificate on <http://discovery.meltano.com|discovery.meltano.com>
(The real issuer of the discovery.meltano.com SSL Certificate is acually "Let's Encrypt")
Armed with this knowledge, you should be able to find the root cause of why the SSL connection is failing on your computer, by just running that curl command and looking at the issuer line in the Server Certificate section.
That information will then help us correcting the issue on your computer in the next installment of this series. šgreg_vaslo
07/05/2022, 10:21 PM* Trying 34.204.131.44:443...
* TCP_NODELAY set
* Connected to <http://discovery.meltano.com|discovery.meltano.com> (34.204.131.44) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* TLSv1.3 (IN), TLS handshake, Server hello (2):
{ [88 bytes data]
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
} [1 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* TLSv1.3 (IN), TLS handshake, Server hello (2):
{ [155 bytes data]
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
{ [6 bytes data]
* TLSv1.3 (IN), TLS handshake, Certificate (11):
{ [3319 bytes data]
* TLSv1.3 (OUT), TLS alert, unknown CA (560):
} [2 bytes data]
* SSL certificate problem: self signed certificate in certificate chain
* Closing connection 0christoph
07/05/2022, 11:02 PMSSL certificate problem: self signed certificate in certificate chain ) with just a simple CURL command.
What you can do now to proceed, is to tell curl to just ignore this SSL certificate problem and then curl will just act like the broken SSL certificate chain is not a problem. You can use the -k switch in curl for that.
So, the command will look like this:
curl -k -s -o /dev/null -v <https://discovery.meltano.com/discovery.yml>
That should now give you the Server Certificate section in the verbose log outputgreg_vaslo
07/05/2022, 11:12 PMServer certificate:
* subject: CN=<http://discovery.meltano.com|discovery.meltano.com>
* start date: Jun 27 00:00:00 2022 GMT
* expire date: Sep 7 22:00:20 2022 GMT
* issuer: C=US; ST=Ohio; L=Cleveland; O=The Sherwin-Williams Company; OU=Information Security; CN=SW ZScaler
* SSL certificate verify result: self signed certificate in certificate chain (19), continuing anyway.christoph
07/05/2022, 11:42 PMopenssl in order to dump out the full SSL certificate chain contents from the ZScaler cloud instance, by simply repeating the same SSL handshake which curl performs from openssl.
openssl s_client -showcerts -connect <http://discovery.meltano.com:443|discovery.meltano.com:443>
That will spit out the BASE64 encoded SSL Server certificate chain which gets injected by the ZScaler cloud instance, which we will then use to configure the Operating System to trust your company's ZScaler self-signed Root CA certificate.
Here's what the output looks like for me via the my Cloudflare Zero Trust Network agent doing the SSL interception:
```CONNECTED(00000003)
depth=2 C = US, ST = California, L = San Francisco, O = "Cloudflare, Inc", CN = Cloudflare for Teams ECC Certificate Authority
verify return:1
depth=1 C = US, ST = California, L = San Francisco, O = "Cloudflare, Inc.", OU = Gateway Intermediate ECC Certificate Authority
verify return:1
depth=0 CN = discovery.meltano.com
verify return:1
---
Certificate chain
0 s:CN = discovery.meltano.com
i:C = US, ST = California, L = San Francisco, O = "Cloudflare, Inc.", OU = Gateway Intermediate ECC Certificate Authority
-----BEGIN CERTIFICATE-----
MIICOTCCAb6gAwIBAgIEBoyRpjAKBggqhkjOPQQDAjCBjjELMAkGA1UEBhMCVVMx
EzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28xGTAX
BgNVBAoTEENsb3VkZmxhcmUsIEluYy4xNzA1BgNVBAsTLkdhdGV3YXkgSW50ZXJt
ZWRpYXRlIEVDQyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMjIwNjI5MTgzMzAw
WhcNMjIxMDAxMjI1NzUzWjAgMR4wHAYDVQQDDBVkaXNjb3ZlcnkubWVsdGFuby5j
b20wdjAQBgcqhkjOPQIBBgUrgQQAIgNiAARmjFVqM8V6B+26EXYHliDSChpn+nU5
4RmKQZCexvGorafKKRdJOd9/+lLX6aOpAfiMyE+FABBrPcx6jFIAOZi9ZIgOvKBf
r9CQt8VInKET49Gt2ybZbzNjYGfiw0QgC/ejWjBYMBMGA1UdJQQMMAoGCCsGAQUF
BwMBMCAGA1UdEQQZMBeCFWRpc2NvdmVyeS5tZWx0YW5vLmNvbTAfBgNVHSMEGDAW
gBQbxiHdLaggqDajrTc7SEF0dJwYdjAKBggqhkjOPQQDAgNpADBmAjEAm/9t7KiT
/xN2tVfJEBfqFOyBZiMMVzfYP/63PTClhWoPQHr56ciJMNCab9oyVVCkAjEA5Ow2
kPOHqrVSSJ9LMy6CMs5hXG6vJ6GU1CMOgAgMICi6g9cKyppnkDNAq7f4n6e3
-----END CERTIFICATE-----
1 s:C = US, ST = California, L = San Francisco, O = "Cloudflare, Inc.", OU = Gateway Intermediate ECC Certificate Authority
i:C = US, ST = California, L = San Francisco, O = "Cloudflare, Inc", CN = Cloudflare for Teams ECC Certificate Authority
-----BEGIN CERTIFICATE-----
MIIC5zCCAkigAwIBAgIUc0Gjb2Mo7K3PbHHgeggfxKoJjjUwCgYIKoZIzj0EAwQw
gY0xCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T
YW4gRnJhbmNpc2NvMRgwFgYDVQQKEw9DbG91ZGZsYXJlLCBJbmMxNzA1BgNVBAMT
LkNsb3VkZmxhcmUgZm9yIFRlYW1zIEVDQyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkw
HhcNMjIwNjI5MTgzMzAwWhcNMjIwODAzMTgzMzAwWjCBjjELMAkGA1UEBhMCVVMx
EzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28xGTAX
BgNVBAoTEENsb3VkZmxhcmUsIEluYy4xNzA1BgNVBAsTLkdhdGV3YXkgSW50ZXJt
ZWRpYXRlIEVDQyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUr
gQQAIgNiAARzUHsD4WQ4MDWrrwkDp9iB3twGOrxKnPb92F4Ag/RdTQEHAGU3ercc
mYOqXFCwvFBZSmTR3TrK5MebUnifnPBlArr6p1pUvaTfJp2QH/4CEpQyYYpjZguc
TRaaU78W42SjZjBkMA4GA1UdDwEB/wQEAwICBDASBgNVHRMBAf8ECDAGAQH/AgEA
MB0GA1UdDgQWBBQbxiHdLaggqDajrTc7SEF0dJwYdjAfBgNVHSMEGDAWgBRgFxCe
DUAQww2165EMAwbT++AV7TAKBggqhkjOPQQDBAOBjAAwgYgCQgF2OQ3ksKsmUlH4
3axLy9ITlRBOqt8el1SYw6oe73R4n1p1Jx+k5OTLiMJh3jpPxrOErLLvEmD1EEyq
ezUPhA6sNgJCAcOAIkmOANnT36iEBxxn8Di4XkbdXE6s5E+wSKSHriLNyacM5BPv
oJzrVrQO80sUCXFcbWx7NQN+Oyn8SVPDQHiY
-----END CERTIFICATE-----
---
Server certificate
subject=CN = discovery.meltano.com
issuer=C = US, ST = California, L = San Francisco, O = "Cloudflare, Inc.", OU = Gateway Intermediate ECC Certificate Authority
---
No client certificate CA names sent
Peer signing digest: SHA384
Peer signature type: ECDSA
Server Temp Key: X25ā¦christoph
07/06/2022, 12:16 AMi:) and the 'Subject' (s:) are two different distinguished names.
In your ZSCaler case, you should get the actual ZScaler Root CA certificate in the openssl output (since we already now that python and curl are complaining about a self-signed certificate and the 'Root' of a certificate chain is always self-signed).christoph
07/06/2022, 12:16 AMgreg_vaslo
07/06/2022, 1:08 PMchristoph
07/06/2022, 2:06 PMs: and i: lines, thereby indicated a self-signed certificate, i.e. it is the 'Root CA Certificate' that is used by the ZScaler software (which is probably actually a software agent running on your Windows 10 machine in addition to the ZScaler Cloud Control plane, but that's just a minor implementation detail at this stage.)
The BASE64 encoded public key of the ZScaler Root CA certificate now needs to be stored as a .crt file in the /usr/local/share/ca-certificates folder in your Ubuntu WSL2 instance. You can name the file whatever you want, but the file extension MUST be .crt, otherwise Ubuntu will not accept it as a certificate public key file.
And as a final step, after you created the .crt file in /usr/local/share/ca-certificates with the BASE64 encoded public key from the openssl output, you'll need to run the magical command to actually install this new additional custom Root CA certificate in Ubuntu, which is:
sudo update-ca-certificates
The output will look like this:
Updating certificates in /etc/ssl/certs...
rehash: warning: skipping ca-certificates.crt,it does not contain exactly one certificate or CRL
rehash: warning: skipping Cloudflare_CA.pem,it does not contain exactly one certificate or CRL
1 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
With the 1 added, 0 removed; done. line indicating the success of the installation.
After that, you can run the original first curl command WITHOUT the -k switch again, and now curl should be able to validate the SSL Certificate chain successfully!
curl -s -o /dev/null -v <https://discovery.meltano.com/discovery.yml>
If this curl command works, you are now ready to install meltano plugins! š
All you have to do to make meltano's network library (Python requests library) aware of the customized Root CA configuration is to point the requests library to the correct location of the Ubuntu CA Certificate store (which got updated by the update-ca-certificates command).
To do so, you'll need to use the environment variable REQUESTS_CA_BUNDLE like so:
export REQUESTS_CA_BUNDLE="/etc/ssl/certs/ca-certificates.crt"
After that, you can run meltano install and the plugin downloads should work.greg_vaslo
07/08/2022, 9:02 PMchristoph
07/08/2022, 10:12 PMREQUESTS_CA_BUNDLE setting. The old PR/MR is here, but I haven't had a chance to revisit it after learning more about the SDK behaviour regarding this issue in the wild.
https://gitlab.com/meltano/sdk/-/merge_requests/256aaronsteers
07/09/2022, 9:42 PMgreg_vaslo
07/12/2022, 2:59 PMchristoph
07/12/2022, 10:31 PMrequests library is being called in certain taps.
Which meltano command are you issuing when you get the error?