mirror of
https://github.com/bunny-lab-io/Borealis.git
synced 2025-10-26 21:41:57 -06:00
Fix Socket.IO SSL context creation
This commit is contained in:
@@ -931,14 +931,14 @@ class AgentHttpClient:
|
|||||||
context = None
|
context = None
|
||||||
if isinstance(verify, str) and os.path.isfile(verify):
|
if isinstance(verify, str) and os.path.isfile(verify):
|
||||||
try:
|
try:
|
||||||
# ``create_default_context`` expects a proper CA bundle and
|
# Mirror Requests' certificate handling by starting from a
|
||||||
# will reject self-signed leaf certificates that we pin on
|
# default client context (which pre-loads the system
|
||||||
# disk. Build a dedicated client context instead and load
|
# certificate stores) and then layering the pinned
|
||||||
# the pinned certificate as a trust anchor so the SYSTEM
|
# certificate bundle on top. This matches the REST client
|
||||||
# agent can complete TLS handshakes identical to Requests.
|
# behaviour and ensures self-signed leaf certificates work
|
||||||
context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
|
# the same way for Socket.IO handshakes.
|
||||||
|
context = ssl.create_default_context()
|
||||||
context.check_hostname = False
|
context.check_hostname = False
|
||||||
context.verify_mode = ssl.CERT_REQUIRED
|
|
||||||
context.load_verify_locations(cafile=verify)
|
context.load_verify_locations(cafile=verify)
|
||||||
_log_agent(
|
_log_agent(
|
||||||
f"SocketIO TLS alignment created SSLContext from cafile={verify}",
|
f"SocketIO TLS alignment created SSLContext from cafile={verify}",
|
||||||
|
|||||||
Reference in New Issue
Block a user