Commit ccc44c9f authored by David Johnson's avatar David Johnson

Replace a couple more m2crypto client uses with builtin ssl module.

parent 37ccded4
...@@ -32,9 +32,7 @@ import sys ...@@ -32,9 +32,7 @@ import sys
import getopt import getopt
import os, os.path import os, os.path
import xmlrpclib import xmlrpclib
import ssl
from M2Crypto.m2xmlrpclib import SSL_Transport
from M2Crypto import SSL
## ##
# The package version number # The package version number
...@@ -142,10 +140,10 @@ if not os.access(certificate, os.R_OK): ...@@ -142,10 +140,10 @@ if not os.access(certificate, os.R_OK):
sys.exit(-1); sys.exit(-1);
pass pass
ctx = SSL.Context('sslv23') ctx = ssl.create_default_context(ssl.Purpose.SERVER_AUTH)
ctx.load_cert(certificate, certificate) ctx.load_cert_chain(certificate)
ctx.set_verify(SSL.verify_none, 16) ctx.check_hostname = False
ctx.set_allow_unknown_ca(1) ctx.verify_mode = ssl.CERT_NONE
# This is parsed by the Proxy object. # This is parsed by the Proxy object.
URI = "https://" + xmlrpc_server + ":443" + path URI = "https://" + xmlrpc_server + ":443" + path
...@@ -154,7 +152,7 @@ if debug: ...@@ -154,7 +152,7 @@ if debug:
pass pass
# Get a handle on the server, # Get a handle on the server,
server = xmlrpclib.ServerProxy(URI, SSL_Transport(ctx)); server = xmlrpclib.ServerProxy(URI, context=ctx)
# Invoke method and print response. # Invoke method and print response.
methodname = req_args[0] methodname = req_args[0]
meth = getattr(server, methodname) meth = getattr(server, methodname)
......
...@@ -171,17 +171,16 @@ def init_server(): ...@@ -171,17 +171,16 @@ def init_server():
sys.exit(2) sys.exit(2)
pass pass
from M2Crypto.m2xmlrpclib import SSL_Transport import ssl
from M2Crypto import SSL
URI = "https://" + XMLRPC_SERVER + ":" + str(XMLRPC_PORT) + prefix URI = "https://" + XMLRPC_SERVER + ":" + str(XMLRPC_PORT) + prefix
ctx = SSL.Context("sslv23") ctx = ssl.create_default_context(ssl.Purpose.SERVER_AUTH)
ctx.load_cert(CERTIFICATE, CERTIFICATE) ctx.load_cert_chain(CERTIFICATE)
ctx.set_verify(SSL.verify_none, 16) ctx.check_hostname = False
ctx.set_allow_unknown_ca(0) ctx.verify_mode = ssl.CERT_NONE
SERVER = xmlrpclib.ServerProxy(URI, SSL_Transport(ctx)) SERVER = xmlrpclib.ServerProxy(URI, context=ctx)
pass pass
return return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment