cado-nfs-client.py dies with "ValueError: check_hostname needs a SSL context with either CERT_OPTIONAL or CERT_REQUIRED" with Python 3.6
In cado-nfs-client.py, line 740ff, we have
context.check_hostname = bool(check_hostname)
if check_hostname:
context.verify_mode = ssl.CERT_REQUIRED
else:
context.verify_mode = ssl.CERT_NONE
I.e., the check_hostname attribute gets set before the verify_mode attribute. With Python 3.6, this produces a value error:
ValueError: check_hostname needs a SSL context with either CERT_OPTIONAL or CERT_REQUIRED
According to the SSL module documentation, Python versions prior to 3.7 expect verify_mode to be set before check_hostname, otherwise the above ValueError is thrown. In Python 3.7 and later, check_hostname is set automatically if necessary.
I propose moving the context.check_hostname = bool(check_hostname) down 4 lines, after the block that sets verify_mode.
I'm submitting a patch.
Alex