Skip to content

Commit

Permalink
Update server.py ssl wrapping
Browse files Browse the repository at this point in the history
The previous method for wrapping ssl was removed so update to the
replacement version.

Signed-off-by: William Douglas <[email protected]>
  • Loading branch information
bryteise committed Aug 28, 2024
1 parent 0e24981 commit 02a42b8
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions test/functional/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 02a42b8

Please sign in to comment.