Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling SSLKEYLOGFILE Capability #19081

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions chia/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from collections.abc import Awaitable
from dataclasses import dataclass, field
from ipaddress import IPv4Network, IPv6Network, ip_network
from os import environ as os_environ
from pathlib import Path
from typing import Any, Callable, Optional, Union, cast

Expand Down Expand Up @@ -73,6 +74,9 @@ def ssl_context_for_server(
)
ssl_context.load_cert_chain(certfile=str(cert_path), keyfile=str(key_path))
ssl_context.verify_mode = ssl.CERT_REQUIRED
keylog_filename = os_environ.get("CHIA_SSLKEYLOGFILENAME_SERVER")
if keylog_filename:
ssl_context.keylog_filename = keylog_filename
return ssl_context


Expand All @@ -83,6 +87,9 @@ def ssl_context_for_root(
verify_ssl_certs_and_keys([Path(ca_cert_file)], [], log)

ssl_context = ssl.create_default_context(purpose=ssl.Purpose.SERVER_AUTH, cafile=ca_cert_file)
keylog_filename = os_environ.get("CHIA_SSLKEYLOGFILENAME_ROOT")
if keylog_filename:
ssl_context.keylog_filename = keylog_filename
return ssl_context


Expand All @@ -102,6 +109,9 @@ def ssl_context_for_client(
ssl_context.check_hostname = False
ssl_context.load_cert_chain(certfile=str(cert_path), keyfile=str(key_path))
ssl_context.verify_mode = ssl.CERT_REQUIRED
keylog_filename = os_environ.get("CHIA_SSLKEYLOGFILENAME_CLIENT")
if keylog_filename:
ssl_context.keylog_filename = keylog_filename
return ssl_context


Expand Down
Loading