ZTS: Fix zfs_load-key failures on F39

The zfs_load-key tests were failing on F39 due to their use of the
deprecated ssl.wrap_socket function.  This commit updates the test to
instead use ssl.SSLContext() as described in
https://stackoverflow.com/a/65194957.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes #15534
Closes #15550
This commit is contained in:
Tony Hutter 2023-11-27 13:24:37 -08:00 committed by Brian Behlendorf
parent d1ee3d611d
commit f392c4073a
1 changed files with 4 additions and 1 deletions

View File

@ -124,7 +124,10 @@ if not httpd:
with open('$HTTPS_PORT_FILE', 'w') as portf: with open('$HTTPS_PORT_FILE', 'w') as portf:
print(port, file=portf) print(port, file=portf)
httpd.socket = ssl.wrap_socket(httpd.socket, server_side=True, keyfile='/$TESTPOOL/snakeoil.key', certfile='$SSL_CA_CERT_FILE', ssl_version=ssl.PROTOCOL_TLS) sslctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
sslctx.check_hostname = False
sslctx.load_cert_chain(certfile='$SSL_CA_CERT_FILE', keyfile='/$TESTPOOL/snakeoil.key')
httpd.socket = httpd.socket = sslctx.wrap_socket(httpd.socket, server_side=True)
os.chdir('$STF_SUITE/tests/functional/cli_root/zfs_load-key') os.chdir('$STF_SUITE/tests/functional/cli_root/zfs_load-key')