-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
Fix CA certificates #189
Fix CA certificates #189
Conversation
10ed3ba
to
9fa72be
Compare
hey, @throwaway96! you and i may come to some agreement. :) |
Can we please just get this merged so the homebrew channel actually works again? |
This should work on all webOS versions. It loads certificates from the Mozilla CA cert bundle. Users may add additional certs by placing PEM-encoded files in the "certs" directory. The code for loading the certs can be found at: https://github.com/throwaway96/node-load-cert-dir
9fa72be
to
bede23f
Compare
I think this can be merged once we get a few positive reports from people testing v0.7.0-test2. Worked fine for me on webOS 6 (o20n). |
The v0.7.0-test2 of Homebrew Channel works for my LG SM9000PLA with webOS 4.x and firmware v05.40.45 🥳 |
The
node
binary contains a built-in set of trusted CA certificates that never gets updated. Therefore, Node.js services are stuck using whatever certs were bundled when that potentially ancient Node version was released.Newer versions of Node.js (on webOS 5+) support the
--use-openssl-ca
option, which makesnode
use/etc/ssl/certs
instead of its own bundle—but that doesn't help us on older versions. Indeed, there doesn't seem to be a clean way to fix this globally on Node 0.10.x and 0.12.x. So, I ended up creating a wrapper aroundfetch()
that controls what certificates it trusts.All PEM certs in
<service dir>/certs
will be treated as trusted. I have included the Mozilla CA cert bundle from curl, but users can also add additional certs. If people don't think that's useful, I could simplify the code by just loading a single file (which users could still modify). We could also theoretically just embed the certs in a JS file and avoid the "parsing" part altogether, but that would significantly reduce flexibility.While testing this on webOS 1, I was able to download and install Kodi and apps hosted on GitHub. It could use more testing on other webOS versions. It's not perfect, but I'm tired. And I want to get a release out this year.