Skip to content

Commit 59870a3

Browse files
committed
squash! src,deps,build,test: add OpenSSL config appname
This commit adds a configuration option to specify an alternative name of the configuration section in the OpenSSL configuration file.
1 parent 89035b0 commit 59870a3

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

BUILDING.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ file a new issue.
5252
* [Build with a specific ICU](#build-with-a-specific-icu)
5353
* [Unix/macOS](#unixmacos-3)
5454
* [Windows](#windows-4)
55+
* [Configuring OpenSSL config appname](#configure-openssl-appname)
5556
* [Building Node.js with FIPS-compliant OpenSSL](#building-nodejs-with-fips-compliant-openssl)
5657
* [Building Node.js with external core modules](#building-nodejs-with-external-core-modules)
5758
* [Unix/macOS](#unixmacos-4)
@@ -768,6 +769,19 @@ as `deps/icu` (You'll have: `deps/icu/source/...`)
768769
> .\vcbuild full-icu
769770
```
770771

772+
### Configure OpenSSL appname
773+
774+
Node.js can use an OpenSSL configuration file by specifying the environment
775+
variable `OPENSSL_CONF`, or using the command line option `--openssl-conf`, and
776+
if none of those are specified will default to reading the default OpenSSL
777+
configuration file `openssl.cnf`. Node.js will only read a section that is by
778+
default named `nodejs_conf`, but this name can be overridden using the following
779+
configure option:
780+
781+
```console
782+
$ ./configure --openssl-conf-name=<some_conf_name>
783+
```
784+
771785
## Building Node.js with FIPS-compliant OpenSSL
772786

773787
The current version of Node.js supports FIPS when statically and

configure.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,12 @@
181181
"e.g. /root/x/y.js will be referenced via require('root/x/y'). "
182182
"Can be used multiple times")
183183

184+
parser.add_argument("--openssl-conf-name",
185+
action="store",
186+
dest="openssl_conf_name",
187+
default='nodejs_conf',
188+
help="The OpenSSL config appname (config section name) used by Node.js")
189+
184190
parser.add_argument('--openssl-default-cipher-list',
185191
action='store',
186192
dest='openssl_default_cipher_list',
@@ -1488,6 +1494,8 @@ def configure_openssl(o):
14881494
if options.openssl_no_asm:
14891495
variables['openssl_no_asm'] = 1
14901496

1497+
o['defines'] += ['NODE_OPENSSL_CONF_NAME=' + options.openssl_conf_name]
1498+
14911499
if options.without_ssl:
14921500
def without_ssl_error(option):
14931501
error('--without-ssl is incompatible with %s' % option)

src/node.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ PVOID old_vectored_exception_handler;
162162
struct V8Platform v8_platform;
163163
} // namespace per_process
164164

165+
// The section in the OpenSSL configuration file to be loaded.
166+
const char* conf_section_name = STRINGIFY(NODE_OPENSSL_CONF_NAME);
167+
165168
#ifdef __POSIX__
166169
void SignalExit(int signo, siginfo_t* info, void* ucontext) {
167170
ResetStdio();
@@ -1085,12 +1088,11 @@ InitializationResult InitializeOncePerProcess(
10851088
// return 0, leading to an endless loop and the node process will appear to
10861089
// hang/freeze.
10871090

1088-
// The section in the OpenSSL configuration file to be loaded.
1089-
const char* conf_section_name = "nodejs_conf";
10901091
// Passing NULL as the config file will allow the default openssl.cnf file
10911092
// to be loaded, but the default section in that file will not be used,
10921093
// instead only the section that matches the value of conf_section_name
10931094
// will be read from the default configuration file.
1095+
// fprintf(stderr, "appanme: %s\n", conf_section_name);
10941096
const char* conf_file = nullptr;
10951097
// Use OPENSSL_CONF environment variable is set.
10961098
std::string env_openssl_conf;

0 commit comments

Comments
 (0)