Commit 4ed799f8 authored by Gary Wong's avatar Gary Wong

Use the certificate issuer as the default XMLRPC server (or www.emulab.net

as the default clearinghouse).
parent 26d9f4f2
......@@ -23,96 +23,9 @@ import os
import time
import re
import xmlrpclib
from M2Crypto import X509
# Default server
XMLRPC_SERVER = "boss"
SERVER_PATH = ":443/protogeni/xmlrpc/"
HOME = os.environ["HOME"]
# Path to my certificate
CERTIFICATE = HOME + "/.ssl/encrypted.pem"
# Got tired of typing this over and over so I stuck it in a file.
PASSPHRASEFILE = HOME + "/.ssl/password"
passphrase = ""
# Debugging output.
debug = 0
impotent = 0
def Fatal(message):
print message
sys.exit(1)
return
def PassPhraseCB(v, prompt1='Enter passphrase:', prompt2='Verify passphrase:'):
passphrase = open(PASSPHRASEFILE).readline()
passphrase = passphrase.strip()
return passphrase
#
# Call the rpc server.
#
def do_method(module, method, params, URI=None):
if debug:
print module + " " + method + " " + str(params);
pass
if not os.path.exists(CERTIFICATE):
return Fatal("error: missing emulab certificate: %s\n" % CERTIFICATE)
from M2Crypto.m2xmlrpclib import SSL_Transport
from M2Crypto import SSL
if URI == None:
URI = "https://" + XMLRPC_SERVER + SERVER_PATH + module
else:
URI = URI + "/" + module
pass
ctx = SSL.Context("sslv23")
ctx.load_cert(CERTIFICATE, CERTIFICATE, PassPhraseCB)
ctx.set_verify(SSL.verify_none, 16)
ctx.set_allow_unknown_ca(0)
# Get a handle on the server,
server = xmlrpclib.ServerProxy(URI, SSL_Transport(ctx), verbose=0)
# Get a pointer to the function we want to invoke.
meth = getattr(server, method)
meth_args = [ params ]
#
# Make the call.
#
try:
response = apply(meth, meth_args)
pass
except xmlrpclib.Fault, e:
print e.faultString
return (-1, None)
#
# Parse the Response, which is a Dictionary. See EmulabResponse in the
# emulabclient.py module. The XML standard converts classes to a plain
# Dictionary, hence the code below.
#
if len(response["output"]):
print response["output"],
print ": ",
pass
rval = response["code"]
#
# If the code indicates failure, look for a "value". Use that as the
# return value instead of the code.
#
if rval:
if response["value"]:
rval = response["value"]
pass
pass
return (rval, response)
execfile( "test-common.py" )
#
# Get a credential for myself, that allows me to do things at the SA.
......
......@@ -22,96 +22,9 @@ import getopt
import os
import re
import xmlrpclib
from M2Crypto import X509
# Default server
XMLRPC_SERVER = "boss"
SERVER_PATH = ":443/protogeni/xmlrpc/"
HOME = os.environ["HOME"]
# Path to my certificate
CERTIFICATE = HOME + "/.ssl/encrypted.pem"
# Got tired of typing this over and over so I stuck it in a file.
PASSPHRASEFILE = HOME + "/.ssl/password"
passphrase = ""
# Debugging output.
debug = 0
impotent = 0
def Fatal(message):
print message
sys.exit(1)
return
def PassPhraseCB(v, prompt1='Enter passphrase:', prompt2='Verify passphrase:'):
passphrase = open(PASSPHRASEFILE).readline()
passphrase = passphrase.strip()
return passphrase
#
# Call the rpc server.
#
def do_method(module, method, params, URI=None):
if debug:
print module + " " + method + " " + str(params);
pass
if not os.path.exists(CERTIFICATE):
return Fatal("error: missing emulab certificate: %s\n" % CERTIFICATE)
from M2Crypto.m2xmlrpclib import SSL_Transport
from M2Crypto import SSL
if URI == None:
URI = "https://" + XMLRPC_SERVER + SERVER_PATH + module
else:
URI = URI + "/" + module
pass
ctx = SSL.Context("sslv23")
ctx.load_cert(CERTIFICATE, CERTIFICATE, PassPhraseCB)
ctx.set_verify(SSL.verify_none, 16)
ctx.set_allow_unknown_ca(0)
# Get a handle on the server,
server = xmlrpclib.ServerProxy(URI, SSL_Transport(ctx), verbose=0)
# Get a pointer to the function we want to invoke.
meth = getattr(server, method)
meth_args = [ params ]
#
# Make the call.
#
try:
response = apply(meth, meth_args)
pass
except xmlrpclib.Fault, e:
print e.faultString
return (-1, None)
#
# Parse the Response, which is a Dictionary. See EmulabResponse in the
# emulabclient.py module. The XML standard converts classes to a plain
# Dictionary, hence the code below.
#
if len(response["output"]):
print response["output"],
print ": ",
pass
rval = response["code"]
#
# If the code indicates failure, look for a "value". Use that as the
# return value instead of the code.
#
if rval:
if response["value"]:
rval = response["value"]
pass
pass
return (rval, response)
execfile( "test-common.py" )
#
# Get a credential for myself, that allows me to do things at the SA.
......
......@@ -23,96 +23,9 @@ import os
import time
import re
import xmlrpclib
from M2Crypto import X509
# Default server
XMLRPC_SERVER = "boss"
SERVER_PATH = ":443/protogeni/xmlrpc/"
HOME = os.environ["HOME"]
# Path to my certificate
CERTIFICATE = HOME + "/.ssl/encrypted.pem"
# Got tired of typing this over and over so I stuck it in a file.
PASSPHRASEFILE = HOME + "/.ssl/password"
passphrase = ""
# Debugging output.
debug = 0
impotent = 0
def Fatal(message):
print message
sys.exit(1)
return
def PassPhraseCB(v, prompt1='Enter passphrase:', prompt2='Verify passphrase:'):
passphrase = open(PASSPHRASEFILE).readline()
passphrase = passphrase.strip()
return passphrase
#
# Call the rpc server.
#
def do_method(module, method, params, URI=None):
if debug:
print module + " " + method + " " + str(params);
pass
if not os.path.exists(CERTIFICATE):
return Fatal("error: missing emulab certificate: %s\n" % CERTIFICATE)
from M2Crypto.m2xmlrpclib import SSL_Transport
from M2Crypto import SSL
if URI == None:
URI = "https://" + XMLRPC_SERVER + SERVER_PATH + module
else:
URI = URI + "/" + module
pass
ctx = SSL.Context("sslv23")
ctx.load_cert(CERTIFICATE, CERTIFICATE, PassPhraseCB)
ctx.set_verify(SSL.verify_none, 16)
ctx.set_allow_unknown_ca(0)
# Get a handle on the server,
server = xmlrpclib.ServerProxy(URI, SSL_Transport(ctx), verbose=0)
# Get a pointer to the function we want to invoke.
meth = getattr(server, method)
meth_args = [ params ]
#
# Make the call.
#
try:
response = apply(meth, meth_args)
pass
except xmlrpclib.Fault, e:
print e.faultString
return (-1, None)
#
# Parse the Response, which is a Dictionary. See EmulabResponse in the
# emulabclient.py module. The XML standard converts classes to a plain
# Dictionary, hence the code below.
#
if len(response["output"]):
print response["output"],
print ": ",
pass
rval = response["code"]
#
# If the code indicates failure, look for a "value". Use that as the
# return value instead of the code.
#
if rval:
if response["value"]:
rval = response["value"]
pass
pass
return (rval, response)
execfile( "test-common.py" )
#
# Get a credential for myself, that allows me to do things at the SA.
......
......@@ -22,96 +22,9 @@ import getopt
import os
import re
import xmlrpclib
from M2Crypto import X509
# Default server
XMLRPC_SERVER = "boss"
SERVER_PATH = ":443/protogeni/xmlrpc/"
HOME = os.environ["HOME"]
# Path to my certificate
CERTIFICATE = HOME + "/.ssl/encrypted.pem"
# Got tired of typing this over and over so I stuck it in a file.
PASSPHRASEFILE = HOME + "/.ssl/password"
passphrase = ""
# Debugging output.
debug = 0
impotent = 0
def Fatal(message):
print message
sys.exit(1)
return
def PassPhraseCB(v, prompt1='Enter passphrase:', prompt2='Verify passphrase:'):
passphrase = open(PASSPHRASEFILE).readline()
passphrase = passphrase.strip()
return passphrase
#
# Call the rpc server.
#
def do_method(module, method, params, URI=None):
if debug:
print module + " " + method + " " + str(params);
pass
if not os.path.exists(CERTIFICATE):
return Fatal("error: missing emulab certificate: %s\n" % CERTIFICATE)
from M2Crypto.m2xmlrpclib import SSL_Transport
from M2Crypto import SSL
if URI == None:
URI = "https://" + XMLRPC_SERVER + SERVER_PATH + module
else:
URI = URI + "/" + module
pass
ctx = SSL.Context("sslv23")
ctx.load_cert(CERTIFICATE, CERTIFICATE, PassPhraseCB)
ctx.set_verify(SSL.verify_none, 16)
ctx.set_allow_unknown_ca(0)
# Get a handle on the server,
server = xmlrpclib.ServerProxy(URI, SSL_Transport(ctx), verbose=0)
# Get a pointer to the function we want to invoke.
meth = getattr(server, method)
meth_args = [ params ]
#
# Make the call.
#
try:
response = apply(meth, meth_args)
pass
except xmlrpclib.Fault, e:
print e.faultString
return (-1, None)
#
# Parse the Response, which is a Dictionary. See EmulabResponse in the
# emulabclient.py module. The XML standard converts classes to a plain
# Dictionary, hence the code below.
#
if len(response["output"]):
print response["output"],
print ": ",
pass
rval = response["code"]
#
# If the code indicates failure, look for a "value". Use that as the
# return value instead of the code.
#
if rval:
if response["value"]:
rval = response["value"]
pass
pass
return (rval, response)
execfile( "test-common.py" )
#
# Get a credential for myself, that allows me to do things at the SA.
......
......@@ -22,96 +22,9 @@ import getopt
import os
import re
import xmlrpclib
from M2Crypto import X509
# Default server
XMLRPC_SERVER = "boss"
SERVER_PATH = ":443/protogeni/xmlrpc/"
HOME = os.environ["HOME"]
# Path to my certificate
CERTIFICATE = HOME + "/.ssl/encrypted.pem"
# Got tired of typing this over and over so I stuck it in a file.
PASSPHRASEFILE = HOME + "/.ssl/password"
passphrase = ""
# Debugging output.
debug = 0
impotent = 0
def Fatal(message):
print message
sys.exit(1)
return
def PassPhraseCB(v, prompt1='Enter passphrase:', prompt2='Verify passphrase:'):
passphrase = open(PASSPHRASEFILE).readline()
passphrase = passphrase.strip()
return passphrase
#
# Call the rpc server.
#
def do_method(module, method, params, URI=None):
if debug:
print module + " " + method + " " + str(params);
pass
if not os.path.exists(CERTIFICATE):
return Fatal("error: missing emulab certificate: %s\n" % CERTIFICATE)
from M2Crypto.m2xmlrpclib import SSL_Transport
from M2Crypto import SSL
if URI == None:
URI = "https://" + XMLRPC_SERVER + SERVER_PATH + module
else:
URI = URI + "/" + module
pass
ctx = SSL.Context("sslv23")
ctx.load_cert(CERTIFICATE, CERTIFICATE, PassPhraseCB)
ctx.set_verify(SSL.verify_none, 16)
ctx.set_allow_unknown_ca(0)
# Get a handle on the server,
server = xmlrpclib.ServerProxy(URI, SSL_Transport(ctx), verbose=0)
# Get a pointer to the function we want to invoke.
meth = getattr(server, method)
meth_args = [ params ]
#
# Make the call.
#
try:
response = apply(meth, meth_args)
pass
except xmlrpclib.Fault, e:
print e.faultString
return (-1, None)
#
# Parse the Response, which is a Dictionary. See EmulabResponse in the
# emulabclient.py module. The XML standard converts classes to a plain
# Dictionary, hence the code below.
#
if len(response["output"]):
print response["output"],
print ": ",
pass
rval = response["code"]
#
# If the code indicates failure, look for a "value". Use that as the
# return value instead of the code.
#
if rval:
if response["value"]:
rval = response["value"]
pass
pass
return (rval, response)
execfile( "test-common.py" )
#
# Get a credential for myself, that allows me to do things at the SA.
......
......@@ -23,96 +23,9 @@ import os
import time
import re
import xmlrpclib
from M2Crypto import X509
# Default server
XMLRPC_SERVER = "boss"
SERVER_PATH = ":443/protogeni/xmlrpc/"
HOME = os.environ["HOME"]
# Path to my certificate
CERTIFICATE = HOME + "/.ssl/encrypted.pem"
# Got tired of typing this over and over so I stuck it in a file.
PASSPHRASEFILE = HOME + "/.ssl/password"
passphrase = ""
# Debugging output.
debug = 0
impotent = 0
def Fatal(message):
print message
sys.exit(1)
return
def PassPhraseCB(v, prompt1='Enter passphrase:', prompt2='Verify passphrase:'):
passphrase = open(PASSPHRASEFILE).readline()
passphrase = passphrase.strip()
return passphrase
#
# Call the rpc server.
#
def do_method(module, method, params, URI=None):
if debug:
print module + " " + method + " " + str(params);
pass
if not os.path.exists(CERTIFICATE):
return Fatal("error: missing emulab certificate: %s\n" % CERTIFICATE)
from M2Crypto.m2xmlrpclib import SSL_Transport
from M2Crypto import SSL
if URI == None:
URI = "https://" + XMLRPC_SERVER + SERVER_PATH + module
else:
URI = URI + "/" + module
pass
ctx = SSL.Context("sslv23")
ctx.load_cert(CERTIFICATE, CERTIFICATE, PassPhraseCB)
ctx.set_verify(SSL.verify_none, 16)
ctx.set_allow_unknown_ca(0)
# Get a handle on the server,
server = xmlrpclib.ServerProxy(URI, SSL_Transport(ctx), verbose=0)
# Get a pointer to the function we want to invoke.
meth = getattr(server, method)
meth_args = [ params ]
#
# Make the call.
#
try:
response = apply(meth, meth_args)
pass
except xmlrpclib.Fault, e:
print e.faultString
return (-1, None)
#
# Parse the Response, which is a Dictionary. See EmulabResponse in the
# emulabclient.py module. The XML standard converts classes to a plain
# Dictionary, hence the code below.
#
if len(response["output"]):
print response["output"],
print ": ",
pass
rval = response["code"]
#
# If the code indicates failure, look for a "value". Use that as the
# return value instead of the code.
#
if rval:
if response["value"]:
rval = response["value"]
pass
pass
return (rval, response)
execfile( "test-common.py" )
#
# Get a credential for myself, that allows me to do things at the SA.
......
......@@ -23,96 +23,9 @@ import os
import time
import re
import xmlrpclib
from M2Crypto import X509
# Default server
XMLRPC_SERVER = "boss"
SERVER_PATH = ":443/protogeni/xmlrpc/"
HOME = os.environ["HOME"]
# Path to my certificate
CERTIFICATE = HOME + "/.ssl/encrypted.pem"
# Got tired of typing this over and over so I stuck it in a file.
PASSPHRASEFILE = HOME + "/.ssl/password"
passphrase = ""
# Debugging output.
debug = 0
impotent = 0
def Fatal(message):
print message
sys.exit(1)