GeezerVison is showing github.com — src: add openssl-system-ca-path configure option · nodejs/node@2268d00
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: configure +8Lines changed: 8 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -172,6 +172,12 @@ parser.add_option('--openssl-use-def-ca-store', | 172 | 172 | dest='use_openssl_ca_store', | 173 | 173 | help='Use OpenSSL supplied CA store instead of compiled-in Mozilla CA copy.') | 174 | 174 |
| | 175 | +parser.add_option('--openssl-system-ca-path', | | 176 | + action='store', | | 177 | + dest='openssl_system_ca_path', | | 178 | + help='Use the specified path to system CA (PEM format) in addition to ' | | 179 | + 'the OpenSSL supplied CA store or compiled-in Mozilla CA copy.') | | 180 | + | 175 | 181 | shared_optgroup.add_option('--shared-http-parser', | 176 | 182 | action='store_true', | 177 | 183 | dest='shared_http_parser', | @@ -988,6 +994,8 @@ def configure_openssl(o): | 988 | 994 | o['variables']['openssl_no_asm'] = 1 if options.openssl_no_asm else 0 | 989 | 995 | if options.use_openssl_ca_store: | 990 | 996 | o['defines'] += ['NODE_OPENSSL_CERT_STORE'] | | 997 | + if options.openssl_system_ca_path: | | 998 | + o['variables']['openssl_system_ca_path'] = options.openssl_system_ca_path | 991 | 999 | o['variables']['node_without_node_options'] = b(options.without_node_options) | 992 | 1000 | if options.without_node_options: | 993 | 1001 | o['defines'] += ['NODE_WITHOUT_NODE_OPTIONS'] | |
Collapse file Copy file name to clipboardExpand all lines: node.gyp +10Lines changed: 10 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 234 | 234 | '<(SHARED_INTERMEDIATE_DIR)/node_javascript.cc', | 235 | 235 | ], | 236 | 236 |
| | 237 | + 'variables': { | | 238 | + 'openssl_system_ca_path%': '', | | 239 | + }, | | 240 | + | 237 | 241 | 'defines': [ | 238 | 242 | 'NODE_ARCH="<(target_arch)"', | 239 | 243 | 'NODE_PLATFORM="<(OS)"', | 240 | 244 | 'NODE_WANT_INTERNALS=1', | 241 | 245 | # Warn when using deprecated V8 APIs. | 242 | 246 | 'V8_DEPRECATION_WARNINGS=1', | | 247 | + 'NODE_OPENSSL_SYSTEM_CERT_PATH="<(openssl_system_ca_path)"', | 243 | 248 | ], | 244 | 249 | 'conditions': [ | 245 | 250 | [ 'node_shared=="true" and node_module_version!="" and OS!="win"', { | 246 | 251 | 'product_extension': '<(shlib_suffix)', | 247 | 252 | }] | 248 | 253 | ], | | 254 | + 'direct_dependent_settings': { | | 255 | + 'defines': [ | | 256 | + 'NODE_OPENSSL_SYSTEM_CERT_PATH="<(openssl_system_ca_path)"', | | 257 | + ], | | 258 | + }, | 249 | 259 | }, | 250 | 260 | { | 251 | 261 | 'target_name': 'mkssldef', | |
Collapse file Copy file name to clipboardExpand all lines: src/node_crypto.cc +5Lines changed: 5 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -124,6 +124,8 @@ static const char* const root_certs[] = { | 124 | 124 | #include "node_root_certs.h" // NOLINT(build/include_order) | 125 | 125 | }; | 126 | 126 |
| | 127 | +static const char system_cert_path[] = NODE_OPENSSL_SYSTEM_CERT_PATH; | | 128 | + | 127 | 129 | static std::string extra_root_certs_file; // NOLINT(runtime/string) | 128 | 130 |
| 129 | 131 | static X509_STORE* root_cert_store; | @@ -724,6 +726,9 @@ static X509_STORE* NewRootCertStore() { | 724 | 726 | } | 725 | 727 |
| 726 | 728 | X509_STORE* store = X509_STORE_new(); | | 729 | + if (*system_cert_path != '\0') { | | 730 | + X509_STORE_load_locations(store, system_cert_path, nullptr); | | 731 | + } | 727 | 732 | if (ssl_openssl_cert_store) { | 728 | 733 | X509_STORE_set_default_paths(store); | 729 | 734 | } else { | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-process-config.js +3-1Lines changed: 3 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -24,7 +24,9 @@ if (!fs.existsSync(configPath)) { | 24 | 24 | let config = fs.readFileSync(configPath, 'utf8'); | 25 | 25 |
| 26 | 26 | // Clean up comment at the first line. | 27 | | -config = config.split('\n').slice(1).join('\n').replace(/'/g, '"'); | | 27 | +config = config.split('\n').slice(1).join('\n'); | | 28 | +config = config.replace(/"/g, '\\"'); | | 29 | +config = config.replace(/'/g, '"'); | 28 | 30 | config = JSON.parse(config, function(key, value) { | 29 | 31 | if (value === 'true') return true; | 30 | 32 | if (value === 'false') return false; | |
|