mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Use larger set from which to choose chars for random passwords.
Use SystemRandom() instead of Random() so that the randomicity is non-deterministic.
This commit is contained in:
parent
1b613fafa6
commit
599fe1a0f5
@ -365,10 +365,9 @@ def parse_generalized_time(timestr):
|
|||||||
|
|
||||||
def ipa_generate_password():
|
def ipa_generate_password():
|
||||||
rndpwd = ''
|
rndpwd = ''
|
||||||
r = random.Random()
|
r = random.SystemRandom()
|
||||||
for x in range(12):
|
for x in range(12):
|
||||||
# rndpwd += chr(r.randint(32,126))
|
rndpwd += chr(r.randint(32,126))
|
||||||
rndpwd += chr(r.randint(65,90)) #stricter set for testing
|
|
||||||
return rndpwd
|
return rndpwd
|
||||||
|
|
||||||
|
|
||||||
|
@ -744,8 +744,7 @@ class UserController(IPAController):
|
|||||||
password = ""
|
password = ""
|
||||||
generator = random.SystemRandom()
|
generator = random.SystemRandom()
|
||||||
for char in range(8):
|
for char in range(8):
|
||||||
index = generator.randint(0, len(password_chars) - 1)
|
password += generator.choice(password_chars)
|
||||||
password += password_chars[index]
|
|
||||||
|
|
||||||
return password
|
return password
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user