Skip to content

Commit 11a4f9f

Browse files
matthallcbyonsken
authored andcommitted
MB-49557 [BP] Don't leak cookie in master-password
Instead set it as an enviornment variable and use `-eval` to set it from the variable. This is a backport of MB-48206. Change-Id: I453dcc7d62995cc4dd91792e69eda68c100a9b53 Reviewed-on: https://review.couchbase.org/c/couchbase-cli/+/172295 Tested-by: Build Bot <build@couchbase.com> Reviewed-by: James Lee <james.lee@couchbase.com> Well-Formed: Restriction Checker Reviewed-on: https://review.couchbase.org/c/couchbase-cli/+/172451
1 parent 0107000 commit 11a4f9f

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

cbmgr.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,11 +1550,12 @@ def prompt_for_master_pwd(self, node, cookie, password, cb_cfg_path):
15501550

15511551
name = 'executioner@cb.local'
15521552
args = ['-pa', CB_NS_EBIN_PATH, CB_BABYSITTER_EBIN_PATH, '-noinput', '-name', name, '-proto_dist', 'cb',
1553-
'-epmd_module', 'cb_epmd', '-kernel'] + CB_INETRC_OPT + \
1554-
['dist_config_file', f'"{dist_cfg_file}"', '-setcookie', cookie, '-run', 'encryption_service',
1553+
'-eval', 'erlang:set_cookie(list_to_atom(os:getenv("CB_COOKIE"))).', '-epmd_module', 'cb_epmd',
1554+
'-kernel'] + CB_INETRC_OPT + \
1555+
['dist_config_file', f'"{dist_cfg_file}"', '-run', 'encryption_service',
15551556
'remote_set_password', node]
15561557

1557-
rc, out, err = self.run_process("erl", args, extra_env={'SETPASSWORD': password})
1558+
rc, out, err = self.run_process("erl", args, extra_env={'SETPASSWORD': password, 'CB_COOKIE': cookie})
15581559

15591560
if rc == 0:
15601561
print("SUCCESS: Password accepted. Node started booting.")

0 commit comments

Comments
 (0)