allow for setup automation

1.6
Rob Fuller 2015-12-01 13:56:37 -05:00
parent d03cecbc37
commit f69383ad69
1 changed files with 16 additions and 8 deletions

View File

@ -10,17 +10,25 @@ from Crypto.Random import random
#
###################################################
# to set a static key used for initial agent staging:
# STAGING_KEY = '8q=SDS%l5&Bpf?xIjKL8=Kk2RNwY(f*d'
# Staging Key is set up via environmental variable
# or via command line. By setting RANDOM as random
# selected password will automatically be selected
# or it can be set to any bash acceptable
# character set for a password.
STAGING_KEY = os.getenv('STAGING_KEY', "BLANK")
punctuation = '!#$%&()*+,-./:;<=>?@[\]^_`{|}~'
# otherwise prompt the user for a set value to hash for the negotiation password
choice = raw_input("\n [>] Enter server negotiation password, enter for random generation: ")
if choice == "":
# if no password is entered, generation something random
punctuation = '!#$%&()*+,-./:;<=>?@[\]^_`{|}~'
if STAGING_KEY == "BLANK":
choice = raw_input("\n [>] Enter server negotiation password, enter for random generation: ")
if choice == "":
# if no password is entered, generation something random
STAGING_KEY = ''.join(random.sample(string.ascii_letters + string.digits + punctuation, 32))
else:
STAGING_KEY = hashlib.md5(choice).hexdigest()
elif STAGING_KEY == "RANDOM":
STAGING_KEY = ''.join(random.sample(string.ascii_letters + string.digits + punctuation, 32))
else:
STAGING_KEY = hashlib.md5(choice).hexdigest()
# the resource requested by the initial launcher
STAGE0_URI = "index.asp"