From: chaitanyabodlapati (@chaitanyabodlapati) <noreply+chaitanyabodlapati@github.com>
To: patroni/patroni <noreply+patroni-patroni@github.com>
Subject: [patroni/patroni] PR #3608: Add opt-in TLS verification flags for etcd/etcd3 DCS backends
Date: Fri, 08 May 2026 03:25:48 +0000
Message-ID: <gh-patroni-patroni-3608@github.com> (raw)
## Summary
Patroni currently exposes `ctl.insecure: true` and `restapi.verify_client: none` for relaxing TLS verification on the REST API and control tool, but provides no equivalent for the DCS (etcd / etcd3) backend. Users with internal PKI, legacy SAN-less certificates, or etcd `--auto-tls` deployments have no in-config way to relax TLS verification short of patching site-packages directly.
This PR adds three opt-in flags under the `etcd:` and `etcd3:` config sections, mirroring the existing pattern for `restapi`/`ctl`:
- `verify` — disable CA chain validation (last resort, e.g. for `--auto-tls`)
- `verify_hostname` — keep CA validation, skip hostname/SAN check
- `hostname_checks_common_name` — accept CN-only certs (legacy PKI)
All flags default to the secure value; existing configs are unaffected. A `WARNING` is logged at startup whenever a flag is relaxed, so the security state is visible in operational logs.
## Why
Many production Patroni deployments connect to etcd over HTTPS using one of these configurations:
etcd --auto-tls — etcd generates a fresh self-signed certificate at every startup. There is no CA file to provide, so Patroni's cacert: parameter cannot help. The TLS handshake always fails certificate validation.
Internal PKI with legacy certificates — certificates issued by an internal CA but without Subject Alternative Name (SAN) entries. Modern Python (urllib3 v2+) dropped the CN fallback and only checks SAN, so these certificates fail hostname validation even when the CA is trusted.
Internal PKI with hostname/IP mismatch — certificates with valid SANs, but the SANs contain DNS names while Patroni connects via IP (or vice versa). Verification fails on identity, not on trust.
In all three cases, Patroni cannot connect to etcd. The DCS backend is unavailable, leader election cannot run, and the cluster cannot form. Because there is no configuration flag to relax verification for the DCS layer specifically, the only working option today is to modify Patroni's installed source files directly — a change that is invisible to configuration management, is silently lost on every upgrade, and affects urllib3 globally across the entire process.
## Design
The change is intentionally minimal:
1. **One new file:** `patroni/dcs/etcd_tls.py` (helper)
2. **Two added lines** in `patroni/dcs/etcd.py` (import + hook call)
3. **No changes** to `patroni/dcs/etcd3.py` — `Etcd3Client` inherits
from `AbstractEtcdClientWithFailover` and the fix flows down via
`super().__init__()`.
Scoping principles:
- No global urllib3 mutation. The helper modifies the etcd client's
`PoolManager` in place via `connection_pool_kw`.
- No silenced warnings. urllib3's `InsecureRequestWarning` is left
alone. The helper logs one WARNING at startup describing the
relaxation.
- No retry-semantics changes. TLS configuration only.
- Backward-compatible: zero behavior change for users who don't
set any new flag.
## FIPS compatibility
The helper uses only stdlib `ssl` module functions
(`create_default_context`, `_create_unverified_context`). It does not
override cipher selection or TLS minimum versions, and it does not
bypass OpenSSL's FIPS provider.
On FIPS-validated OpenSSL builds where
`SSLContext.hostname_checks_common_name` is read-only, the helper
detects this via a probe and raises `RuntimeError` at startup with a
clear message directing the user to `verify_hostname=false` instead.
This degraded behavior is tested.
## Related
Multiple long-standing issues document this gap:
- #384 (2017) — self-signed certs, closed by pointing to `cacert:` workaround
- #2036 (2021) — etcd v3 + TLS Common Name, marked unsupported
- #2433 (2022) — `CERTIFICATE_VERIFY_FAILED` from `patronictl`, fixed
for ctl/restapi but not DCS
- etcd-io/etcd#15945 (2023) — Patroni connecting to etcd with TLS
inline patch 1: docs/ENVIRONMENT.rst, docs/yaml_configuration.rst, patroni/config.py and 7 more (+299/-6 lines) download inline-1.patchdiff --git a/docs/ENVIRONMENT.rst b/docs/ENVIRONMENT.rstindex 7dccd9fdfa..7ffcaab8c5 100644--- a/docs/ENVIRONMENT.rst+++ b/docs/ENVIRONMENT.rst@@ -83,6 +83,9 @@ Etcd
- **PATRONI\_ETCD\_CACERT**: The ca certificate. If present it will enable validation.
- **PATRONI\_ETCD\_CERT**: File with the client certificate.
- **PATRONI\_ETCD\_KEY**: File with the client key. Can be empty if the key is part of certificate.
+- **PATRONI\_ETCD\_VERIFY**: whether to verify the etcd server's TLS certificate. Defaults to ``true``. Set to ``false`` to disable certificate and hostname verification entirely.+- **PATRONI\_ETCD\_VERIFY\_HOSTNAME**: whether to verify that the certificate matches the host/IP being connected to. Defaults to ``true``. Set to ``false`` to keep CA-chain validation but skip the hostname check.+- **PATRONI\_ETCD\_HOSTNAME\_CHECKS\_COMMON\_NAME**: whether to allow matching the certificate Common Name when it has no Subject Alternative Name. Set to ``true`` to enable Common Name fallback where supported, or ``false`` to enforce SAN-only.
Etcdv3
------
diff --git a/docs/yaml_configuration.rst b/docs/yaml_configuration.rstindex ad3ec63028..acf76d3012 100644--- a/docs/yaml_configuration.rst+++ b/docs/yaml_configuration.rst@@ -146,6 +146,9 @@ Most of the parameters are optional, but you have to specify one of the **host**
- **cacert**: (optional) The ca certificate. If present it will enable validation.
- **cert**: (optional) file with the client certificate.
- **key**: (optional) file with the client key. Can be empty if the key is part of **cert**.
+- **verify**: (optional) whether to verify the etcd server's TLS certificate. Defaults to ``true``. Set to ``false`` to disable certificate and hostname verification entirely (insecure; intended only as a temporary measure, e.g. for etcd running with ``--auto-tls``).+- **verify_hostname**: (optional) whether to verify that the certificate matches the host/IP being connected to. Defaults to ``true``. Set to ``false`` to keep CA-chain validation but skip the hostname/SAN identity check.+- **hostname_checks_common_name**: (optional) whether to allow matching the certificate Common Name when it has no Subject Alternative Name. If unset, the installed urllib3's default behavior is preserved. Set to ``true`` to enable Common Name fallback where the TLS backend supports it, or ``false`` to enforce SAN-only verification.
Etcdv3
------
diff --git a/patroni/config.py b/patroni/config.pyindex 1b8df5811b..067d51f91f 100644--- a/patroni/config.py+++ b/patroni/config.py@@ -681,7 +681,8 @@ def _get_auth(name: str, params: Collection[str] = _AUTH_ALLOWED_PARAMETERS[:2])
# PATRONI_(ETCD|CONSUL|ZOOKEEPER|EXHIBITOR|...)_(HOSTS?|PORT|..)
name, suffix = (param[len(PATRONI_ENV_PREFIX):].split('_', 1) + [''])[:2]
if suffix in ('HOST', 'HOSTS', 'PORT', 'USE_PROXIES', 'PROTOCOL', 'SRV', 'SRV_SUFFIX', 'URL', 'PROXY',
- 'CACERT', 'CERT', 'KEY', 'VERIFY', 'TOKEN', 'CHECKS', 'DC', 'CONSISTENCY',+ 'CACERT', 'CERT', 'KEY', 'VERIFY', 'VERIFY_HOSTNAME',+ 'HOSTNAME_CHECKS_COMMON_NAME', 'TOKEN', 'CHECKS', 'DC', 'CONSISTENCY',
'REGISTER_SERVICE', 'SERVICE_CHECK_INTERVAL', 'SERVICE_CHECK_TLS_SERVER_NAME',
'SERVICE_TAGS', 'NAMESPACE', 'CONTEXT', 'USE_ENDPOINTS', 'SCOPE_LABEL', 'ROLE_LABEL',
'POD_IP', 'PORTS', 'LABELS', 'BYPASS_API_SERVICE', 'RETRIABLE_HTTP_CODES', 'KEY_PASSWORD',
@@ -699,7 +700,8 @@ def _get_auth(name: str, params: Collection[str] = _AUTH_ALLOWED_PARAMETERS[:2])
value = value and _parse_list(value)
elif suffix in ('LABELS', 'SET_ACLS', 'AUTH_DATA', 'BOOTSTRAP_LABELS'):
value = _parse_dict(value)
- elif suffix in ('USE_PROXIES', 'REGISTER_SERVICE', 'USE_ENDPOINTS', 'BYPASS_API_SERVICE', 'VERIFY'):+ elif suffix in ('USE_PROXIES', 'REGISTER_SERVICE', 'USE_ENDPOINTS', 'BYPASS_API_SERVICE',+ 'VERIFY', 'VERIFY_HOSTNAME', 'HOSTNAME_CHECKS_COMMON_NAME'):
value = parse_bool(value)
if value is not None:
ret[name.lower()][suffix.lower()] = value
diff --git a/patroni/dcs/etcd.py b/patroni/dcs/etcd.pyindex d13f031a68..2dcf07e13e 100644--- a/patroni/dcs/etcd.py+++ b/patroni/dcs/etcd.py@@ -20,7 +20,8 @@
from dns import resolver
from dns.exception import DNSException
from urllib3 import Timeout
-from urllib3.exceptions import HTTPError, ProtocolError, ReadTimeoutError+from urllib3.connection import HTTPSConnection+from urllib3.exceptions import HTTPError, ProtocolError, ReadTimeoutError, SSLError
from ..exceptions import DCSError
from ..postgresql.mpp import AbstractMPP
@@ -138,6 +139,19 @@ def _check_cluster_raft_term(self, cluster_id: Optional[str], value: Union[None,
self._raft_term = raft_term
+class EtcdHTTPSConnectionPool(urllib3.HTTPSConnectionPool):+ """Enforce SAN-only verification with urllib3's legacy hostname matcher."""++ def _validate_conn(self, conn: HTTPSConnection) -> None:+ super()._validate_conn(conn)+ cert = conn.sock.getpeercert() if conn.sock is not None else None+ # The legacy matcher only falls back to CN when there are no DNS/IP SAN entries.+ if not cert or not any(key in ('DNS', 'IP Address') for key, _ in cert.get('subjectAltName', ())):+ conn.close()+ raise SSLError('Etcd TLS certificate has no DNS or IP Subject Alternative Name; '+ 'Common Name fallback is disabled')++
class AbstractEtcdClientWithFailover(abc.ABC, etcd.Client, StaleEtcdNodeGuard):
ERROR_CLS: Type[Exception]
@@ -154,6 +168,7 @@ def __init__(self, config: Dict[str, Any], dns_resolver: DnsCachingResolver, cac
# Workaround for the case when https://github.com/jplana/python-etcd/pull/196 is not applied
self.http.connection_pool_kw.pop('ssl_version', None)
self._config = config
+ self._tls_configured = False
self._load_machines_cache()
self._allow_reconnect = True
# allow passing retry argument to api_execute in params
@@ -161,6 +176,88 @@ def __init__(self, config: Dict[str, Any], dns_resolver: DnsCachingResolver, cac
self._read_options.add('retry')
self._del_conditions.add('retry')
+ def _configure_tls(self) -> None:+ """Apply opt-in TLS verification settings for discovered HTTPS client endpoints.++ With no overrides, preserve the installed urllib3's behavior.+ If Common Name fallback cannot be enabled, log a warning and retain SAN-only verification.++ Behavior matrix (verify / verify_hostname / hostname_checks_common_name)::++ false / any / any -> no CA-chain or hostname verification+ true / false / any -> CA-chain validation only; hostname check off+ true / true / unset -> preserve python-etcd / urllib3 defaults+ true / true / false -> CA-chain + SAN validation; no CN fallback+ true / true / true -> CA-chain + hostname validation, allowing CN fallback+ if supported by the TLS backend; otherwise warn and retain SAN-only+ """+ config = self._config+ verify = config.get('verify', True)+ verify_hostname = config.get('verify_hostname', True)+ cn_fallback = config.get('hostname_checks_common_name')++ # Nothing to do when everything is at its secure default: leave the+ # stock python-etcd / urllib3 TLS setup unchanged. This also avoids+ # building an SSLContext (and loading the platform trust store) for+ # existing configurations that set none of these flags.+ if verify and verify_hostname and cn_fallback is None:+ return++ pool_kw = self.http.connection_pool_kw++ if not verify:+ pool_kw['cert_reqs'] = 'CERT_NONE'+ pool_kw['assert_hostname'] = False+ pool_kw.pop('ca_certs', None)+ return logger.warning('Etcd TLS certificate verification is disabled')++ pool_kw['cert_reqs'] = 'CERT_REQUIRED'+ if not verify_hostname:+ pool_kw['assert_hostname'] = False+ return logger.warning('Etcd TLS hostname verification is disabled')++ if int(urllib3.__version__.split('.')[0]) < 2:+ if cn_fallback:+ return logger.warning('Etcd TLS Common Name fallback is enabled')+ self.http.pool_classes_by_scheme = dict(self.http.pool_classes_by_scheme,+ https=EtcdHTTPSConnectionPool)+ return++ # urllib3 2.x already enforces SAN-only verification by default.+ # A custom context is needed only to enable CN fallback.+ if not cn_fallback:+ return++ import ssl++ from urllib3.connection import create_urllib3_context++ ctx = create_urllib3_context(cert_reqs=ssl.CERT_REQUIRED)+ # Delegate identity verification to urllib3's matcher, which honors+ # hostname_checks_common_name on this context.+ ctx.check_hostname = False+ try:+ ctx.hostname_checks_common_name = True+ cn_fallback_enabled = ctx.hostname_checks_common_name+ except AttributeError:+ cn_fallback_enabled = False++ if not cn_fallback_enabled:+ return logger.warning('This TLS backend cannot enable Common Name fallback; '+ 'retaining SAN-only verification')++ # urllib3 loads explicit CA/client files from pool options.+ # For a supplied context, load system trust ourselves.+ if not any(pool_kw.get(key) for key in ('ca_certs', 'ca_cert_dir', 'ca_cert_data')):+ load_default_certs = getattr(ctx, 'load_default_certs', None)+ if not callable(load_default_certs):+ return logger.warning('This TLS backend requires an explicit cacert '+ 'when enabling Common Name fallback; retaining SAN-only verification')+ load_default_certs()++ pool_kw['ssl_context'] = ctx+ logger.warning('Etcd TLS Common Name fallback is enabled')+
def _calculate_timeouts(self, etcd_nodes: int, timeout: Optional[float] = None) -> Tuple[int, float, int]:
"""Calculate a request timeout and number of retries per single etcd node.
In case if the timeout per node is too small (less than one second) we will reduce the number of nodes.
@@ -443,6 +540,12 @@ def _load_machines_cache(self) -> bool:
if not machines_cache:
raise etcd.EtcdException
+ # Config/SRV endpoints may already be HTTPS; configure TLS before the+ # first request so the initial contact uses the right settings.+ if not self._tls_configured and any(urlparse(url).scheme == 'https' for url in machines_cache):+ self._configure_tls()+ self._tls_configured = True+
# enforce resolving dns name,they might get new ips
self._update_dns_cache(self._dns_resolver.remove, machines_cache)
@@ -475,6 +578,13 @@ def _refresh_machines_cache(self, machines_cache: Optional[List[str]] = None) ->
if value:
ret = set(self._machines_cache) != set(value)
self._machines_cache = value
+ # Endpoints learned through member discovery may use a different+ # protocol than the seed (e.g. an HTTP seed advertising HTTPS+ # client URLs), so (re)configure TLS whenever an HTTPS endpoint+ # appears and it has not been configured yet.+ if not self._tls_configured and any(urlparse(url).scheme == 'https' for url in value):+ self._configure_tls()+ self._tls_configured = True
elif machines_cache: # we are just starting or all nodes were not available at some point
raise etcd.EtcdException("Could not get the list of servers, "
"maybe you provided the wrong "
diff --git a/patroni/validator.py b/patroni/validator.pyindex bdaffac07a..18117c3e2d 100644--- a/patroni/validator.py+++ b/patroni/validator.py@@ -1073,7 +1073,10 @@ def __call__(self, value: Any) -> bool:
Optional("password"): str,
Optional("cacert"): str,
Optional("cert"): str,
- Optional("key"): str+ Optional("key"): str,+ Optional("verify"): bool,+ Optional("verify_hostname"): bool,+ Optional("hostname_checks_common_name"): bool
}
schema = Schema({
diff --git a/tests/test_etcd.py b/tests/test_etcd.pyindex 399e506e88..ada57d29ee 100644--- a/tests/test_etcd.py+++ b/tests/test_etcd.py@@ -1,7 +1,7 @@
import socket
import unittest
-from unittest.mock import Mock, patch, PropertyMock+from unittest.mock import MagicMock, Mock, patch, PropertyMock
import etcd
import urllib3.util.connection
@@ -236,12 +236,36 @@ def test__refresh_machines_cache(self):
self.assertFalse(self.client._refresh_machines_cache())
self.assertRaises(etcd.EtcdException, self.client._refresh_machines_cache, ['http://localhost:2379';])
+ @patch.object(EtcdClient, '_get_machines_list',+ Mock(return_value=['https://localhost:2379';, 'https://localhost:4001';]))+ def test__refresh_machines_cache_configures_tls_for_https_members(self):+ # An HTTP seed can advertise HTTPS client URLs via member discovery;+ # TLS must be (re)configured when such endpoints appear even though the+ # seed itself was HTTP.+ self.client._tls_configured = False+ with patch.object(EtcdClient, '_configure_tls') as configure_tls:+ self.client._refresh_machines_cache(['http://localhost:2379';])+ configure_tls.assert_called_once()+ self.assertTrue(self.client._tls_configured)+
def test__load_machines_cache(self):
self.client._config = {}
self.assertRaises(Exception, self.client._load_machines_cache)
self.client._config = {'srv': 'blabla'}
self.assertRaises(etcd.EtcdException, self.client._load_machines_cache)
+ @patch.object(EtcdClient, '_get_machines_cache_from_config',+ Mock(return_value=['https://localhost:2379';, 'https://localhost:4001';]))+ def test__load_machines_cache_configures_tls_for_https_config(self):+ # Config/SRV endpoints that are already HTTPS must trigger TLS+ # configuration before the first request.+ self.client._tls_configured = False+ with patch.object(EtcdClient, '_refresh_machines_cache', Mock(return_value=True)), \+ patch.object(EtcdClient, '_configure_tls') as configure_tls:+ self.client._load_machines_cache()+ configure_tls.assert_called_once()+ self.assertTrue(self.client._tls_configured)+
@patch.object(socket.socket, 'connect')
def test_create_connection_patched(self, mock_connect):
self.assertRaises(socket.error, urllib3.util.connection.create_connection, ('fail', 2379))
@@ -382,3 +406,129 @@ def test_set_history_value(self):
def test_last_seen(self):
self.assertIsNotNone(self.etcd.last_seen)
+++class TestConfigureTLS(unittest.TestCase):++ def _run(self, config, pool_kw=None):+ from patroni.dcs.etcd import AbstractEtcdClientWithFailover++ class _FakeHTTP:+ def __init__(self):+ self.connection_pool_kw = dict(pool_kw or {})+ self.pool_classes_by_scheme = {'https': object}++ class _FakeClient:+ _config = config+ http = _FakeHTTP()++ client = _FakeClient()+ AbstractEtcdClientWithFailover._configure_tls(client)+ return client++ def test_secure_defaults_are_noop(self):+ # All defaults -> early return, pool untouched.+ client = self._run({})+ self.assertEqual(client.http.connection_pool_kw, {})++ def test_verify_false_sets_cert_none(self):+ client = self._run({'verify': False})+ kw = client.http.connection_pool_kw+ self.assertEqual(kw['cert_reqs'], 'CERT_NONE')+ self.assertFalse(kw['assert_hostname'])+ self.assertNotIn('ssl_context', kw)++ def test_verify_hostname_false(self):+ client = self._run({'verify_hostname': False})+ kw = client.http.connection_pool_kw+ self.assertEqual(kw['cert_reqs'], 'CERT_REQUIRED')+ self.assertFalse(kw['assert_hostname'])++ def test_cn_fallback_true_on_urllib3_1x(self):+ # urllib3 1.x + cn_fallback=True -> warns, does not swap pool class.+ with patch('patroni.dcs.etcd.urllib3.__version__', '1.26.20'):+ client = self._run({'hostname_checks_common_name': True})+ self.assertNotIn('ssl_context', client.http.connection_pool_kw)++ def test_cn_fallback_false_on_urllib3_1x_installs_pool(self):+ # urllib3 1.x + cn_fallback=False -> installs EtcdHTTPSConnectionPool.+ from patroni.dcs.etcd import EtcdHTTPSConnectionPool+ with patch('patroni.dcs.etcd.urllib3.__version__', '1.26.20'):+ client = self._run({'hostname_checks_common_name': False})+ self.assertIs(client.http.pool_classes_by_scheme['https'],+ EtcdHTTPSConnectionPool)++ def test_cn_fallback_true_on_urllib3_2x(self):+ # urllib3 2.x + cn_fallback=True -> builds a custom ssl_context.+ fake_ctx = MagicMock()+ fake_ctx.hostname_checks_common_name = True+ with patch('patroni.dcs.etcd.urllib3.__version__', '2.0.7'), \+ patch('urllib3.connection.create_urllib3_context',+ return_value=fake_ctx):+ client = self._run({'hostname_checks_common_name': True},+ pool_kw={'ca_certs': '/tmp/ca.pem'})+ self.assertIs(client.http.connection_pool_kw['ssl_context'], fake_ctx)++ def test_cn_fallback_false_on_urllib3_2x_is_noop(self):+ # urllib3 2.x + cn_fallback=False -> SAN-only is already the default.+ with patch('patroni.dcs.etcd.urllib3.__version__', '2.0.7'):+ client = self._run({'hostname_checks_common_name': False})+ self.assertNotIn('ssl_context', client.http.connection_pool_kw)++ def test_cn_fallback_2x_setter_unsupported_warns(self):+ # urllib3 2.x but the backend can't enable CN fallback (setter raises):+ # warn and retain SAN-only (no ssl_context set).+ fake_ctx = MagicMock()+ type(fake_ctx).hostname_checks_common_name = PropertyMock(+ side_effect=AttributeError)+ with patch('patroni.dcs.etcd.urllib3.__version__', '2.0.7'), \+ patch('urllib3.connection.create_urllib3_context',+ return_value=fake_ctx):+ client = self._run({'hostname_checks_common_name': True})+ self.assertNotIn('ssl_context', client.http.connection_pool_kw)++ def test_cn_fallback_2x_loads_default_certs_when_no_ca(self):+ # urllib3 2.x + cn_fallback=True + no CA configured -> load system trust.+ fake_ctx = MagicMock()+ fake_ctx.hostname_checks_common_name = True+ with patch('patroni.dcs.etcd.urllib3.__version__', '2.0.7'), \+ patch('urllib3.connection.create_urllib3_context',+ return_value=fake_ctx):+ client = self._run({'hostname_checks_common_name': True})+ # No ca_certs in pool -> load_default_certs() was invoked, context set.+ fake_ctx.load_default_certs.assert_called_once()+ self.assertIs(client.http.connection_pool_kw['ssl_context'], fake_ctx)++ def test_cn_fallback_2x_no_load_default_certs_warns(self):+ # urllib3 2.x + cn_fallback=True + no CA + backend without a callable+ # load_default_certs -> warn and retain SAN-only (no ssl_context set).+ fake_ctx = MagicMock()+ fake_ctx.hostname_checks_common_name = True+ fake_ctx.load_default_certs = None # not callable+ with patch('patroni.dcs.etcd.urllib3.__version__', '2.0.7'), \+ patch('urllib3.connection.create_urllib3_context',+ return_value=fake_ctx):+ client = self._run({'hostname_checks_common_name': True})+ self.assertNotIn('ssl_context', client.http.connection_pool_kw)+++class TestEtcdHTTPSConnectionPool(unittest.TestCase):++ def _validate(self, cert):+ import urllib3++ from patroni.dcs.etcd import EtcdHTTPSConnectionPool+ pool = EtcdHTTPSConnectionPool.__new__(EtcdHTTPSConnectionPool)+ conn = MagicMock()+ conn.sock.getpeercert.return_value = cert+ with patch.object(urllib3.HTTPSConnectionPool, '_validate_conn'):+ pool._validate_conn(conn)++ def test_san_present_passes(self):+ # Cert with a DNS SAN passes.+ self._validate({'subjectAltName': (('DNS', 'etcd'),)})++ def test_no_san_raises(self):+ from patroni.dcs.etcd import SSLError+ with self.assertRaises(SSLError):+ self._validate({'subject': ((('commonName', 'etcd'),),)})diff --git a/typings/urllib3/__init__.pyi b/typings/urllib3/__init__.pyiindex 61b5b66c32..ea2687d4c7 100644--- a/typings/urllib3/__init__.pyi+++ b/typings/urllib3/__init__.pyi@@ -4,4 +4,6 @@ from .response import HTTPResponse
from .util.request import make_headers
from .util.timeout import Timeout
+__version__: str+
__all__ = ['HTTPResponse', 'HTTPConnectionPool', 'HTTPSConnectionPool', 'PoolManager', 'Timeout', 'make_headers']
diff --git a/typings/urllib3/connection.pyi b/typings/urllib3/connection.pyiindex 06b265db8f..df319f15ab 100644--- a/typings/urllib3/connection.pyi+++ b/typings/urllib3/connection.pyi@@ -1,2 +1,15 @@+import ssl
from http.client import HTTPConnection as _HTTPConnection
+from typing import Any, Optional++
class HTTPConnection(_HTTPConnection): ...
+++class HTTPSConnection(HTTPConnection):+ sock: Optional[ssl.SSLSocket]+++def create_urllib3_context(ssl_version: Optional[int] = None, cert_reqs: Optional[int] = None,+ options: Optional[int] = None, ciphers: Optional[str] = None,+ **kwargs: Any) -> ssl.SSLContext: ...diff --git a/typings/urllib3/connectionpool.pyi b/typings/urllib3/connectionpool.pyiindex b2e8d3db2f..1779078d0d 100644--- a/typings/urllib3/connectionpool.pyi+++ b/typings/urllib3/connectionpool.pyi@@ -1,2 +1,8 @@+from .connection import HTTPSConnection++
class HTTPConnectionPool: ...
-class HTTPSConnectionPool(HTTPConnectionPool): ...+++class HTTPSConnectionPool(HTTPConnectionPool):+ def _validate_conn(self, conn: HTTPSConnection) -> None: ...diff --git a/typings/urllib3/poolmanager.pyi b/typings/urllib3/poolmanager.pyiindex 5ea41a68a5..978debb92e 100644--- a/typings/urllib3/poolmanager.pyi+++ b/typings/urllib3/poolmanager.pyi@@ -3,6 +3,7 @@ from .response import HTTPResponse
class PoolManager:
headers: Dict[str, str]
connection_pool_kw: Dict[str, Any]
+ pool_classes_by_scheme: Dict[str, Any]
def __init__(self, num_pools: int = 10, headers: Optional[Dict[str, str]] = None, **connection_pool_kw: Any) -> None: ...
def urlopen(self, method: str, url: str, body: Optional[Any] = None, headers: Optional[Dict[str,str]] = None, encode_multipart: bool = True, multipart_boundary: Optional[str] = None, **kw: Any) -> HTTPResponse: ...
def request(self, method: str, url: str, fields: Optional[Any] = None, headers: Optional[Dict[str, str]] = None, **urlopen_kw: Any) -> HTTPResponse: ...