Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion cmdb-api/api/lib/secrets/inner.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,13 @@ def print_token(cls, shares, root_token):
"unseal token " + str(i + 1) + ": " + Fore.RED + Back.BLACK + v.decode("utf-8") + Style.RESET_ALL)
print()

print(Fore.GREEN + "root token: " + root_token.decode("utf-8") + Style.RESET_ALL)
show_root_token = str(os.environ.get("CMDB_SHOW_ROOT_TOKEN_ON_INIT", "")).lower() == "true"
if show_root_token:
print(Fore.GREEN + "root token: " + root_token.decode("utf-8") + Style.RESET_ALL)
else:
token = root_token.decode("utf-8")
masked = "{0}...{1}".format(token[:4], token[-4:]) if len(token) > 8 else "********"
print(Fore.GREEN + "root token (masked): " + masked + Style.RESET_ALL)

@classmethod
def print_response(cls, data):
Expand Down