How to get root certifiacte for gitlab.com

Viewed 80

I'm trying to get root certificate for gitlab.com so that I can download files/build artifacts from repository using GitLab API (I need this due for HTTPS authentication from an IoT device).
For GitHub, I used the following command, provided by the MCU manufacture for OTA:

echo "" | \
openssl s_client -showcerts -connect api.github.com:443 | \
sed -n "1,/Root/d; /BEGIN/,/END/p" | openssl x509 -outform PEM

However, the same (replacing api.github with gitlab.com) doesn't get the root certificate. I'm a beginner, so can some please help.

1 Answers

From issue 15364, you should be able to see the root CA (and 2 intermediate CAs) with:

echo | openssl s_client -connect gitlab.com:443 -showcerts
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 = gitlab.com
verify return:1
CONNECTED(00000005)
---
Certificate chain
 0 s:CN = gitlab.com
   i:C = GB, ST = Greater Manchester, L = Salford, O = Sectigo Limited, CN = Sectigo RSA Domain Validation Secure Server CA
-----BEGIN CERTIFICATE-----
<snip>                         <<<<====== Root CA
-----END CERTIFICATE-----
 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
-----BEGIN CERTIFICATE-----
<snip>
-----END CERTIFICATE-----
 2 s:C = US, ST = New Jersey, L = Jersey City, O = The USERTRUST Network, CN = USERTrust RSA Certification Authority
   i:C = GB, ST = Greater Manchester, L = Salford, O = Comodo CA Limited, CN = AAA Certificate Services
-----BEGIN CERTIFICATE-----
<snip>
-----END CERTIFICATE-----
Related