Skip to content

Commit 93d24bb

Browse files
remicolletalejandro-colomar
authored andcommitted
Preferring system crypto policy.
If we don't call SSL_CTX_set_cipher_list(), then it uses the system's default. Link: <https://fedoraproject.org/wiki/Changes/CryptoPolicy> Link: <https://docs.fedoraproject.org/en-US/packaging-guidelines/CryptoPolicies/> Link: <https://www.redhat.com/en/blog/consistent-security-crypto-policies-red-hat-enterprise-linux-8> Signed-off-by: Remi Collet <remi@remirepo.net> Acked-by: Andrei Belov <defan@nginx.com> [ alx: add changelog and tweak commit message ] Signed-off-by: Alejandro Colomar <alx@nginx.com>
1 parent f933619 commit 93d24bb

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

docs/changes.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ removed $uri auto-append for "share" when loading configuration.
3737
</para>
3838
</change>
3939

40+
<change type="change">
41+
<para>
42+
prefer system crypto policy, instead of hardcoding a default.
43+
</para>
44+
</change>
45+
4046
<change type="feature">
4147
<para>
4248
compatibility with PHP 8.2.

src/nxt_openssl.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ nxt_openssl_server_init(nxt_task_t *task, nxt_mp_t *mp,
295295
nxt_tls_init_t *tls_init, nxt_bool_t last)
296296
{
297297
SSL_CTX *ctx;
298-
const char *ciphers, *ca_certificate;
298+
const char *ca_certificate;
299299
nxt_tls_conf_t *conf;
300300
STACK_OF(X509_NAME) *list;
301301
nxt_tls_bundle_conf_t *bundle;
@@ -361,13 +361,13 @@ nxt_openssl_server_init(nxt_task_t *task, nxt_mp_t *mp,
361361
}
362362
*/
363363

364-
ciphers = (conf->ciphers != NULL) ? conf->ciphers : "HIGH:!aNULL:!MD5";
365-
366-
if (SSL_CTX_set_cipher_list(ctx, ciphers) == 0) {
367-
nxt_openssl_log_error(task, NXT_LOG_ALERT,
364+
if (conf->ciphers) { /* else use system crypto policy */
365+
if (SSL_CTX_set_cipher_list(ctx, conf->ciphers) == 0) {
366+
nxt_openssl_log_error(task, NXT_LOG_ALERT,
368367
"SSL_CTX_set_cipher_list(\"%s\") failed",
369-
ciphers);
370-
goto fail;
368+
conf->ciphers);
369+
goto fail;
370+
}
371371
}
372372

373373
#if (NXT_HAVE_OPENSSL_CONF_CMD)

0 commit comments

Comments
 (0)