GeezerVison is showing github.com — src,doc,test: add --openssl-shared-config option · nodejs/node@9ea9797
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: doc/api/cli.md +16Lines changed: 16 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -749,6 +749,21 @@ Load an OpenSSL configuration file on startup. Among other uses, this can be | 749 | 749 | used to enable FIPS-compliant crypto if Node.js is built | 750 | 750 | against FIPS-enabled OpenSSL. | 751 | 751 |
| | 752 | +### `--openssl-shared-config` | | 753 | + | | 754 | +<!-- YAML | | 755 | +added: REPLACEME | | 756 | +--> | | 757 | + | | 758 | +Enable OpenSSL default configuration section, `openssl_conf` to be read from | | 759 | +the OpenSSL configuration file. The default configuration file is named | | 760 | +`openssl.cnf` but this can be changed using the environment variable | | 761 | +`OPENSSL_CONF`, or by using the command line option `--openssl-config`. | | 762 | +The location of the default OpenSSL configuration file depends on how OpenSSL | | 763 | +is being linked to Node.js. Sharing the OpenSSL configuration may have unwanted | | 764 | +implications and it is recommended to use a configuration section specific to | | 765 | +Node.js which is `nodejs_conf` and is default when this option is not used. | | 766 | + | 752 | 767 | ### `--openssl-legacy-provider` | 753 | 768 |
| 754 | 769 | <!-- YAML | @@ -1620,6 +1635,7 @@ Node.js options that are allowed are: | 1620 | 1635 | * `--node-memory-debug` | 1621 | 1636 | * `--openssl-config` | 1622 | 1637 | * `--openssl-legacy-provider` | | 1638 | +* `--openssl-shared-config` | 1623 | 1639 | * `--pending-deprecation` | 1624 | 1640 | * `--policy-integrity` | 1625 | 1641 | * `--preserve-symlinks-main` | |
Collapse file Copy file name to clipboardExpand all lines: src/node.cc +6Lines changed: 6 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1096,6 +1096,12 @@ InitializationResult InitializeOncePerProcess( | 1096 | 1096 | // instead only the section that matches the value of conf_section_name | 1097 | 1097 | // will be read from the default configuration file. | 1098 | 1098 | const char* conf_file = nullptr; | | 1099 | + // To allow for using the previous default where the 'openssl_conf' appname | | 1100 | + // was used, the command line option 'openssl-shared-config' can be used to | | 1101 | + // force the old behavior. | | 1102 | + if (per_process::cli_options->openssl_shared_config) { | | 1103 | + conf_section_name = "openssl_conf"; | | 1104 | + } | 1099 | 1105 | // Use OPENSSL_CONF environment variable is set. | 1100 | 1106 | std::string env_openssl_conf; | 1101 | 1107 | credentials::SafeGetenv("OPENSSL_CONF", &env_openssl_conf); | |
Collapse file Copy file name to clipboardExpand all lines: src/node_options.cc +4-1Lines changed: 4 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -824,13 +824,16 @@ PerProcessOptionsParser::PerProcessOptionsParser( | 824 | 824 | "minimum allocation size from the OpenSSL secure heap", | 825 | 825 | &PerProcessOptions::secure_heap_min, | 826 | 826 | kAllowedInEnvironment); | | 827 | + AddOption("--openssl-shared-config", | | 828 | + "enable OpenSSL shared configuration", | | 829 | + &PerProcessOptions::openssl_shared_config, | | 830 | + kAllowedInEnvironment); | 827 | 831 | #endif // HAVE_OPENSSL | 828 | 832 | #if OPENSSL_VERSION_MAJOR >= 3 | 829 | 833 | AddOption("--openssl-legacy-provider", | 830 | 834 | "enable OpenSSL 3.0 legacy provider", | 831 | 835 | &PerProcessOptions::openssl_legacy_provider, | 832 | 836 | kAllowedInEnvironment); | 833 | | - | 834 | 837 | #endif // OPENSSL_VERSION_MAJOR | 835 | 838 | AddOption("--use-largepages", | 836 | 839 | "Map the Node.js static code to large pages. Options are " | |
Collapse file Copy file name to clipboardExpand all lines: src/node_options.h +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -247,6 +247,7 @@ class PerProcessOptions : public Options { | 247 | 247 | std::string tls_cipher_list = DEFAULT_CIPHER_LIST_CORE; | 248 | 248 | int64_t secure_heap = 0; | 249 | 249 | int64_t secure_heap_min = 2; | | 250 | + bool openssl_shared_config = false; | 250 | 251 | #ifdef NODE_OPENSSL_CERT_STORE | 251 | 252 | bool ssl_openssl_cert_store = true; | 252 | 253 | #else | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-process-env-allowed-flags-are-documented.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -55,6 +55,7 @@ const conditionalOpts = [ | 55 | 55 | return [ | 56 | 56 | '--openssl-config', | 57 | 57 | common.hasOpenSSL3 ? '--openssl-legacy-provider' : '', | | 58 | + '--openssl-shared-config', | 58 | 59 | '--tls-cipher-list', | 59 | 60 | '--use-bundled-ca', | 60 | 61 | '--use-openssl-ca', | |
|