Skip to content

Commit 65d89d8

Browse files
committed
Add OCSP URI option
1 parent 34c7ca5 commit 65d89d8

File tree

5 files changed

+340
-81
lines changed

5 files changed

+340
-81
lines changed

source/ocsp-support/ocsp-support.rst

Lines changed: 92 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ OCSP Support
33
============
44

55
:Spec Title: OCSP Support
6-
:Spec Version: 1.1.1
6+
:Spec Version: 1.2.0
77
:Author: Vincent Kam
88
:Lead: Jeremy Mikola
99
:Advisory Group: Clyde Bazile *(POC author)*, Esha Bhargava *(Program Manager)*, Matt Broadstone, Bernie Hackett *(POC author)*, Shreyas Kaylan *(Server Project Lead)*, Jeremy Mikola *(Spec Lead)*
1010
:Status: Accepted
1111
:Type: Standards
1212
:Minimum Server Version: 4.4
13-
:Last Modified: 2020-2-10
13+
:Last Modified: 2020-2-26
1414

1515
.. contents::
1616

@@ -103,13 +103,17 @@ invalid, the driver SHOULD end the connection.
103103
attempt to validate the status of the unvalidated certificates
104104
using the cached CRLs.
105105

106-
7. If the server's certificate remains unvalidated and that certificate
107-
has a list of OCSP responder endpoints, the driver SHOULD send HTTP
108-
requests to the responders in parallel. The first valid response
109-
that concretely marks the certificate status as good or revoked
110-
should be used. A five-second timeout SHOULD be used for the requests.
111-
The status for a response should only be checked if the response is
112-
valid per `RFC 6960 Section 3.2 <https://tools.ietf.org/html/rfc6960#section-3.2>`_
106+
7. If the server’s certificate remains unvalidated, that certificate
107+
has a list of OCSP responder endpoints, and
108+
``tlsDisableOcspEndpointCheck`` is true (`if the driver supports
109+
this option <MongoClient Configuration>`_), the driver SHOULD send
110+
HTTP requests to the responders in parallel. The first valid
111+
response that concretely marks the certificate status as good or
112+
revoked should be used. A five-second timeout SHOULD be used for
113+
the requests. The status for a response should only be checked if
114+
the response is valid per `RFC 6960 Section 3.2
115+
<https://tools.ietf.org/html/rfc6960#section-3.2>`_
116+
113117

114118
8. If any unvalidated intermediate certificates remain and those
115119
certificates have OCSP endpoints, for each certificate, the
@@ -138,7 +142,6 @@ Suggested OCSP Response Validation Behavior
138142
Drivers SHOULD validate OCSP Responses in the manner specified in `RFC
139143
6960: 3.2 <https://tools.ietf.org/html/rfc6960#section-3.2>`__ to the
140144
extent that their TLS library allows.
141-
142145
Suggested OCSP Caching Behavior
143146
-------------------------------
144147
Drivers with sufficient control over their TLS library's OCSP
@@ -175,28 +178,69 @@ has a later ``nextUpdate`` than the response already in the cache,
175178
drivers SHOULD replace the older entry in the cache with the fresher
176179
response.
177180

181+
MongoClient Configuration
182+
--------------------------
183+
184+
This specification introduces the client-level configuration option
185+
defined below. Drivers that can, on a per MongoClient basis, disable
186+
non-stapled OCSP while keeping stapled OCSP enabled MUST implement
187+
this option.
188+
189+
tlsDisableOCSPEndpointCheck
190+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
191+
192+
This boolean option determines whether MongoClient should refrain from
193+
reaching out to an OCSP endpoint i.e. whether non-stapled OCSP should
194+
be disabled. When set to true, a driver MUST NOT reach out to OCSP
195+
endpoints. When set to false, a driver MUST reach out to xOCSP
196+
endpoints if needed (as described in :ref:`Suggested OCSP Behavior`).
197+
This option MUST default to false.
198+
199+
Naming Deviations
200+
^^^^^^^^^^^^^^^^^^
201+
202+
Drivers MUST use the defined name of ``tlsDisableOCSPEndpointCheck``
203+
for the connection string parameter to ensure portability of
204+
connection strings across applications and drivers. If drivers solicit
205+
MongoClient options through another mechanism (e.g. an options
206+
dictionary provided to the MongoClient constructor), drivers SHOULD
207+
use the defined name but MAY deviate to comply with their existing
208+
conventions. For example, a driver may use
209+
``tls_disable_ocsp_endpoint_check`` instead of
210+
``tlsDisableOCSPEndpointCheck``.
211+
178212
How OCSP interacts with existing configuration options
179213
------------------------------------------------------
180214

