Note: The default ITS GitLab runner is a shared resource and is subject to slowdowns during heavy usage.
You can run your own GitLab runner that is dedicated just to your group if you need to avoid processing delays.

Commit cb12afa5 authored by Rob Carleski's avatar Rob Carleski 🇮🇸
Browse files

Fix bug with password generation

Previous method generated an invalid password for kerberos
about once every twenty runs or so. Add more specific generation
rules, class checking, and password creation retries.
parent 176f9b6f
......@@ -590,8 +590,33 @@ def main():
logger.addHandler(ch)
if not args.password:
pool = string.ascii_letters + string.digits + '!@#$%&*'
args.password = ''.join(choice(pool) for i in range(12))
char_pool = [
string.ascii_lowercase,
string.ascii_uppercase,
string.digits,
'!@#$%&*'
]
for i in range(5):
_classes_met = 0
_pool = ''.join(char_pool)
args.password = ''.join(choice(_pool) for i in range(12))
for char_class in char_pool:
try:
assert set(args.password).intersection(set(char_class))
_classes_met += 1
except AssertionError:
continue
if _classes_met >= 3:
break
else:
continue
else:
logger.error(
'Failed to generate a secure password after five attempts',
extra={'entity': args.account}
)
exit(2)
sa = SharedAccount(vars(args), config)
sa.set_up_mcommunity_group()
......
......@@ -298,8 +298,33 @@ def main():
logger.addHandler(ch)
if not args.password:
pool = string.ascii_letters + string.digits + '!@#$%&*'
args.password = ''.join(choice(pool) for i in range(12))
char_pool = [
string.ascii_lowercase,
string.ascii_uppercase,
string.digits,
'!@#$%&*'
]
for i in range(5):
_classes_met = 0
_pool = ''.join(char_pool)
args.password = ''.join(choice(_pool) for i in range(12))
for char_class in char_pool:
try:
assert set(args.password).intersection(set(char_class))
_classes_met += 1
except AssertionError:
continue
if _classes_met >= 3:
break
else:
continue
else:
logger.error(
'Failed to generate a secure password after five attempts',
extra={'entity': args.account}
)
exit(2)
sa = SharedAccount(vars(args), config)
sa.check_mcommunity()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment