Skip to content

Commit 6cc9a48

Browse files
committed
process SSL_CERT_DIR as well
1 parent bc43769 commit 6cc9a48

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
diff --git a/Lib/ssl.py b/Lib/ssl.py
2-
index 42ebb8ed384..5cf2575ecd8 100644
2+
index 42ebb8ed384..c15c0ec940f 100644
33
--- a/Lib/ssl.py
44
+++ b/Lib/ssl.py
5-
@@ -423,6 +423,7 @@ class SSLContext(_SSLContext):
5+
@@ -423,6 +423,8 @@ class SSLContext(_SSLContext):
66
"""An SSLContext holds various SSL-related configuration options and
77
data, such as certificates and possibly a private key."""
88
_windows_cert_stores = ("CA", "ROOT")
99
+ _FALLBACK_CERT_FILE = "/etc/pki/tls/cert.pem" # RHEL 8 and below, Fedora 33 and below
10+
+ _FALLBACK_CERT_DIR = "/etc/pki/tls/certs" # RHEL 8 and below, Fedora 33 and below
1011

1112
sslsocket_class = None # SSLSocket is assigned later.
1213
sslobject_class = None # SSLObject is assigned later.
13-
@@ -531,6 +532,12 @@ def load_default_certs(self, purpose=Purpose.SERVER_AUTH):
14+
@@ -531,6 +533,16 @@ def load_default_certs(self, purpose=Purpose.SERVER_AUTH):
1415
if sys.platform == "win32":
1516
for storename in self._windows_cert_stores:
1617
self._load_windows_store_certs(storename, purpose)
@@ -20,6 +21,10 @@ index 42ebb8ed384..5cf2575ecd8 100644
2021
+ not os.path.isfile(_def_paths[1]) and
2122
+ os.path.isfile(self._FALLBACK_CERT_FILE)):
2223
+ self.load_verify_locations(cafile=self._FALLBACK_CERT_FILE)
24+
+ if (_def_paths[2] not in os.environ and
25+
+ not os.path.isdir(_def_paths[3]) and
26+
+ os.path.isdir(self._FALLBACK_CERT_DIR)):
27+
+ self.load_verify_locations(capath=self._FALLBACK_CERT_DIR)
2328
self.set_default_verify_paths()
2429

2530
if hasattr(_SSLContext, 'minimum_version'):

0 commit comments

Comments
 (0)