the bulk of the conversion to native gnutls (no openssl shim)
This commit is contained in:
@@ -14,6 +14,9 @@ DEFAULT_WORK_DIR = '@XPL_DEFAULT_WORK_DIR@'
|
||||
|
||||
DEFAULT_CERT_PATH = '@XPL_DEFAULT_CERT_PATH@'
|
||||
DEFAULT_KEY_PATH = '@XPL_DEFAULT_KEY_PATH@'
|
||||
DEFAULT_DHPARAMS_PATH = '@XPL_DEFAULT_DHPARAMS_PATH@'
|
||||
DEFAULT_RSAPARAMS_PATH = '@XPL_DEFAULT_RSAPARAMS_PATH@'
|
||||
DEFAULT_RANDSEED_PATH = '@XPL_DEFAULT_RANDSEED_PATH@'
|
||||
DEFAULT_SLAPD_PATH = '@DEFAULT_SLAPD_PATH@'
|
||||
DEFAULT_SLAPD_SCHEMA_DIR = '@DEFAULT_SLAPD_SCHEMA_DIR@'
|
||||
|
||||
|
||||
@@ -629,71 +629,6 @@ def ModifyConfProperties(props):
|
||||
fileProps.update(props)
|
||||
WriteConfProperties(fileProps)
|
||||
|
||||
def GenerateCertificate(keyPath, certPath):
|
||||
"""Generate a temporary, self-signed certificate and private key"""
|
||||
openssl_path = os.popen('which openssl').read().strip()
|
||||
|
||||
if openssl_path and openssl_path is not '':
|
||||
# make key path
|
||||
path = keyPath.split('/')
|
||||
path = '/' + '/'.join(path[0:-1])
|
||||
|
||||
if not os.path.exists(path):
|
||||
os.makedirs(path)
|
||||
|
||||
# make cert path
|
||||
path = certPath.split('/')
|
||||
path = '/' + '/'.join(path[0:-1])
|
||||
|
||||
if not os.path.exists(path):
|
||||
os.makedirs(path)
|
||||
|
||||
cmd = openssl_path + ' req -x509 -nodes'
|
||||
cmd += ' -subj \'/C=US/ST=foo/L=bar/CN=' + socket.gethostname() + '\''
|
||||
cmd += ' -newkey rsa:1024 -keyout ' + keyPath + ' -out ' + certPath
|
||||
|
||||
x = os.popen4(cmd)[1].read()
|
||||
|
||||
if x.find('error') >= 0:
|
||||
raise BongoError(x)
|
||||
else:
|
||||
raise BongoError('openssl not found')
|
||||
|
||||
#def GenerateCertificate(keyPath, certPath):
|
||||
# from OpenSSL import crypto
|
||||
# import socket
|
||||
#
|
||||
# pkey = crypto.PKey()
|
||||
# cert = crypto.X509()
|
||||
# issuer = cert.get_issuer()
|
||||
#
|
||||
# # This has to be the host name
|
||||
# issuer.commonName = socket.gethostname()
|
||||
#
|
||||
# pkey.generate_key(crypto.TYPE_RSA, 1024)
|
||||
# #cert.set_issuer(issuer)
|
||||
# cert.sign(pkey, 'md5')
|
||||
#
|
||||
# pkey_dump = crypto.dump_privatekey(crypto.FILETYPE_PEM, pkey)
|
||||
# cert_dump = crypto.dump_certificate(crypto.FILETYPE_PEM, cert)
|
||||
#
|
||||
# path = keyPath.split('/')
|
||||
# path = '/' + '/'.join(path[0:-1])
|
||||
# if not os.path.exists(path):
|
||||
# os.makedirs(path)
|
||||
# pkey_file = open(keyPath, 'w+')
|
||||
# pkey_file.write(pkey_dump)
|
||||
# pkey_file.close()
|
||||
#
|
||||
# path = certPath.split('/')
|
||||
# path = '/' + '/'.join(path[0:-1])
|
||||
# if not os.path.exists(path):
|
||||
# os.makedirs(path)
|
||||
# cert_file = open(certPath, 'w+')
|
||||
# cert_file.write(cert_dump)
|
||||
# cert_file.close()
|
||||
|
||||
|
||||
SCHEMA_XML = '%s/bongo-schema.xml' % Xpl.DEFAULT_CONF_DIR
|
||||
BASE_XML = '%s/base-schema.xml' % Xpl.DEFAULT_CONF_DIR
|
||||
|
||||
|
||||
Reference in New Issue
Block a user