mirror of
https://github.com/veops/cmdb.git
synced 2025-09-07 13:57:01 +08:00
fix: NoneType happend while unsealing the secret funtion, cancel the address check while unseal and seal
This commit is contained in:
@@ -331,8 +331,8 @@ def cmdb_inner_secrets_unseal(address):
|
|||||||
"""
|
"""
|
||||||
unseal the secrets feature
|
unseal the secrets feature
|
||||||
"""
|
"""
|
||||||
if not valid_address(address):
|
# if not valid_address(address):
|
||||||
return
|
# return
|
||||||
address = "{}/api/v0.1/secrets/unseal".format(address.strip("/"))
|
address = "{}/api/v0.1/secrets/unseal".format(address.strip("/"))
|
||||||
for i in range(global_key_threshold):
|
for i in range(global_key_threshold):
|
||||||
token = click.prompt(f'Enter unseal token {i + 1}', hide_input=True, confirmation_prompt=False)
|
token = click.prompt(f'Enter unseal token {i + 1}', hide_input=True, confirmation_prompt=False)
|
||||||
@@ -368,8 +368,8 @@ def cmdb_inner_secrets_seal(address, token):
|
|||||||
"""
|
"""
|
||||||
assert address is not None
|
assert address is not None
|
||||||
assert token is not None
|
assert token is not None
|
||||||
if not valid_address(address):
|
# if not valid_address(address):
|
||||||
return
|
# return
|
||||||
address = "{}/api/v0.1/secrets/seal".format(address.strip("/"))
|
address = "{}/api/v0.1/secrets/seal".format(address.strip("/"))
|
||||||
resp = requests.post(address, headers={
|
resp = requests.post(address, headers={
|
||||||
"Inner-Token": token,
|
"Inner-Token": token,
|
||||||
|
@@ -32,6 +32,8 @@ seal_status = True
|
|||||||
|
|
||||||
|
|
||||||
def string_to_bytes(value):
|
def string_to_bytes(value):
|
||||||
|
if not value:
|
||||||
|
return ""
|
||||||
if isinstance(value, bytes):
|
if isinstance(value, bytes):
|
||||||
return value
|
return value
|
||||||
if sys.version_info.major == 2:
|
if sys.version_info.major == 2:
|
||||||
@@ -307,13 +309,13 @@ class KeyManage:
|
|||||||
|
|
||||||
def is_seal(self):
|
def is_seal(self):
|
||||||
"""
|
"""
|
||||||
If there is no initialization or the root key is inconsistent, it is considered to be in a sealed state.
|
If there is no initialization or the root key is inconsistent, it is considered to be in a sealed state..
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
secrets_root_key = current_app.config.get("secrets_root_key")
|
secrets_root_key = current_app.config.get("secrets_root_key")
|
||||||
msg, ok = self.is_valid_root_key(secrets_root_key)
|
msg, ok = self.is_valid_root_key(secrets_root_key)
|
||||||
if not ok:
|
if not ok:
|
||||||
return true
|
return True
|
||||||
status = self.backend.get(backend_seal_key)
|
status = self.backend.get(backend_seal_key)
|
||||||
return status == "block"
|
return status == "block"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user