Skip to content

Commit 00e9cc2

Browse files
committed
[_519][_281] force verify mode to CERT_NONE if irods verify setting is explicitly none
1 parent 30b05a6 commit 00e9cc2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

irods/connection.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,14 @@ def requires_cs_negotiation(self):
187187

188188
@staticmethod
189189
def make_ssl_context(irods_account):
190-
check_hostname = getattr(irods_account,'ssl_verify_server','hostname')
190+
verify_server = getattr(irods_account,'ssl_verify_server','hostname')
191191
CAfile = getattr(irods_account,'ssl_ca_certificate_file',None)
192192
CApath = getattr(irods_account,'ssl_ca_certificate_path',None)
193-
verify = ssl.CERT_NONE if (None is CAfile is CApath) else ssl.CERT_REQUIRED
193+
verify = ssl.CERT_NONE if ((None is CAfile is CApath) or verify_server == 'none') else ssl.CERT_REQUIRED
194194
# See https://stackoverflow.com/questions/30461969/disable-default-certificate-verification-in-python-2-7-9/49040695#49040695
195195
ctx = ssl.create_default_context(ssl.Purpose.SERVER_AUTH, cafile=CAfile, capath=CApath)
196196
# Note: check_hostname must be assigned prior to verify_mode property or Python library complains!
197-
ctx.check_hostname = (check_hostname.startswith('host') and verify != ssl.CERT_NONE)
197+
ctx.check_hostname = (verify_server.startswith('host') and verify != ssl.CERT_NONE)
198198
ctx.verify_mode = verify
199199
return ctx
200200

0 commit comments

Comments
 (0)