Skip to content

Commit 8c5ae02

Browse files
committed
CDRIVER-3745 add flag to disable rev check on Win
Add support for tlsDisableCertificateRevocationCheck with schannel.
1 parent d75dfca commit 8c5ae02

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

src/libmongoc/doc/configuring_tls.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ By default, libmongoc will attempt to find a supported TLS library and enable TL
7070

7171
- ``AUTO`` the default behavior. Link to the system's native TLS library, or attempt to find OpenSSL.
7272
- ``DARWIN`` link to Secure Transport, the native TLS library on macOS.
73-
- ``WINDOWS`` link to Secure Channel, the native TLS on Windows.
73+
- ``WINDOWS`` link to Secure Channel, the native TLS library on Windows.
7474
- ``OPENSSL`` link to OpenSSL (libssl). An optional install path may be specified with ``OPENSSL_ROOT``.
7575
- ``LIBRESSL`` link to LibreSSL's libtls. (LibreSSL's compatible libssl may be linked to by setting ``OPENSSL``).
7676
- ``OFF`` disable TLS support.
@@ -119,11 +119,13 @@ When compiled against the Windows native libraries, the ``ca_dir`` option of a :
119119

120120
Encrypted PEM files (e.g., setting ``tlsCertificateKeyPassword``) are also not supported, and will result in error when attempting to load them.
121121

122-
When ``tlsCAFile`` is set, the driver will only allow server certificates issued by the authority (or authorities) provided. When no ``tlsCAFile`` is set, the driver will look up the Certificate Authority using the ``System Local Machine Root`` certificate store to confirm the provided certificate or the ``Current user certificate store`` if the ``System Local Machine Root`` certificate store is unavailable.
122+
When ``tlsCAFile`` is set, the driver will only allow server certificates issued by the authority (or authorities) provided. When no ``tlsCAFile`` is set, the driver will look up the Certificate Authority using the ``System Local Machine Root`` certificate store to confirm the provided certificate.
123123

124124
When ``crl_file`` is set with :symbol:`mongoc_ssl_opt_t`, the driver will import the revocation list to the ``System Local Machine Root`` certificate store.
125125

126-
Setting ``tlsDisableOCSPEndpointCheck`` and ``tlsDisableCertificateRevocationCheck`` has no effect.
126+
Setting ``tlsDisableCertificateRevocationCheck`` disables certificate revocation checking.
127+
128+
Setting ``tlsDisableOCSPEndpointCheck`` has no effect.
127129

128130
The Online Certificate Status Protocol (OCSP) is partially supported (see `RFC 6960 <https://tools.ietf.org/html/rfc6960>`_).
129131

src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -979,13 +979,15 @@ mongoc_stream_tls_secure_channel_new (mongoc_stream_t *base_stream,
979979
schannel_cred.dwFlags |= SCH_CRED_IGNORE_NO_REVOCATION_CHECK;
980980
/* An offline OCSP responder / CRL distribution list is a soft failure. */
981981
schannel_cred.dwFlags |= SCH_CRED_IGNORE_REVOCATION_OFFLINE;
982-
983982
if (opt->weak_cert_validation) {
984983
schannel_cred.dwFlags |= SCH_CRED_MANUAL_CRED_VALIDATION;
985984
TRACE ("%s", "disabled server certificate checks");
986985
} else {
987-
schannel_cred.dwFlags |=
988-
SCH_CRED_AUTO_CRED_VALIDATION | SCH_CRED_REVOCATION_CHECK_CHAIN;
986+
schannel_cred.dwFlags |= SCH_CRED_AUTO_CRED_VALIDATION;
987+
if (!_mongoc_ssl_opts_disable_certificate_revocation_check (opt)) {
988+
schannel_cred.dwFlags |= SCH_CRED_REVOCATION_CHECK_CHAIN;
989+
TRACE ("%s", "enabled server certificate revocation checks");
990+
}
989991
TRACE ("%s", "enabled server certificate checks");
990992
}
991993

@@ -1063,11 +1065,6 @@ mongoc_stream_tls_secure_channel_new (mongoc_stream_t *base_stream,
10631065
"built against Secure Channel");
10641066
}
10651067

1066-
if (_mongoc_ssl_opts_disable_certificate_revocation_check (opt)) {
1067-
MONGOC_ERROR ("Setting tlsDisableCertificateRevocationCheck has no "
1068-
"effect when built Secure Channel");
1069-
}
1070-
10711068
mongoc_counter_streams_active_inc ();
10721069
RETURN ((mongoc_stream_t *) tls);
10731070
}

0 commit comments

Comments
 (0)