diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2006-06-02 21:08:53 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2006-06-02 21:08:53 +0000 |
commit | b36e11a35e722cddeccfd1c4cd92a9d6dc623d7e (patch) | |
tree | 34c7a42b7db51976d6ebc2b41ad51bb0cf5d2105 /src/lib/Client/Proxy.py | |
parent | 8a9a0968340d998bc46195bde54e28d57f5f8850 (diff) | |
download | bcfg2-b36e11a35e722cddeccfd1c4cd92a9d6dc623d7e.tar.gz bcfg2-b36e11a35e722cddeccfd1c4cd92a9d6dc623d7e.tar.bz2 bcfg2-b36e11a35e722cddeccfd1c4cd92a9d6dc623d7e.zip |
Initial checkin of peer SSL cert checks
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1869 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Client/Proxy.py')
-rw-r--r-- | src/lib/Client/Proxy.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lib/Client/Proxy.py b/src/lib/Client/Proxy.py index 9d96fd936..0e86c959c 100644 --- a/src/lib/Client/Proxy.py +++ b/src/lib/Client/Proxy.py @@ -1,12 +1,20 @@ '''Cobalt proxy provides client access to cobalt components''' __revision__ = '$Revision$' -import logging, socket, time, xmlrpclib, ConfigParser +import logging, socket, time, xmlrpclib, ConfigParser, httplib class CobaltComponentError(Exception): '''This error signals component connection errors''' pass +class SafeTransport(xmlrpclib.Transport): + """Handles an HTTPS transaction to an XML-RPC server.""" + def make_connection(self, host): + # create a HTTPS connection object from a host descriptor + # host may be a string, or a (host, x509-dict) tuple + host, extra_headers, x509 = self.get_host_info(host) + return httplib.HTTPS(host, None, '/tmp/keys/client.pkey', '/tmp/keys/client.cert') + class SafeProxy: '''Wrapper for proxy''' _cfile = ConfigParser.ConfigParser() @@ -32,7 +40,7 @@ class SafeProxy: else: address = self.__get_location(component) try: - self.proxy = xmlrpclib.ServerProxy(address) + self.proxy = xmlrpclib.ServerProxy(address, transport=SafeTransport()) except IOError, io_error: self.log.error("Invalid server URL %s: %s" % (address, io_error)) raise CobaltComponentError |