mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-22 17:43:14 +00:00
Fix grub hash storage of password
This commit is contained in:
parent
033903f712
commit
9f4c02dc83
@ -490,6 +490,8 @@ def grub_hashcrypt_value(value):
|
||||
salt = os.urandom(64)
|
||||
algo = 'sha512'
|
||||
rounds = 10000
|
||||
if not isinstance(value, bytes):
|
||||
value = value.encode('utf8')
|
||||
crypted = hexlify(hashlib.pbkdf2_hmac(algo, value, salt, rounds))
|
||||
crypted = crypted.upper()
|
||||
salt = hexlify(salt).upper()
|
||||
@ -1706,6 +1708,9 @@ class ConfigManager(object):
|
||||
if 'hashvalue' not in curr[attrib]:
|
||||
curr[attrib]['hashvalue'] = hashcrypt_value(
|
||||
curr[attrib]['value'])
|
||||
if 'grubhashvalue' not in curr[attrib]:
|
||||
curr[attrib]['grubhashvalue'] = grub_hashcrypt_value(
|
||||
curr[attrib]['value'])
|
||||
if 'value' in curr[attrib]:
|
||||
del curr[attrib]['value']
|
||||
if cfgleader: # currently config slave to another
|
||||
@ -2125,6 +2130,9 @@ class ConfigManager(object):
|
||||
if 'hashvalue' not in curr[attrib]:
|
||||
curr[attrib]['hashvalue'] = hashcrypt_value(
|
||||
curr[attrib]['value'])
|
||||
if 'grubhashvalue' not in curr[attrib]:
|
||||
curr[attrib]['grubhashvalue'] = grub_hashcrypt_value(
|
||||
curr[attrib]['value'])
|
||||
if 'value' in curr[attrib]:
|
||||
del curr[attrib]['value']
|
||||
if cfgleader: # currently config slave to another
|
||||
@ -2199,7 +2207,7 @@ class ConfigManager(object):
|
||||
attrname, node)
|
||||
raise ValueError(errstr)
|
||||
attribmap[node][attrname] = attrval
|
||||
for node in attribmap:
|
||||
for node in attribmap:
|
||||
node = confluent.util.stringify(node)
|
||||
exprmgr = None
|
||||
if node not in self._cfgstore['nodes']:
|
||||
|
Loading…
Reference in New Issue
Block a user