本文整理汇总了Python中sslToolLib.gendir函数的典型用法代码示例。如果您正苦于以下问题:Python gendir函数的具体用法?Python gendir怎么用?Python gendir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gendir函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: genServerRpm_dependencies
def genServerRpm_dependencies(d):
""" generates server's SSL key set RPM - dependencies check """
serverKeyPairDir = os.path.join(d['--dir'],
getMachineName(d['--set-hostname']))
gendir(serverKeyPairDir)
server_key_name = os.path.basename(d['--server-key'])
server_key = os.path.join(serverKeyPairDir, server_key_name)
server_cert_name = os.path.basename(d['--server-cert'])
server_cert = os.path.join(serverKeyPairDir, server_cert_name)
server_cert_req_name = os.path.basename(d['--server-cert-req'])
server_cert_req = os.path.join(serverKeyPairDir, server_cert_req_name)
jabberd_ssl_cert_name = os.path.basename(d['--jabberd-ssl-cert'])
jabberd_ssl_cert = os.path.join(serverKeyPairDir, jabberd_ssl_cert_name )
dependencyCheck(server_key)
dependencyCheck(server_cert)
dependencyCheck(server_cert_req)
# if all the other dependencies exist except the server pem,
# just generate it
try:
dependencyCheck(jabberd_ssl_cert)
except FailedFileDependencyException:
gen_jabberd_cert(d)
开发者ID:bbuckingham,项目名称:katello,代码行数:29,代码来源:katello_ssl_tool.py
示例2: genCaRpm_dependencies
def genCaRpm_dependencies(d):
""" generates ssl cert RPM. """
gendir(d['--dir'])
ca_cert_name = os.path.basename(d['--ca-cert'])
ca_cert = os.path.join(d['--dir'], ca_cert_name)
dependencyCheck(ca_cert)
开发者ID:bbuckingham,项目名称:katello,代码行数:7,代码来源:katello_ssl_tool.py
示例3: genServerCertReq_dependencies
def genServerCertReq_dependencies(d):
""" private server cert request generation """
serverKeyPairDir = os.path.join(d['--dir'],
getMachineName(d['--set-hostname']))
gendir(serverKeyPairDir)
server_key = os.path.join(serverKeyPairDir,
os.path.basename(d['--server-key']))
dependencyCheck(server_key)
开发者ID:bbuckingham,项目名称:katello,代码行数:10,代码来源:katello_ssl_tool.py
示例4: genPrivateCaKey
def genPrivateCaKey(password, d, verbosity=0, forceYN=0):
""" private CA key generation """
gendir(d['--dir'])
ca_key = os.path.join(d['--dir'], os.path.basename(d['--ca-key']))
if not forceYN and os.path.exists(ca_key):
sys.stderr.write("""\
ERROR: a CA private key already exists:
%s
If you wish to generate a new one, use the --force option.
""" % ca_key)
sys.exit(errnoGeneralError)
args = ("/usr/bin/openssl genrsa -passout pass:%s %s -out %s 2048"
% ('%s', CRYPTO, repr(cleanupAbsPath(ca_key))))
if verbosity >= 0:
print "Generating private CA key: %s" % ca_key
if verbosity > 1:
print "Commandline:", args % "PASSWORD"
try:
rotated = rotateFile(filepath=ca_key, verbosity=verbosity)
if verbosity>=0 and rotated:
print "Rotated: %s --> %s" \
% (d['--ca-key'], os.path.basename(rotated))
except ValueError:
pass
cwd = chdir(_getWorkDir())
try:
ret, out_stream, err_stream = rhn_popen(args % repr(password))
finally:
chdir(cwd)
out = out_stream.read(); out_stream.close()
err = err_stream.read(); err_stream.close()
if ret:
raise GenPrivateCaKeyException("Certificate Authority private SSL "
"key generation failed:\n%s\n%s"
% (out, err))
if verbosity > 2:
if out:
print "STDOUT:", out
if err:
print "STDERR:", err
# permissions:
os.chmod(ca_key, 0600)
开发者ID:bbuckingham,项目名称:katello,代码行数:49,代码来源:katello_ssl_tool.py
示例5: genServerKey
def genServerKey(d, verbosity=0):
""" private server key generation """
serverKeyPairDir = os.path.join(d['--dir'],
getMachineName(d['--set-hostname']))
gendir(serverKeyPairDir)
server_key = os.path.join(serverKeyPairDir,
os.path.basename(d['--server-key']))
args = ("/usr/bin/openssl genrsa -out %s 2048"
% (repr(cleanupAbsPath(server_key))))
# generate the server key
if verbosity >= 0:
print "\nGenerating the web server's SSL private key: %s" % server_key
if verbosity > 1:
print "Commandline:", args
try:
rotated = rotateFile(filepath=server_key, verbosity=verbosity)
if verbosity>=0 and rotated:
print "Rotated: %s --> %s" % (d['--server-key'],
os.path.basename(rotated))
except ValueError:
pass
cwd = chdir(_getWorkDir())
try:
ret, out_stream, err_stream = rhn_popen(args)
finally:
chdir(cwd)
out = out_stream.read(); out_stream.close()
err = err_stream.read(); err_stream.close()
if ret:
raise GenServerKeyException("web server's SSL key generation failed:\n%s\n%s"
% (out, err))
if verbosity > 2:
if out:
print "STDOUT:", out
if err:
print "STDERR:", err
# permissions:
os.chmod(server_key, 0600)
开发者ID:bbuckingham,项目名称:katello,代码行数:46,代码来源:katello_ssl_tool.py
示例6: genProxyServerTarball_dependencies
def genProxyServerTarball_dependencies(d):
""" dependency check for the step that generates RHN Proxy Server's
tar archive containing its SSL key set + CA certificate.
"""
serverKeySetDir = os.path.join(d['--dir'],
d['--set-hostname'])
gendir(serverKeySetDir)
ca_cert = pathJoin(d['--dir'], d['--ca-cert'])
server_key = pathJoin(serverKeySetDir, d['--server-key'])
server_cert = pathJoin(serverKeySetDir, d['--server-cert'])
server_cert_req = pathJoin(serverKeySetDir, d['--server-cert-req'])
dependencyCheck(ca_cert)
dependencyCheck(server_key)
dependencyCheck(server_cert)
dependencyCheck(server_cert_req)
开发者ID:ehelms,项目名称:katello-misc,代码行数:18,代码来源:katello_ssl_tool.py
示例7: genServerRpm_dependencies
def genServerRpm_dependencies(d):
""" generates server's SSL key set RPM - dependencies check """
serverKeyPairDir = os.path.join(d['--dir'],
d['--set-hostname'])
gendir(serverKeyPairDir)
server_key_name = os.path.basename(d['--server-key'])
server_key = os.path.join(serverKeyPairDir, server_key_name)
server_cert_name = os.path.basename(d['--server-cert'])
server_cert = os.path.join(serverKeyPairDir, server_cert_name)
server_cert_req_name = os.path.basename(d['--server-cert-req'])
server_cert_req = os.path.join(serverKeyPairDir, server_cert_req_name)
dependencyCheck(server_key)
dependencyCheck(server_cert)
dependencyCheck(server_cert_req)
开发者ID:ehelms,项目名称:katello-misc,代码行数:19,代码来源:katello_ssl_tool.py
示例8: genPublicCaCert_dependencies
def genPublicCaCert_dependencies(password, d, forceYN=0):
""" public CA certificate (client-side) generation """
gendir(d['--dir'])
ca_key = os.path.join(d['--dir'], os.path.basename(d['--ca-key']))
ca_cert = os.path.join(d['--dir'], os.path.basename(d['--ca-cert']))
if not forceYN and os.path.exists(ca_cert):
sys.stderr.write("""\
ERROR: a CA public certificate already exists:
%s
If you wish to generate a new one, use the --force option.
""" % ca_cert)
sys.exit(errnoGeneralError)
dependencyCheck(ca_key)
if password is None:
sys.stderr.write('ERROR: a CA password must be supplied.\n')
sys.exit(errnoGeneralError)
开发者ID:bbuckingham,项目名称:katello,代码行数:20,代码来源:katello_ssl_tool.py
示例9: genServerCert_dependencies
def genServerCert_dependencies(password, d):
""" server cert generation and signing dependency check """
if password is None:
sys.stderr.write('ERROR: a CA password must be supplied.\n')
sys.exit(errnoGeneralError)
serverKeyPairDir = os.path.join(d['--dir'],
getMachineName(d['--set-hostname']))
gendir(serverKeyPairDir)
ca_key = os.path.join(d['--dir'], os.path.basename(d['--ca-key']))
ca_cert = os.path.join(d['--dir'], os.path.basename(d['--ca-cert']))
server_cert_req = os.path.join(serverKeyPairDir,
os.path.basename(d['--server-cert-req']))
ca_openssl_cnf = os.path.join(d['--dir'], CA_OPENSSL_CNF_NAME)
dependencyCheck(ca_openssl_cnf)
dependencyCheck(ca_key)
dependencyCheck(ca_cert)
dependencyCheck(server_cert_req)
开发者ID:bbuckingham,项目名称:katello,代码行数:22,代码来源:katello_ssl_tool.py
示例10: legacyTreeFixup
def legacyTreeFixup(d):
""" move old server.* files to and "unknown" machinename directory
Most of this is RHN Satellite 2.* and 3.* changes. Near the end
we get to 3.6 changes.
"""
topdir = cleanupAbsPath(d['--dir'])
oldTree = '/etc/sysconfig/rhn/ssl'
if topdir != oldTree and os.path.exists(oldTree):
sys.stderr.write("""\
WARNING: %s
still exists even though
%s
is the currently configured build tree. You may wish to either
(a) move %s to
%s, or
(b) point directly at the old tree by via the --dir option.
""" % (oldTree, topdir, oldTree, topdir))
sys.stderr.write("Pausing for 5 secs")
for i in range(5):
sys.stderr.write("."); time.sleep(1)
sys.stderr.write("\n")
unknown = os.path.join(topdir, 'unknown')
server_rpm_name = os.path.basename(d.get('--server-rpm', ''))
serverKeyPairDir = None
if d.has_key('--set-hostname'):
serverKeyPairDir = os.path.join(d['--dir'],
getMachineName(d['--set-hostname']))
while os.path.exists(unknown):
# to avoid clashing with a possible "unknown" machinename
unknown = unknown + '_'
old_server_splat = os.path.join(topdir, 'server.')
moveMessage = ""
for ext in ('key', 'csr', 'crt'):
if os.path.exists(old_server_splat+ext):
gendir(unknown)
files = glob.glob(old_server_splat+ext+'*')
moved = []
for f in files:
# move the files to the "unknown" directory
new_server_splat = os.path.join(unknown, os.path.basename(f))
if not os.path.exists(new_server_splat):
shutil.copy2(f, new_server_splat)
os.unlink(f)
moved.append(f)
#if files and verbosity:
if moved:
s = 'server.' + ext + '*'
moveMessage = moveMessage + (
' <BUILD_DIR>/%s --> <BUILD_DIR>/%s/%s\n'
% (s, os.path.basename(unknown), s))
# move legacy server SSL RPMs. But if server_rpm_name is the same name
# as the target RPM name, then we move the RPMs into the appropriate
# machine name directory.
for name in [LEGACY_SERVER_RPM_NAME1, LEGACY_SERVER_RPM_NAME2]:
old_server_rpms = glob.glob(os.path.join(topdir, name+'-*-*.*.rpm'))
movedYN = 0
for old_rpm in old_server_rpms:
targetDir = unknown
if parseRPMFilename(old_rpm)[0] == server_rpm_name and serverKeyPairDir:
targetDir = serverKeyPairDir
gendir(targetDir)
# move the files to the targetDir directory
new_rpm = os.path.join(targetDir, os.path.basename(old_rpm))
if not os.path.exists(new_rpm):
shutil.copy2(old_rpm, new_rpm)
os.unlink(old_rpm)
movedYN = 1
if movedYN:
s = name+'-*-*.{noarch,src}.rpm'
moveMessage = moveMessage + """\
<BUILD_DIR>/%s
--> <BUILD_DIR>/%s/%s\n""" % (s, os.path.basename(targetDir), s)
# I move the first 100 .pem files I find
# if there is more than that... oh well
movedYN = 0
for i in range(100):
serial = fixSerial(hex(i))
oldPemPath = os.path.join(topdir, serial+'.pem')
newPemPath = os.path.join(unknown, serial+'.pem')
if os.path.exists(oldPemPath) and not os.path.exists(newPemPath):
gendir(unknown)
shutil.copy2(oldPemPath, newPemPath)
os.unlink(oldPemPath)
movedYN = 1
if movedYN:
moveMessage = moveMessage + (
' <BUILD_DIR>/HEX*.pem --> <BUILD_DIR>/%s/HEX*.pem\n'
% os.path.basename(unknown))
if moveMessage:
sys.stdout.write('\nLegacy tree structured file(s) moved:\n%s'
#.........这里部分代码省略.........
开发者ID:pombredanne,项目名称:spacewalk-1,代码行数:101,代码来源:rhn_ssl_tool.py
注:本文中的sslToolLib.gendir函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论