Add the same error-checking used for SSH to SSL keyfile generation.
This commit is contained in:
parent
88c1002fde
commit
218ae61836
1 changed files with 13 additions and 7 deletions
|
|
@ -33,13 +33,18 @@ def verify_SSL_key_and_cert(keyfile, certfile):
|
||||||
from Crypto.PublicKey import RSA
|
from Crypto.PublicKey import RSA
|
||||||
from twisted.conch.ssh.keys import Key
|
from twisted.conch.ssh.keys import Key
|
||||||
|
|
||||||
print " Creating SSL key and certificate (this need only be done once)."
|
print " Creating SSL key and certificate ... ",
|
||||||
|
|
||||||
|
try:
|
||||||
# create the RSA key and store it.
|
# create the RSA key and store it.
|
||||||
KEY_LENGTH = 1024
|
KEY_LENGTH = 1024
|
||||||
rsaKey = Key(RSA.generate(KEY_LENGTH))
|
rsaKey = Key(RSA.generate(KEY_LENGTH))
|
||||||
keyString = rsaKey.toString(type="OPENSSH")
|
keyString = rsaKey.toString(type="OPENSSH")
|
||||||
file(keyfile, 'w+b').write(keyString)
|
file(keyfile, 'w+b').write(keyString)
|
||||||
|
except Exception,e:
|
||||||
|
print "rsaKey error: %s\n WARNING: Evennia could not auto-generate SSL private key." % e
|
||||||
|
print "If this error persists, create game/%s yourself using third-party tools." % keyfile
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
# try to create the certificate
|
# try to create the certificate
|
||||||
CERT_EXPIRE = 365 * 20 # twenty years validity
|
CERT_EXPIRE = 365 * 20 # twenty years validity
|
||||||
|
|
@ -57,6 +62,7 @@ def verify_SSL_key_and_cert(keyfile, certfile):
|
||||||
print " Example (linux, using the openssl program): "
|
print " Example (linux, using the openssl program): "
|
||||||
print " %s" % exestring
|
print " %s" % exestring
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
print "done."
|
||||||
|
|
||||||
def getSSLContext():
|
def getSSLContext():
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue