From 80e224e8edcc6dace9bb47163e10fbc3eb88025e Mon Sep 17 00:00:00 2001 From: Franoosh Date: Sat, 10 Jan 2026 13:03:05 +0100 Subject: Add support for zmq certificates --- webserver.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'webserver.py') diff --git a/webserver.py b/webserver.py index a2b9b7a..4c45692 100644 --- a/webserver.py +++ b/webserver.py @@ -30,6 +30,7 @@ from helpers import ( CustomLoggingFormatter, DIRECTIVES, MAX_CAMERA_NAME_LENGTH, + auth_service, ) @@ -49,6 +50,7 @@ WEB_PORT = "8008" CTRL_BACKEND_ADDR = f"tcp://{HOST}:{ZMQ_PORT}" WEB_BACKEND_ADDR = f"tcp://{HOST}:{WEB_PORT}" TIME_FORMAT = '%Y_%m_%d-%H_%M_%S' +CERTIFICATE_DIR = 'certs' log_formatter = CustomLoggingFormatter() handler = logging.FileHandler(LOGFILE, encoding='utf-8', mode='a') @@ -68,6 +70,9 @@ ws_queues = defaultdict(dict) ctrl_msg_que = asyncio.Queue() # Create ZMQ context and socket: zmq_context = zmq.asyncio.Context() +# Authenticate context: +auth_service(zmq_context, CERTIFICATE_DIR) + zmq_socket = zmq_context.socket(zmq.DEALER) # Connect to ZMQ backend: zmq_socket.connect(WEB_BACKEND_ADDR) -- cgit v1.2.3