mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-16 04:02:52 -06:00
Fixes #1092: Increase randomness in SECRET_KEY generation tool
This commit is contained in:
parent
401357b8cb
commit
38d826d152
@ -1,8 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# This script will generate a random 50-character string suitable for use as a SECRET_KEY.
|
# This script will generate a random 50-character string suitable for use as a SECRET_KEY.
|
||||||
import os
|
|
||||||
import random
|
import random
|
||||||
|
|
||||||
charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*(-_=+)'
|
charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*(-_=+)'
|
||||||
random.seed = (os.urandom(2048))
|
secure_random = random.SystemRandom()
|
||||||
print(''.join(random.choice(charset) for c in range(50)))
|
print(''.join(secure_random.sample(charset, 50)))
|
||||||
|
Loading…
Reference in New Issue
Block a user