MCPcopy Create free account
hub / github.com/ForgeRock/forgeops / printsecrets

Function printsecrets

lib/python/utils.py:245–279  ·  view source on GitHub ↗

Obtain and print platform secrets. ns: target namespace. to_stdout: set to true to print secrets to stdout. If false, secrets will not be printed. return secrets: Dictionary containing the platform secrets. Secrets are returned even if to_stdout is set to False.

(ns, to_stdout=True)

Source from the content-addressed store, hash-verified

243 sys.exit(1)
244
245def printsecrets(ns, to_stdout=True):
246 """
247 Obtain and print platform secrets.
248 ns: target namespace.
249 to_stdout: set to true to print secrets to stdout. If false, secrets will not be printed.
250 return secrets: Dictionary containing the platform secrets. Secrets are returned even if to_stdout is set to False.
251 """
252 try:
253 secrets = {
254 'am-env-secrets': {
255 'AM_PASSWORDS_AMADMIN_CLEAR': None
256 },
257 'ds-passwords': {
258 'dirmanager\\\\.pw': None,
259 },
260 'ds-env-secrets': {
261 'AM_STORES_APPLICATION_PASSWORD': None,
262 'AM_STORES_CTS_PASSWORD': None,
263 'AM_STORES_USER_PASSWORD': None,
264 },
265 }
266 for secret in secrets:
267 for key in secrets[secret]:
268 secrets[secret][key] = get_secret_value(ns, secret, key)
269 if to_stdout:
270 message('\nRelevant passwords:')
271 print(
272 f"{secrets['am-env-secrets']['AM_PASSWORDS_AMADMIN_CLEAR']} (amadmin user)")
273 print("{} (uid=admin user)".format(secrets['ds-passwords']['dirmanager\\\\.pw'])) # f'strings' do not allow '\'
274 print(f"{secrets['ds-env-secrets']['AM_STORES_APPLICATION_PASSWORD']} (App str svc acct (uid=am-config,ou=admins,ou=am-config))")
275 print(f"{secrets['ds-env-secrets']['AM_STORES_CTS_PASSWORD']} (CTS svc acct (uid=openam_cts,ou=admins,ou=famrecords,ou=openam-session,ou=tokens))")
276 print(f"{secrets['ds-env-secrets']['AM_STORES_USER_PASSWORD']} (ID repo svc acct (uid=am-identity-bind-account,ou=admins,ou=identities))")
277 return secrets
278 except Exception as _e:
279 sys.exit(1)
280
281def printurls(ns, to_stdout=True):
282 """

Callers

nothing calls this directly

Calls 3

get_secret_valueFunction · 0.85
messageFunction · 0.85
formatMethod · 0.45

Tested by

no test coverage detected