summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Client/Proxy.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Bcfg2/Client/Proxy.py')
-rw-r--r--src/lib/Bcfg2/Client/Proxy.py39
1 files changed, 25 insertions, 14 deletions
diff --git a/src/lib/Bcfg2/Client/Proxy.py b/src/lib/Bcfg2/Client/Proxy.py
index cf6efac89..679b4c52b 100644
--- a/src/lib/Bcfg2/Client/Proxy.py
+++ b/src/lib/Bcfg2/Client/Proxy.py
@@ -119,7 +119,7 @@ class SSLHTTPConnection(httplib.HTTPConnection):
"""
def __init__(self, host, port=None, strict=None, timeout=90, key=None,
- cert=None, ca=None, scns=None, protocol='xmlrpc/ssl'):
+ cert=None, ca=None, scns=None, protocol='xmlrpc/tlsv1'):
"""Initializes the `httplib.HTTPConnection` object and stores security
parameters
@@ -144,15 +144,15 @@ class SSLHTTPConnection(httplib.HTTPConnection):
specify the same file as `cert` if using a file that
contains both. See
http://docs.python.org/library/ssl.html#ssl-certificates
- for details. Required if using xmlrpc/ssl with client
- certificate authentication.
+ for details. Required if using client certificate
+ authentication.
cert : string, optional
The file system path to the local endpoint's SSL
certificate. May specify the same file as `cert` if using
a file that contains both. See
http://docs.python.org/library/ssl.html#ssl-certificates
- for details. Required if using xmlrpc/ssl with client
- certificate authentication.
+ for details. Required if using client certificate
+ authentication.
ca : string, optional
The file system path to a set of concatenated certificate
authority certs, which are used to validate certificates
@@ -232,7 +232,8 @@ class SSLHTTPConnection(httplib.HTTPConnection):
class XMLRPCTransport(xmlrpclib.Transport):
def __init__(self, key=None, cert=None, ca=None,
- scns=None, use_datetime=0, timeout=90):
+ scns=None, use_datetime=0, timeout=90,
+ protocol='xmlrpc/tlsv1'):
if hasattr(xmlrpclib.Transport, '__init__'):
xmlrpclib.Transport.__init__(self, use_datetime)
self.key = key
@@ -240,6 +241,7 @@ class XMLRPCTransport(xmlrpclib.Transport):
self.ca = ca
self.scns = scns
self.timeout = timeout
+ self.protocol = protocol
def make_connection(self, host):
host, self._extra_headers = self.get_host_info(host)[0:2]
@@ -248,7 +250,8 @@ class XMLRPCTransport(xmlrpclib.Transport):
cert=self.cert,
ca=self.ca,
scns=self.scns,
- timeout=self.timeout)
+ timeout=self.timeout,
+ protocol=self.protocol)
def request(self, host, handler, request_body, verbose=0):
"""Send request to server and return response."""
@@ -291,9 +294,15 @@ class ComponentProxy(xmlrpclib.ServerProxy):
"""Constructs proxies to components. """
options = [
- Bcfg2.Options.Common.location, Bcfg2.Options.Common.ssl_key,
- Bcfg2.Options.Common.ssl_cert, Bcfg2.Options.Common.ssl_ca,
+ Bcfg2.Options.Common.location, Bcfg2.Options.Common.ssl_ca,
Bcfg2.Options.Common.password, Bcfg2.Options.Common.client_timeout,
+ Bcfg2.Options.Common.protocol,
+ Bcfg2.Options.PathOption(
+ '--ssl-key', cf=('communication', 'key'), dest="key",
+ help='Path to SSL key'),
+ Bcfg2.Options.PathOption(
+ cf=('communication', 'certificate'), dest="cert",
+ help='Path to SSL certificate'),
Bcfg2.Options.Option(
"-u", "--user", default="root", cf=('communication', 'user'),
help='The user to provide for authentication'),
@@ -323,10 +332,12 @@ class ComponentProxy(xmlrpclib.ServerProxy):
path)
else:
url = Bcfg2.Options.setup.server
- ssl_trans = XMLRPCTransport(Bcfg2.Options.setup.key,
- Bcfg2.Options.setup.cert,
- Bcfg2.Options.setup.ca,
- Bcfg2.Options.setup.ssl_cns,
- Bcfg2.Options.setup.client_timeout)
+ ssl_trans = XMLRPCTransport(
+ key=Bcfg2.Options.setup.key,
+ cert=Bcfg2.Options.setup.cert,
+ ca=Bcfg2.Options.setup.ca,
+ scns=Bcfg2.Options.setup.ssl_cns,
+ timeout=Bcfg2.Options.setup.client_timeout,
+ protocol=Bcfg2.Options.setup.protocol)
xmlrpclib.ServerProxy.__init__(self, url,
allow_none=True, transport=ssl_trans)