GeezerVison is showing github.com — src: add openssl-system-ca-path configure option · nodejs/node@0b93bbb
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', | @@ -1013,6 +1019,8 @@ def configure_openssl(o): | 1013 | 1019 | o['variables']['openssl_no_asm'] = 1 if options.openssl_no_asm else 0 | 1014 | 1020 | if options.use_openssl_ca_store: | 1015 | 1021 | o['defines'] += ['NODE_OPENSSL_CERT_STORE'] | | 1022 | + if options.openssl_system_ca_path: | | 1023 | + o['variables']['openssl_system_ca_path'] = options.openssl_system_ca_path | 1016 | 1024 | o['variables']['node_without_node_options'] = b(options.without_node_options) | 1017 | 1025 | if options.without_node_options: | 1018 | 1026 | o['defines'] += ['NODE_WITHOUT_NODE_OPTIONS'] | |
Collapse file Copy file name to clipboardExpand all lines: node.gyp +11Lines changed: 11 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 297 | 297 | '<(SHARED_INTERMEDIATE_DIR)/node_javascript.cc', | 298 | 298 | ], | 299 | 299 |
| | 300 | + 'variables': { | | 301 | + 'openssl_system_ca_path%': '', | | 302 | + }, | | 303 | + | 300 | 304 | 'defines': [ | 301 | 305 | 'NODE_ARCH="<(target_arch)"', | 302 | 306 | 'NODE_PLATFORM="<(OS)"', | 303 | 307 | 'NODE_WANT_INTERNALS=1', | 304 | 308 | # Warn when using deprecated V8 APIs. | 305 | 309 | 'V8_DEPRECATION_WARNINGS=1', | | 310 | + 'NODE_OPENSSL_SYSTEM_CERT_PATH="<(openssl_system_ca_path)"', | 306 | 311 | ], | | 312 | + | | 313 | + 'direct_dependent_settings': { | | 314 | + 'defines': [ | | 315 | + 'NODE_OPENSSL_SYSTEM_CERT_PATH="<(openssl_system_ca_path)"', | | 316 | + ], | | 317 | + }, | 307 | 318 | }, | 308 | 319 | { | 309 | 320 | '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 |
|---|
@@ -147,6 +147,8 @@ static const char* const root_certs[] = { | 147 | 147 | #include "node_root_certs.h" // NOLINT(build/include_order) | 148 | 148 | }; | 149 | 149 |
| | 150 | +static const char system_cert_path[] = NODE_OPENSSL_SYSTEM_CERT_PATH; | | 151 | + | 150 | 152 | static std::string extra_root_certs_file; // NOLINT(runtime/string) | 151 | 153 |
| 152 | 154 | static X509_STORE* root_cert_store; | @@ -799,6 +801,9 @@ static X509_STORE* NewRootCertStore() { | 799 | 801 | } | 800 | 802 |
| 801 | 803 | X509_STORE* store = X509_STORE_new(); | | 804 | + if (*system_cert_path != '\0') { | | 805 | + X509_STORE_load_locations(store, system_cert_path, nullptr); | | 806 | + } | 802 | 807 | if (ssl_openssl_cert_store) { | 803 | 808 | X509_STORE_set_default_paths(store); | 804 | 809 | } 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 |
|---|
@@ -45,7 +45,9 @@ if (!fs.existsSync(configPath)) { | 45 | 45 | let config = fs.readFileSync(configPath, 'utf8'); | 46 | 46 |
| 47 | 47 | // Clean up comment at the first line. | 48 | | -config = config.split('\n').slice(1).join('\n').replace(/'/g, '"'); | | 48 | +config = config.split('\n').slice(1).join('\n'); | | 49 | +config = config.replace(/"/g, '\\"'); | | 50 | +config = config.replace(/'/g, '"'); | 49 | 51 | config = JSON.parse(config, function(key, value) { | 50 | 52 | if (value === 'true') return true; | 51 | 53 | if (value === 'false') return false; | |
|