Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: unable to get local issuer certificate #53

Closed
jwang242 opened this issue Sep 13, 2023 · 8 comments
Closed

Error: unable to get local issuer certificate #53

jwang242 opened this issue Sep 13, 2023 · 8 comments

Comments

@jwang242
Copy link

Setup-nuget action failed on self-hosted MacOS runner.
Error: unable to get local issuer certificate

I have exported our company certificate from keychain and added the NODE_EXTRA_CA_CERTS environment variable (value is the path of the certificate file) to the runner .env file. Restarted the runner but got the same error.

I also modified the "setup nuget" step in the workflow file with the environment variable but it made no difference.
name: Setup NuGet.exe
uses: NuGet/setup-nuget@v1.0.7
env:
NODE_EXTRA_CA_CERTS: TheCertificatePath

Please help.

@jeffkl
Copy link
Contributor

jeffkl commented Sep 13, 2023

The setup-nuget action simply downloads NuGet.exe from https://dist.nuget.org. It sounds like the certificate chain is broken and the machine is unable to verify the certificate of the remote URL.

@jwang242
Copy link
Author

The browser on the machine can access https://dist.nuget.org without issue. So the certificate is fine. The runner machine is behind a corporate proxy. The issue seems to be related with Node's inability to use the certificate from macOS Keychain, nodejs/node#39657. Any thoughts? I tried the NODE_EXTRA_CA_CERTS variable workaround but had no success.

@dtivel
Copy link

dtivel commented Sep 13, 2023

Here's a shot in the dark. Can you try adding this intermediate certificate into Node's extra certs bundle?

# Subject:   CN=Microsoft Azure TLS Issuing CA 01, O=Microsoft Corporation, C=US
# Issuer:    CN=DigiCert Global Root G2, OU=www.digicert.com, O=DigiCert Inc, C=US
# Validity:  2020-07-29 12:30:00.000Z - 2024-06-27 23:59:59.000Z
# SHA-256:   24c7299864e0a2a6964f551c0e8df2461532fa8c48e4dbbb6080716691f190e5
# SHA-1:     2f2877c5d778c31e0f29c7e371df5471bd673173
# Purposes:  Server Authentication, Client Authentication
-----BEGIN CERTIFICATE-----
MIIF8zCCBNugAwIBAgIQCq+mx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etZJAgMB
AAGjggGtMIIBqTAdBgNVHQ4EFgQUDyBd16FXlduSzyvQx8J3BM5ygHYwHwYDVR0j
BBgwFoAUTiJUIBiV5uNu5g/6+rkS7QYXjzkwDgYDVR0PAQH/BAQDAgGGMB0GA1Ud
JQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjASBgNVHRMBAf8ECDAGAQH/AgEAMHYG
CCsGAQUFBwEBBGowaDAkBggrBgEFBQcwAYYYaHR0cDovL29jc3AuZGlnaWNlcnQu
Y29tMEAGCCsGAQUFBzAChjRodHRwOi8vY2FjZXJ0cy5kaWdpY2VydC5jb20vRGln
aUNlcnRHbG9iYWxSb290RzIuY3J0MHsGA1UdHwR0MHIwN6A1oDOGMWh0dHA6Ly9j
cmwzLmRpZ2ljZXJ0LmNvbS9EaWdpQ2VydEdsb2JhbFJvb3RHMi5jcmwwN6A1oDOG
MWh0dHA6Ly9jcmw0LmRpZ2ljZXJ0LmNvbS9EaWdpQ2VydEdsb2JhbFJvb3RHMi5j
cmwwHQYDVR0gBBYwFDAIBgZngQwBAgEwCAYGZ4EMAQICMBAGCSsGAQQBgjcVAQQD
AgEAMA0GCSqGSIb3DQEBDAUAA4IBAQAlFvNh7QgXVLAZSsNR2XRmIn9iS8OHFCBA
WxKJoi8YYQafpMTkMqeuzoL3HWb1pYEipsDkhiMnrpfeYZEA7Lz7yqEEtfgHcEBs
K9KcStQGGZRfmWU07hPXHnFz+5gTXqzCE2PBMlRgVUYJiA25mJPXfB00gDvGhtYa
+mENwM9Bq1B9YYLyLjRtUz8cyGsdyTIG/bBM/Q9jcV8JGqMU/UjAdh1pFyTnnHEl
Y59Npi7F87ZqYYJEHJM2LGD+le8VsHjgeWX2CJQko7klXvcizuZvUEDTjHaQcs2J
+kPgfyMIOY1DMJ21NxOJ2xPRC/wAh/hzSBRVtoAnyuxtkZ4VjIOh
-----END CERTIFICATE-----

@jwang242
Copy link
Author

Thanks for your replies. After I exported the certificate to PEM format (instead of the CER format which was the default when done previously), the 'Setup Nuget.exe' action succeeded with the NODE_EXTRA_CA_CERTS workaround.

@dtivel
Copy link

dtivel commented Sep 13, 2023

Glad it worked. Here's what I think the problem/solution was.

To build a certificate chain, you start from the end certificate and build to a root certificate. Usually, for publicly trusted certificates, there is one or more intermediate certificates in the middle. You already have the end certificate and, hopefully, the root certificate is already installed locally as a trusted root. Getting all intermediate certificates is a remaining task.

Many certificate chain building engines take advantage of an Authority Information Access (AIA) attribute in the certificate that provides a download URL for the issuing CA's certificate. Following the AIA attributes or "AIA chasing" is how you make intermediate certificates available locally for chain building.

Node.js doesn't do AIA chasing.

So, you have to manually download intermediate certificates and put them in a file for Node.js to use. I grabbed the intermediate certificate for the SSL certificate for https://dist.nuget.org/ and posted it in PEM format.

This should be documented.

@dtivel dtivel closed this as completed Sep 13, 2023
@dtivel
Copy link

dtivel commented Sep 13, 2023

@jwang242, just to be super clear, which certificate did you export and specify using the NODE_EXTRA_CA_CERTS workaround? Was it your corporate proxy's intermediate CA's certificate or was it the intermediate certificate I posted above (for https://dist.nuget.org)?

@jwang242
Copy link
Author

jwang242 commented Sep 13, 2023

It's the corporate's Cisco Umbrella Root certificate which has already been installed locally.

@MartinBarkerPhilips
Copy link

It's the corporate's Cisco Umbrella Root certificate which has already been installed locally.

Where do you find this certificate ? I am facing the same error message as in your original post. My runner is on a coporate desktop machine, i have cisco anyconnect secure mobility client installed but am not sure how to fix this error message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants