Skip to content

Commit c3a1ccc

Browse files
committed
[_519][_281] force verify mode to CERT_NONE if irods verify setting is explicitly none
1 parent ed2e73c commit c3a1ccc

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

irods/connection.py

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

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

0 commit comments

Comments
 (0)