Commit 33081d90 authored by Iustin Pop's avatar Iustin Pop
Browse files

Move the pseudo-secret generation to utils.py

The bootstrap code needs a pseudo-secret and this is currently generated
inside the InitGanetiServerSetup function. Since more users will need
this, move it to utils.py

Reviewed-by: ultrotter
parent d48663e4
......@@ -81,7 +81,7 @@ def _InitGanetiServerSetup(ss):
"""
# Create pseudo random password
randpass = sha.new(os.urandom(64)).hexdigest()
randpass = utils.GenerateSecret()
# and write it into sstore
ss.SetKey(ss.SS_NODED_PASS, randpass)
......
......@@ -864,6 +864,16 @@ def NewUUID():
f.close()
def GenerateSecret():
"""Generates a random secret.
This will generate a pseudo-random secret, and return its sha digest
(so that it can be used where an ASCII string is needed).
"""
return sha.new(os.urandom(64)).hexdigest()
def ReadFile(file_name, size=None):
"""Reads a file.
......
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