Bug 1490392
| Summary: | xmlrpclib does not support SSL context, needed for SSL verification | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Rik Theys <rik.theys> |
| Component: | python | Assignee: | Charalampos Stratakis <cstratak> |
| Status: | CLOSED ERRATA | QA Contact: | Mirek Długosz <mzalewsk> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 7.4 | CC: | aladen, cstratak, dcallagh, fedoraproject.org, jkejda, pviktori, rduda |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | python-2.7.5-62.el7 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2018-04-10 15:00:08 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 1527012 | ||
|
Description
Rik Theys
2017-09-11 12:56:18 UTC
Hello. It is possible to disable the certificate verification by using the config file /etc/python/cert-verification.cfg as it is described here [0]. I believe that is the upstream issue for that bug [1]. Will dig a bit further. [0] https://access.redhat.com/articles/2039753 [1] https://bugs.python.org/issue22960 Hi, I am aware that I can disable it system-wide, but it would disable it for all scripts. The bug you refer to has been fixed and newer versions of the 2.7 series support additional "context" parameters to most functions that could use https. It seems only the certificate validation feature was backported, but not the extra parameters on those functions. As you see in the documentation for current 2.7 versions, xmlrpclib.ServerProxy supports a "context" parameter: https://docs.python.org/2.7/library/xmlrpclib.html Regards, Rik I don't think this patch was backported properly. With python-2.7.5-62.el7.x86_64 I get this exception:
Python 2.7.5 (default, Oct 11 2017, 10:12:42)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import xmlrpclib
>>> s = xmlrpclib.ServerProxy('https://beaker.engineering.redhat.com/')
>>> s.auth.who_am_i()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.7/xmlrpclib.py", line 1233, in __call__
return self.__send(self.__name, args)
File "/usr/lib64/python2.7/xmlrpclib.py", line 1591, in __request
verbose=self.__verbose
File "/usr/lib64/python2.7/xmlrpclib.py", line 1273, in request
return self.single_request(host, handler, request_body, verbose)
File "/usr/lib64/python2.7/xmlrpclib.py", line 1293, in single_request
h = self.make_connection(host)
File "/usr/lib64/python2.7/xmlrpclib.py", line 1509, in make_connection
self._connection = host, HTTPS(chost, None, context=context, **(x509 or {}))
NameError: global name 'context' is not defined
A Beaker user reported this as it breaks beaker-client which uses xmlrpclib.
I am guessing in this hunk of the offending patch:
63 @@ -1493,7 +1497,7 @@ class SafeTransport(Transport):
64 )
65 else:
66 chost, self._extra_headers, x509 = self.get_host_info(host)
67 - self._connection = host, HTTPS(chost, None, **(x509 or {}))
68 + self._connection = host, HTTPS(chost, None, context=context, **(x509 or {}))
69 return self._connection[1]
70
71 ##
it was supposed to be context=self.context. If you hunt upstream you might find a fixup commit which changes that. I notice that on my Fedora box (with latest Python 2.7.x) that line does indeed have context=self.context.
Good catch. The exact next commit after the initial patch is : https://github.com/python/cpython/commit/ee44314f9309b7b89dd5a7d897f0f917e9e47b1a#diff-1abc359a7923ab5abc19d0ccde812440 Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2018:0833 |