mirror of
https://github.com/nodejs/node.git
synced 2026-11-30 11:55:44 -05:00
src: check node_extra_ca_certs after openssl cfg
I recently discovered that the custom NodeJS specific OpenSSL config section in openssl.cnf would not be respected, if the environment variable `NODE_EXTRA_CA_CERTS` was set. This happens even if it contains an invalid value, i.e no actual certs are read. Someone suggested moving the checking of extra ca certs to after the OpenSSL config is read, and this seems to work. PR-URL: https://github.com/nodejs/node/pull/48159 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com>
This commit is contained in:
1 parent
d9a68b821e
commit
5445835671
1 file changed
+6
-5
+6
-5
@@ -969,11 +969,6 @@ std::unique_ptr<InitializationResult> InitializeOncePerProcess(
|
||||
return ret;
|
||||
};
|
||||
|
||||
{
|
||||
std::string extra_ca_certs;
|
||||
if (credentials::SafeGetenv("NODE_EXTRA_CA_CERTS", &extra_ca_certs))
|
||||
crypto::UseExtraCaCerts(extra_ca_certs);
|
||||
}
|
||||
// In the case of FIPS builds we should make sure
|
||||
// the random source is properly initialized first.
|
||||
#if OPENSSL_VERSION_MAJOR >= 3
|
||||
@@ -1058,6 +1053,12 @@ std::unique_ptr<InitializationResult> InitializeOncePerProcess(
|
||||
CHECK(crypto::CSPRNG(buffer, length).is_ok());
|
||||
return true;
|
||||
});
|
||||
|
||||
{
|
||||
std::string extra_ca_certs;
|
||||
if (credentials::SafeGetenv("NODE_EXTRA_CA_CERTS", &extra_ca_certs))
|
||||
crypto::UseExtraCaCerts(extra_ca_certs);
|
||||
}
|
||||
#endif // HAVE_OPENSSL && !defined(OPENSSL_IS_BORINGSSL)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user