Skip to content

Commit 17ccf09

Browse files
authored
API docs: explain security config options interplay (#1239)
1 parent 971dc9d commit 17ccf09

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

docs/source/api.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ Each supported scheme maps to a particular :class:`neo4j.Driver` subclass that i
9595
| neo4j+s | :ref:`neo4j-driver-ref` with encryption (accepts only certificates signed by a certificate authority), full certificate checks. |
9696
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------+
9797

98+
99+
.. note::
100+
101+
See also :ref:`encryption-config-note-ref` to understand how the URI scheme relates to other encryption configuration options.
102+
103+
98104
.. note::
99105

100106
See https://neo4j.com/docs/operations-manual/current/configuration/ports/ for Neo4j ports.
@@ -413,9 +419,12 @@ Additional configuration can be provided via the :class:`neo4j.Driver` construct
413419
+ :ref:`user-agent-ref`
414420
+ :ref:`driver-notifications-min-severity-ref`
415421
+ :ref:`driver-notifications-disabled-categories-ref`
422+
+ :ref:`driver-notifications-disabled-classifications-ref`
416423
+ :ref:`driver-warn-notification-severity-ref`
417424
+ :ref:`telemetry-disabled-ref`
418425

426+
:ref:`encryption-config-note-ref`
427+
419428

420429
.. _connection-acquisition-timeout-ref:
421430

@@ -594,6 +603,9 @@ For example:
594603
---------------
595604
Specify a custom SSL context to use for wrapping connections.
596605

606+
The driver offers other, easier APIs for common encryption configurations (see :ref:`encryption-config-note-ref`).
607+
It's likely that your use-case doesn't actually require this options.
608+
597609
This setting is only available for URI schemes ``bolt://`` and ``neo4j://`` (:ref:`uri-ref`).
598610

599611
If given, ``encrypted``, ``trusted_certificates``, and ``client_certificate`` have no effect.
@@ -794,6 +806,23 @@ The driver transmits the following information:
794806
.. versionadded:: 5.13
795807

796808

809+
.. _encryption-config-note-ref:
810+
811+
Note on Encryption Configuration
812+
--------------------------------
813+
There are different *mutually exclusive* ways of configuring TLS/SSL encryption behavior of the driver:
814+
815+
* Use a URI scheme ending in ``+s``. This auto-configures the driver to use TLS and only trust system CAs.
816+
* Use a URI scheme ending in ``+ssc``. This auto-configures the driver to use TLS and trust any certificate.
817+
* Use a URI scheme without suffix (i.e. ``neo4j://`` or ``bolt://``) and one of the following mutually exclusive options:
818+
819+
* set :ref:`encrypted-ref` to ``True`` and optionally configure :ref:`trusted-certificates-ref` and/or
820+
:ref:`client-certificate-ref` to enable TLS with custom security settings.
821+
* or set :ref:`ssl-context-ref` to gain full control (and responsibility) over the TLS configuration.
822+
* or set ``encrypted=False`` (default) to disable TLS.
823+
824+
825+
797826
Driver Object Lifetime
798827
======================
799828

docs/source/async_api.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,19 @@ Each supported scheme maps to a particular :class:`neo4j.AsyncDriver` subclass t
101101
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
102102
| bolt+s | :ref:`async-bolt-driver-ref` with encryption (accepts only certificates signed by a certificate authority), full certificate checks. |
103103
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
104-
| neo4j | :ref:`async-neo4j-driver-ref` with no encryption or with custom encryption configuration, see :ref:`async-driver-configuration-ref`. |
104+
| neo4j | :ref:`async-neo4j-driver-ref` with no encryption or with custom encryption configuration, see :ref:`async-driver-configuration-ref`. |
105105
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
106106
| neo4j+ssc | :ref:`async-neo4j-driver-ref` with encryption (accepts self signed certificates). |
107107
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
108108
| neo4j+s | :ref:`async-neo4j-driver-ref` with encryption (accepts only certificates signed by a certificate authority), full certificate checks. |
109109
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
110110

111+
112+
.. note::
113+
114+
See also :ref:`encryption-config-note-ref` to understand how the URI scheme relates to other encryption configuration options.
115+
116+
111117
.. note::
112118

113119
See https://neo4j.com/docs/operations-manual/current/configuration/ports/ for Neo4j ports.

src/neo4j/_conf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ class TrustSystemCAs(TrustStore):
5959
certificate authority. This option is primarily intended for use with
6060
full certificates.
6161
62+
The driver loads the trusted system CAs using Python's
63+
:meth:`ssl.SSLContext.load_default_certs`.
64+
6265
For example::
6366
6467
import neo4j

0 commit comments

Comments
 (0)