|
| 1 | +# Updating the Root Certificates |
| 2 | + |
| 3 | +Node.js contains a compiled-in set of root certificates used as trust anchors |
| 4 | +for TLS certificate validation. |
| 5 | + |
| 6 | +The certificates come from Mozilla, specifically NSS's `certdata.txt` file. |
| 7 | + |
| 8 | +The PEM encodings of the certificates are converted to C strings, and committed |
| 9 | +in `src/node_root_certs.h`. |
| 10 | + |
| 11 | +## When to update |
| 12 | + |
| 13 | +Root certificates should be updated sometime after Mozilla makes an NSS release, |
| 14 | +check the [NSS release schedule][]. |
| 15 | + |
| 16 | +## Process |
| 17 | + |
| 18 | +Commands assume that the current working directory is the root of a checkout of |
| 19 | +the nodejs/node repository. |
| 20 | + |
| 21 | +1. Find NSS metadata for update. |
| 22 | + |
| 23 | +The latest released NSS version, release date, Firefox version, and Firefox |
| 24 | +release date can be found in the [NSS release schedule][]. |
| 25 | + |
| 26 | +The tag to fetch `certdata.txt` from is found by looking for the release |
| 27 | +version in the [tag list][]. |
| 28 | + |
| 29 | +2. Update `certdata.txt` from the NSS release tag. |
| 30 | + |
| 31 | +Update the tag in the commands below, and run: |
| 32 | +```shell |
| 33 | +cd tools/ |
| 34 | +./mk-ca-bundle -v 2>_before |
| 35 | +curl -O https://hg.mozilla.org/projects/nss/raw-file/NSS_3_41_RTM/lib/ckfw/builtins/certdata.txt |
| 36 | +``` |
| 37 | + |
| 38 | +The `_before` file will be used later. Verify that running `mk-ca-bundle` made |
| 39 | +no changes to `src/node_root_certs.h`. If it did, something went wrong with the |
| 40 | +previous update. Seek help! |
| 41 | + |
| 42 | +Update metadata in the message below, and commit `certdata.txt`: |
| 43 | + |
| 44 | +```text |
| 45 | +tools: update certdata.txt |
| 46 | +
|
| 47 | +This is the certdata.txt[0] from NSS 3.41, released on 2018-12-03. |
| 48 | +
|
| 49 | +This is the version of NSS that will ship in Firefox 65 on |
| 50 | +2018-12-11. |
| 51 | +
|
| 52 | +[0] https://hg.mozilla.org/projects/nss/raw-file/NSS_3_41_RTM/lib/ckfw/builtins/certdata.txt |
| 53 | +``` |
| 54 | + |
| 55 | +3. Update `node_root_certs.h` from `certdata.txt`. |
| 56 | + |
| 57 | +Run the command below: |
| 58 | + |
| 59 | +```shell |
| 60 | +./mk-ca-bundle.pl -v 2>_after |
| 61 | +``` |
| 62 | + |
| 63 | +Confirm that `../src/node_root_certs.h` was updated. |
| 64 | + |
| 65 | +Determine what changes were made by diffing the before and after files: |
| 66 | +```shell |
| 67 | +% diff _before _after |
| 68 | +11d10 |
| 69 | +< Parsing: Visa eCommerce Root |
| 70 | +106d104 |
| 71 | +< Parsing: TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı H5 |
| 72 | +113,117d110 |
| 73 | +< Parsing: Certplus Root CA G1 |
| 74 | +< Parsing: Certplus Root CA G2 |
| 75 | +< Parsing: OpenTrust Root CA G1 |
| 76 | +< Parsing: OpenTrust Root CA G2 |
| 77 | +< Parsing: OpenTrust Root CA G3 |
| 78 | +134c127,136 |
| 79 | +< Done (133 CA certs processed, 20 skipped). |
| 80 | +--- |
| 81 | +> Parsing: GlobalSign Root CA - R6 |
| 82 | +> Parsing: OISTE WISeKey Global Root GC CA |
| 83 | +> Parsing: GTS Root R1 |
| 84 | +> Parsing: GTS Root R2 |
| 85 | +> Parsing: GTS Root R3 |
| 86 | +> Parsing: GTS Root R4 |
| 87 | +> Parsing: UCA Global G2 Root |
| 88 | +> Parsing: UCA Extended Validation Root |
| 89 | +> Parsing: Certigna Root CA |
| 90 | +> Done (135 CA certs processed, 16 skipped). |
| 91 | +``` |
| 92 | + |
| 93 | +Use the diff to update the message below, and commit `src/node_root_certs.h`: |
| 94 | +```text |
| 95 | +crypto: update root certificates |
| 96 | +
|
| 97 | +Update the list of root certificates in src/node_root_certs.h with |
| 98 | +tools/mk-ca-bundle.pl. |
| 99 | +
|
| 100 | +Certificates added: |
| 101 | +- GlobalSign Root CA - R6 |
| 102 | +- OISTE WISeKey Global Root GC CA |
| 103 | +- GTS Root R1 |
| 104 | +- GTS Root R2 |
| 105 | +- GTS Root R3 |
| 106 | +- GTS Root R4 |
| 107 | +- UCA Global G2 Root |
| 108 | +- UCA Extended Validation Root |
| 109 | +- Certigna Root CA |
| 110 | +
|
| 111 | +Certificates removed: |
| 112 | +- Visa eCommerce Root |
| 113 | +- TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı H5 |
| 114 | +- Certplus Root CA G1 |
| 115 | +- Certplus Root CA G2 |
| 116 | +- OpenTrust Root CA G1 |
| 117 | +- OpenTrust Root CA G2 |
| 118 | +- OpenTrust Root CA G3 |
| 119 | +``` |
| 120 | + |
| 121 | +[NSS release schedule]: https://wiki.mozilla.org/NSS:Release_Versions |
| 122 | +[tag list]: https://hg.mozilla.org/projects/nss/tags |
0 commit comments