when I using this command to pull code:
➜ rt-analysis-multibranch_zhuolian git:(zhuolian) git pull
fatal: unable to access 'https://gitlab.example.com/development/soa-report-analysis.git/': SSL certificate problem: certificate has expired
I am sure the certificate not expired because on other macOS PC I could pull code from the same url. The server side certificate was generate by Let's Encrypt. The macOS Catalina openssl version is:
➜ ~ openssl version
LibreSSL 2.6.5
I tried to using curl, error like this:
➜ rt-analysis-multibranch_zhuolian git:(zhuolian) curl https://gitlab.example.com/development/soa-report-analysis.git
curl: (60) SSL certificate problem: certificate has expired
More details here: https://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.
HTTPS-proxy has similar options --proxy-cacert and --proxy-insecure.
why would this happen? what should I do to fix it? I can access the repo from Google Chrome browser by using the same url.
I finnaly found out that my last time renew the let's encrypt certificate using ISRG Root X1 root certificate by default. the ISRG Root X1 only compatible with macOS 10.12.1. But why the curl command seems to verify the old certificate. why would this happen?
See this answer from Ask Different, shamelessly reposted below:
OpenSSL on macOS does not use the system keychain (which makes sense as it's a cross platform library) but rather has its own
.pemfile containing its root certificates. Even though my systems have a newer version of OpenSSL installed using homebrew and/or MacPorts, the system-wide OpenSSL pem file located at/etc/ssl/cert.pemwas out of date and did not include the ISRG Root X1 certificate.The solution:
- Rename
/etc/ssl/cert.pemto something else. (I suggest/etc/ssl/cert.pem.org)- Download the latest
cacert.pemfrom https://curl.se/docs/caextract.html- Rename it to
cert.pem- Copy it to
/etc/ssl/cert.pemNow
curland any other app using OpenSSL can access websites signed using current Let's Encrypt certificates.Alternatively, the MacPorts package
curl-ca-bundleinstalls a.pemfile containing ISRG Root X1 to/opt/local/etc/openssl/cert.pemwhich can be used as well.Other possible solutions:
- Manually add the ISRG Root X1 certificate to
/etc/ssl/cert.pem- Configure OpenSSL to use a different
.pemfile for its root certificates, such as/opt/local/etc/openssl/cert.pem
(Another possible solution is to use curl's -k/--insecure flag.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With