Enable mTLS support for WebSocket connections in tellupdater by configuring certificate and key files.
This commit is contained in:
@@ -147,6 +147,7 @@ def on_close(ws, close_status_code, close_msg):
|
||||
def on_open(ws):
|
||||
print("[WS][OPEN] WebSocket opened.")
|
||||
|
||||
|
||||
def main():
|
||||
# Start SSE listener in a separate background thread
|
||||
sse_thread = threading.Thread(target=listen_to_sse, daemon=True)
|
||||
@@ -163,7 +164,16 @@ def main():
|
||||
on_close=on_close,
|
||||
on_open=on_open,
|
||||
)
|
||||
ws.run_forever(sslopt={"cert_reqs": 0})
|
||||
|
||||
# --- mTLS CERTIFICATES ADDED HERE --
|
||||
import ssl
|
||||
ssl_settings = {
|
||||
"certfile": "/etc/ssl/certs/secrets/mx-x10sa-queue-01.crt",
|
||||
"keyfile": "/etc/ssl/certs/secrets/mx-x10sa-queue-01.key",
|
||||
"cert_reqs": ssl.CERT_REQUIRED
|
||||
}
|
||||
|
||||
ws.run_forever(sslopt=ssl_settings)
|
||||
except Exception as e:
|
||||
print(f"[MAIN][ERROR] ws.run_forever() crashed with: {e}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user