Skip to content
Open
Show file tree
Hide file tree
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: 5 additions & 5 deletions src/domain_fronter.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ def __init__(self, config: dict):
self.worker_path = config.get("worker_path", "")
self.auth_key = config.get("auth_key", "")
self.verify_ssl = config.get("verify_ssl", True)
if not self.verify_ssl:
log.warning("SECURITY WARNING: verify_ssl is set to False. "
"Enforcing SSL verification for security.")
self.verify_ssl = True

# Connection pool β€” TTL-based, pre-warmed, with concurrency control
self._pool: list[tuple[asyncio.StreamReader, asyncio.StreamWriter, float]] = []
Expand Down Expand Up @@ -106,11 +110,7 @@ def __init__(self, config: dict):
# ── helpers ───────────────────────────────────────────────────

def _ssl_ctx(self) -> ssl.SSLContext:
ctx = ssl.create_default_context()
if not self.verify_ssl:
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
return ctx
return ssl.create_default_context()

async def _open(self):
"""Open a TLS connection to the CDN.
Expand Down
3 changes: 0 additions & 3 deletions src/h2_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,6 @@ async def _do_connect(self):
ctx = ssl.create_default_context()
# Advertise both h2 and http/1.1 β€” some DPI blocks h2-only ALPN
ctx.set_alpn_protocols(["h2", "http/1.1"])
if not self.verify_ssl:
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE

# Create raw TCP socket with TCP_NODELAY BEFORE TLS handshake.
# Nagle's algorithm can delay small writes (H2 frames) by up to 200ms
Expand Down
5 changes: 2 additions & 3 deletions src/proxy_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,8 @@ async def _do_sni_rewrite_tunnel(self, host: str, port: int, reader, writer,

# Step 2: open outgoing TLS to target IP with the safe SNI
ssl_ctx_client = ssl.create_default_context()
if not self.fronter.verify_ssl:
ssl_ctx_client.check_hostname = False
ssl_ctx_client.verify_mode = ssl.CERT_NONE
# Advertise HTTP/1.1 to the remote proxy server
ssl_ctx_client.set_alpn_protocols(["http/1.1"])
try:
r_out, w_out = await asyncio.wait_for(
asyncio.open_connection(
Expand Down