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

Build prebuilt addon libcurl with ca bundle #224

Open
JCMais opened this issue May 28, 2020 · 4 comments
Open

Build prebuilt addon libcurl with ca bundle #224

JCMais opened this issue May 28, 2020 · 4 comments
Assignees
Labels
Milestone

Comments

@JCMais
Copy link
Owner

JCMais commented May 28, 2020

This can be done by passing the option --with-ca-bundle. Doing that would make it much easier to use the library with https sites, as the client would not be required to pass CURLOPT_CAINFO anymore.

Node.js version >= v12.3.0 exposes the certificates it was bundled with, we could use them at build time: https://nodejs.org/api/tls.html#tls_tls_rootcertificates

To generate a file from the property, it as simple as doing this:

import fs from 'fs'
import path from 'path'
import tls from 'tls'

const certFilePath = path.join(__dirname, 'cert.pem')

const tlsData = tls.rootCertificates.join('\n')
fs.writeFileSync(certFilePath, tlsData)
@JCMais JCMais added the feature label May 28, 2020
@JCMais JCMais added this to the v2.1.2 milestone May 28, 2020
@JCMais JCMais self-assigned this May 28, 2020
@JCMais
Copy link
Owner Author

JCMais commented May 29, 2020

Using --with-ca-bundle is in fact not possible, as it does not embed the bundle on the libcurl library itself, it's checked at runtime.

@JCMais
Copy link
Owner Author

JCMais commented May 29, 2020

curl/curl#4679 might be what we need.

@JCMais JCMais modified the milestones: v2.1.2, v2.1.3 Jun 2, 2020
@JCMais JCMais modified the milestones: v2.1.3, v2.1.4 Jun 21, 2020
@JCMais JCMais modified the milestones: v2.1.4, v2.3.0 Jul 14, 2020
@johnwchadwick
Copy link
Contributor

johnwchadwick commented Jul 23, 2021

curl now has this ability to load ca certs from memory of curl 7.77; it landed in curl/curl#6662. However, it requires support for blob options (#253). In order to move this closer to the goal I've opened a PR for supporting blob options (#300) but it doesn't add support for all of the new options, and the curl for windows repo would need to be updated too I assume.

@JCMais
Copy link
Owner Author

JCMais commented Jul 23, 2021

Hey @johnwchadwick, thanks a lot for these! I will try to get those reviewed (and merged) in the following days.

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

No branches or pull requests

2 participants