From 02a42b89f455ce95b05225363ebd83734dac75e6 Mon Sep 17 00:00:00 2001 From: William Douglas Date: Wed, 28 Aug 2024 09:22:31 -0700 Subject: [PATCH] Update server.py ssl wrapping The previous method for wrapping ssl was removed so update to the replacement version. Signed-off-by: William Douglas --- test/functional/server.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/test/functional/server.py b/test/functional/server.py index 053ca599a..e7c17efa3 100755 --- a/test/functional/server.py +++ b/test/functional/server.py @@ -266,16 +266,13 @@ def parse_arguments(): # configure ssl certificates if args.server_cert and args.server_key: - wrap_socket_args = {"certfile": args.server_cert, - "keyfile": args.server_key, - "server_side": True} - - # add client certificate + wrap_socket_args = {"server_side": True} + context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) + context.load_cert_chain(args.server_cert, args.server_key) if args.client_cert: - wrap_socket_args.update({"ca_certs": args.client_cert, - "cert_reqs": ssl.CERT_REQUIRED}) - - httpd.socket = ssl.wrap_socket(httpd.socket, **wrap_socket_args) + context.load_verify_locations(cafile=args.client_cert) + context.verify_mode = ssl.CERT_REQUIRED + httpd.socket = context.wrap_socket(httpd.socket, **wrap_socket_args) # invalid certificate combination elif args.server_cert or args.server_key or args.client_cert: