Skip to content
This repository was archived by the owner on Aug 7, 2025. It is now read-only.

Commit 0d1591f

Browse files
William Douglasbryteise
authored andcommitted
Update server.py ssl wrapping
The previous method for wrapping ssl was removed so update to the replacement version. Signed-off-by: William Douglas <william.douglas@intel.com>
1 parent e0a4ed8 commit 0d1591f

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

test/functional/server.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -266,16 +266,13 @@ def parse_arguments():
266266

267267
# configure ssl certificates
268268
if args.server_cert and args.server_key:
269-
wrap_socket_args = {"certfile": args.server_cert,
270-
"keyfile": args.server_key,
271-
"server_side": True}
272-
273-
# add client certificate
269+
wrap_socket_args = {"server_side": True}
270+
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
271+
context.load_cert_chain(args.server_cert, args.server_key)
274272
if args.client_cert:
275-
wrap_socket_args.update({"ca_certs": args.client_cert,
276-
"cert_reqs": ssl.CERT_REQUIRED})
277-
278-
httpd.socket = ssl.wrap_socket(httpd.socket, **wrap_socket_args)
273+
context.load_verify_locations(cafile=args.client_cert)
274+
context.verify_mode = ssl.CERT_REQUIRED
275+
httpd.socket = context.wrap_socket(httpd.socket, **wrap_socket_args)
279276

280277
# invalid certificate combination
281278
elif args.server_cert or args.server_key or args.client_cert:

0 commit comments

Comments
 (0)