181215
The following requirements apply only to drivers that are able to
182216
enable/disable OCSP on a per MongoClient basis.
183217

184-
1. If a connection string specifies `tlsInsecure=true` then the driver
185-
MUST disable OCSP.
218+
1. If a connection string specifies ``tlsInsecure=true`` then the
219+
driver MUST disable OCSP.
186220

187-
2. If a driver supports ``tlsAllowInvalidCertificates``, and a
221+
2. If a connection string contains both ``tlsInsecure`` and
222+
``tlsDisableOCSPEndpointCheck`` then the driver MUST throw an
223+
error.
224+
225+
3. If a driver supports ``tlsAllowInvalidCertificates``, and a
188226
connection string specifies ``tlsAllowInvalidCertificates=true``,
189227
then the driver MUST disable OCSP.
190228

229+
4. If a driver supports ``tlsAllowInvalidCertificates``, and a
230+
connection string specifies both ``tlsAllowInvalidCertificates``
231+
and ``tlsDisableOCSPEndpointCheck``, then the driver MUST
232+
throw an error.
233+
191234
The remaining requirements in this section apply only to drivers that
192235
expose an option to enable/disable certificate revocation checking on a
193236
per MongoClient basis.
194237

195-
1. Driver MUST enable OCSP support (with stapling if possible) when this
196-
option is enabled.
238+
1. Driver MUST enable OCSP support (with stapling if possible) when
239+
certificate revocation checking is enabled.
197240

198-
2. Drivers SHOULD throw an error if ``tlsInsecure=true`` or
199-
``tlsAllowInvalidCertificates=true`` are specified alongside the
241+
2. Drivers SHOULD throw an error if any of ``tlsInsecure=true`` or
242+
``tlsAllowInvalidCertificates=true`` or
243+
``tlsDisableOCSPEndpointCheck=true`` is specified alongside the
200244
option to enable certificate revocation checking.
201245

202246
TLS Requirements
@@ -300,18 +344,12 @@ endpoint.
300344
Design Rationale
301345
=================
302346

303-
In accordance with the “\ `No Knobs” drivers
304-
mantra <https://github.com/mongodb/specifications#no-knobs>`__, we have
305-
chosen not to expose any options specifically related to OCSP to the
306-
user, although this specification does clarify how existing options
307-
should interact with OCSP.
308-
309-
We have also chosen not to force drivers whose TLS libraries do not
310-
support OCSP/stapling “out of the box” to implement OCSP support due to
311-
the extra work and research that this might require. Similarly, this
312-
specification uses “SHOULD” more commonly (when other specs would prefer
313-
“MUST”) to account for the fact that some drivers may not be able to
314-
fully customize OCSP behavior in their TLS library.
347+
We have chosen not to force drivers whose TLS libraries do not support
348+
OCSP/stapling “out of the box” to implement OCSP support due to the
349+
extra work and research that this might require. Similarly, this
350+
specification uses “SHOULD” more commonly (when other specs would
351+
prefer “MUST”) to account for the fact that some drivers may not be
352+
able to fully customize OCSP behavior in their TLS library.
315353

316354
We are requiring drivers to support both stapled OCSP and non-stapled
317355
OCSP in order to support revocation checking for server versions in
@@ -362,15 +400,17 @@ Backwards Compatibility
362400

363401
An application behind a firewall with an outbound whitelist that
364402
upgrades to a driver implementing this specification may experience
365-
connectivity issues. This is because the driver may need to contact OCSP
366-
endpoints or CRL distribution points [1]_ specified in the server’s
367-
certificate and if these OCSP endpoints and/or CRL distribution points
368-
are not accessible, then the connection to the server may fail. (N.B.:
369-
TLS libraries `typically implement “soft
370-
fail” <https://blog.hboeck.de/archives/886-The-Problem-with-OCSP-Stapling-and-Must-Staple-and-why-Certificate-Revocation-is-still-broken.html>`__
403+
connectivity issues. This is because the driver may need to contact
404+
OCSP endpoints or CRL distribution points [1]_ specified in the
405+
server’s certificate and if these OCSP endpoints and/or CRL
406+
distribution points are not accessible, then the connection to the
407+
server may fail. (N.B.: TLS libraries `typically implement “soft fail”
408+
<https://blog.hboeck.de/archives/886-The-Problem-with-OCSP-Stapling-and-Must-Staple-and-why-Certificate-Revocation-is-still-broken.html>`__
371409
such that connections can continue even if the OCSP server is
372-
inaccessible, so this issue is much more likely in the case of a server
373-
with a certificate that only contains CRL distribution points.)
410+
inaccessible, so this issue is much more likely in the case of a
411+
server with a certificate that only contains CRL distribution points.)
412+
In such a scenario, connectivity may be able to be restored by
413+
disabling non-stapled OCSP via ``tlsDisableOCSPEndpointCheck``.
374414

375415
Reference Implementation
376416
=========================
@@ -493,6 +533,17 @@ No. Although `RFC 5019, The Lightweight Online Certificate Status Protocol
493533
allows for the configuration of a tolerance period for the acceptance of OCSP
494534
responses after ``nextUpdate``, this spec is not adhering to that RFC.
495535

536+
Why was the decision made to allow OCSP endpoint checking to be enabled/disabled via a URI option?
537+
---------------------------------------------------------------------------------------------------
538+
We initially hoped that we would be able to not expose any options
539+
specifically related to OCSP to the user, in accordance with the
540+
\`No Knobs” drivers mantra
541+
<https://github.com/mongodb/specifications#no-knobs>`__. However, we
542+
later decided that users may benefit from having the ability to
543+
disable OCSP endpoint checking when applications are deployed behind
544+
restrictive firewall with outbound whitelists, and this benefit is
545+
worth adding another URI option.
546+
496547
Appendix
497548
========
498549

@@ -648,14 +699,16 @@ of checking this are:
648699

649700
Changelog
650701
==========
651-
**2020-2-19**: Clarify behavior for reaching out to OCSP responders.
702+
**2020-2-26**: 1.2.0: Add tlsDisableOCSPEndpointCheck URI option.
703+
704+
**2020-2-19**: 1.1.1 Clarify behavior for reaching out to OCSP responders.
652705

653706
**2020-2-10**: 1.1.0: Add cache requirement.
654707

655708
**2020-1-31**: 1.0.2: Add SNI requirement and clarify design rationale
656709
regarding minimizing round trips.
657710

658-
**2020-1-28**: Clarify behavior regarding nonces and tolerance periods.
711+
**2020-1-28**: 1.0.1: Clarify behavior regarding nonces and tolerance periods.
659712

660713
**2020-1-16**: 1.0.0: Initial commit.
661714

source/ocsp-support/tests/README.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ The prose tests defined in this file are platform-independent tests that
1313
drivers can use to prove their conformance to the OCSP Support
1414
specification. These tests MUST BE implemented by all drivers.
1515

16+
Additional YAML and JSON tests have also been added to the
17+
`URI Options Tests <../../uri-options/tests/README.rst>`__.
18+
Specifically, the `TLS Options Test
19+
<../../uri-options/test/tls-options.yml>`__ has been
20+
updated with additional tests for the new URI option
21+
``tlsDisableOCSPEndpointCheck``. These tests MUST BE implemented by
22+
drivers that are able to support the ``tlsDisableOCSPEndpointCheck``
23+
URI option (see `MongoClient Configuration
24+
<../ocsp-support#MongoClient-Configuration>`__).
25+
1626
Testing Invalid Configurations
1727
==============================
1828

@@ -148,4 +158,6 @@ duration even after a driver encounters a TLS error early).
148158

149159
Changelog
150160
==========
161+
**2020-2-26**: Add additional URI Options Tests.
162+
151163
**2020-1-16**: Initial commit.

source/uri-options/tests/tls-options.json

