diff --git a/src/aare/daq/spreadsheetupdater.py b/src/aare/daq/spreadsheetupdater.py index 204a8102..fca2ff7a 100644 --- a/src/aare/daq/spreadsheetupdater.py +++ b/src/aare/daq/spreadsheetupdater.py @@ -137,25 +137,18 @@ def main(): """ while True: try: - # 1. Create the Context - # Use PROTOCOL_TLS_CLIENT as it's the modern standard + # Initialize with the modern client protocol context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) - # 2. Load the Server Trust (CA) + # Trust the PSI DMZ CA context.load_verify_locations(cafile="/etc/ssl/certs/secrets/mx-aaredb-dmz-01_Full_Chain_CA.pem") - # 3. Load the Client Identity (The key/cert that worked in curl) + # Load your machine identity context.load_cert_chain( certfile="/etc/ssl/certs/secrets/mx-x10sa-queue-01_from_dmz-01.crt", keyfile="/etc/ssl/certs/secrets/mx-x10sa-queue-01_from_dmz-01.key" ) - # 4. Critical: If NGINX is using a self-signed or internal CA, - # and the hostname doesn't perfectly match the Cert SN/SAN, - # you might need to toggle this, but keep it True for now. - context.check_hostname = True - context.verify_mode = ssl.CERT_REQUIRED - ws = websocket.WebSocketApp( WS_URL, header=WS_HEADERS, @@ -165,8 +158,7 @@ def main(): on_open=on_open, ) - # 5. Connect using ONLY the context - # We remove other keys to ensure websocket-client uses our pre-configured context + print(f"[WS][INFO] Connecting to {WS_URL}...") ws.run_forever(sslopt={"context": context}) except Exception as e: