Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions psst/psst.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,17 @@ def secrets():
pass

@secrets.command()
def generate():
@click.option('-cm', '--cloud-manager',
default=False,
help="Set Cloud Manager Mode for password lengths",
is_flag=True)
def generate(cloud_manager):
"""Generate a dictionary of secrets"""
dict = {}
dict["access_pwd"] = psst.secrets.access_pwd.generate()

dict["access_pwd"] = psst.secrets.access_pwd.generate(cloud_manager)
dict["db_connect_pwd"] = psst.secrets.db_connect_pwd.generate()
dict["db_user_pwd"] = psst.secrets.db_user_pwd.generate()
dict["db_user_pwd"] = psst.secrets.db_user_pwd.generate(cloud_manager)
dict["domain_conn_pwd"] = psst.secrets.domain_conn_pwd.generate()
dict["pia_gateway_admin_pwd"] = psst.secrets.pia_gateway_admin_pwd.generate()
dict["pia_webprofile_user_pwd"] = psst.secrets.pia_webprofile_user_pwd.generate()
Expand Down
11 changes: 8 additions & 3 deletions psst/secrets/access_pwd.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
import array

# Database Access ID password.
# No more than 8 characters in length.
# No more than 8 characters in length for Cloud Manager
# 25 characters default
# The first character must be a letter
# Remaining 7 characters may be a mixture of letters and numbers."

MIN_LEN = 8
MAX_LEN = 8

DIGITS = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
LOCASE_CHARACTERS = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
Expand All @@ -23,7 +23,12 @@
COMBINED_LIST = DIGITS + UPCASE_CHARACTERS + LOCASE_CHARACTERS
LETTERS_LIST = UPCASE_CHARACTERS + LOCASE_CHARACTERS

def generate():
def generate(cloud_manager):
if cloud_manager:
MAX_LEN = 8
else:
MAX_LEN = 25

# randomly select at least one character from each character set above
rand_digit = random.choice(DIGITS)
rand_upper = random.choice(UPCASE_CHARACTERS)
Expand Down
11 changes: 8 additions & 3 deletions psst/secrets/db_user_pwd.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

# Domain boot user (CLADM/PS/VP1) password.
# Only alphanumeric characters .
# 8 characters in length.
# 8 characters in length for Cloud Manager
# 25 characters default

MIN_LEN = 8
MAX_LEN = 8

DIGITS = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
LOCASE_CHARACTERS = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
Expand All @@ -21,7 +21,12 @@

COMBINED_LIST = DIGITS + UPCASE_CHARACTERS + LOCASE_CHARACTERS

def generate():
def generate(cloud_manager):
if cloud_manager:
MAX_LEN = 8
else:
MAX_LEN = 25

# randomly select at least one character from each character set above
rand_digit = random.choice(DIGITS)
rand_upper = random.choice(UPCASE_CHARACTERS)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup_args = dict(
name='psst',
version='0.0.1',
version='0.0.2',
description='psst',
long_description_content_type="text/markdown",
long_description=README,
Expand Down