Lines changed: 107 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@
1313
"tlsCertificateKeyFile": "cert.pem"
1414
}
1515
},
16-
{
17-
"description": "Valid tlsCertificateKeyFilePassword is parsed correctly",
18-
"uri": "mongodb://example.com/?tlsCertificateKeyFilePassword=hunter2",
19-
"valid": true,
20-
"warning": false,
21-
"hosts": null,
22-
"auth": null,
23-
"options": {
24-
"tlsCertificateKeyFilePassword": "hunter2"
25-
}
26-
},
16+
{
17+
"description": "Valid tlsCertificateKeyFilePassword is parsed correctly",
18+
"uri": "mongodb://example.com/?tlsCertificateKeyFilePassword=hunter2",
19+
"valid": true,
20+
"warning": false,
21+
"hosts": null,
22+
"auth": null,
23+
"options": {
24+
"tlsCertificateKeyFilePassword": "hunter2"
25+
}
26+
},
2727
{
2828
"description": "Invalid tlsAllowInvalidCertificates causes a warning",
2929
"uri": "mongodb://example.com/?tlsAllowInvalidCertificates=invalid",
@@ -236,6 +236,102 @@
236236
"hosts": null,
237237
"auth": null,
238238
"options": {}
239+
},
240+
{
241+
"description": "tlsDisableOcspEndpointCheck defaults to false",
242+
"uri": "mongodb://example.com/?tls=true",
243+
"valid": false,
244+
"warning": false,
245+
"hosts": null,
246+
"auth": null,
247+
"options": {
248+
"tls": true,
249+
"tlsDisableOcspEndpointCheck": false
250+
}
251+
},
252+
{
253+
"description": "tlsDisableOcspEndpointCheck parses correctly",
254+
"uri": "mongodb://example.com/?tls=true&tlsDisableOcspEndpointCheck=true",
255+
"valid": false,
256+
"warning": false,
257+
"hosts": null,
258+
"auth": null,
259+
"options": {
260+
"tls": true,
261+
"tlsDisableOcspEndpointCheck": true
262+
}
263+
},
264+
{
265+
"description": "tlsInsecure and tlsDisableOcspEndpointCheck both present (and true) raises an error",
266+
"uri": "mongodb://example.com/?tlsInsecure=true&tlsDisableOcspEndpointCheck=true",
267+
"valid": false,
268+
"warning": false,
269+
"hosts": null,
270+
"auth": null,
271+
"options": {}
272+
},
273+
{
274+
"description": "tlsInsecure=true and tlsDisableOcspEndpointCheck=false raises an error",
275+
"uri": "mongodb://example.com/?tlsInsecure=true&tlsDisableOcspEndpointCheck=false",
276+
"valid": false,
277+
"warning": false,
278+
"hosts": null,
279+
"auth": null,
280+
"options": {}
281+
},
282+
{
283+
"description": "tlsInsecure=false and tlsDisableOcspEndpointCheck=true raises an error",
284+
"uri": "mongodb://example.com/?tlsInsecure=false&tlsDisableOcspEndpointCheck=true",
285+
"valid": false,
286+
"warning": false,
287+
"hosts": null,
288+
"auth": null,
289+
"options": {}
290+
},
291+
{
292+
"description": "tlsInsecure and tlsDisableOcspEndpointCheck both present (and false) raises an error",
293+
"uri": "mongodb://example.com/?tlsInsecure=false&tlsDisableOcspEndpointCheck=false",
294+
"valid": false,
295+
"warning": false,
296+
"hosts": null,
297+
"auth": null,
298+
"options": {}
299+
},
300+
{
301+
"description": "tlsDisableOcspEndpointCheck and tlsInsecure both present (and true) raises an error",
302+
"uri": "mongodb://example.com/?tlsDisableOcspEndpointCheck=true&tlsInsecure=true",
303+
"valid": false,
304+
"warning": false,
305+
"hosts": null,
306+
"auth": null,
307+
"options": {}
308+
},
309+
{
310+
"description": "tlsDisableOcspEndpointCheck=true and tlsInsecure=false raises an error",
311+
"uri": "mongodb://example.com/?tlsDisableOcspEndpointCheck=true&tlsInsecure=false",
312+
"valid": false,
313+
"warning": false,
314+
"hosts": null,
315+
"auth": null,
316+
"options": {}
317+
},
318+
{
319+
"description": "tlsDisableOcspEndpointCheck=false and tlsInsecure=true raises an error",
320+
"uri": "mongodb://example.com/?tlsDisableOcspEndpointCheck=false&tlsInsecure=true",
321+
"valid": false,
322+
"warning": false,
323+
"hosts": null,
324+
"auth": null,
325+
"options": {}
326+
},
327+
{
328+
"description": "tlsDisableOcspEndpointCheck and tlsInsecure both present (and false) raises an error",
329+
"uri": "mongodb://example.com/?tlsDisableOcspEndpointCheck=false&tlsInsecure=false",
330+
"valid": false,
331+
"warning": false,
332+
"hosts": null,
333+
"auth": null,
334+
"options": {}
239335
}
240336
]
241337
}

0 commit comments

Comments
 (0)