Skip to content

dsconfig sub-command leaks admin password in the k8s control plane logs #720

Description

@pearj

The new dsconfig sub-command does a kubectl exec, which gets logged in it's entirety into the Kubernetes control plane logs. Which means the uid=admin password ends up visible in the logs.

dsconfig = f"dsconfig {conn_str} {user_str} {dsconfig_opts} {extra_opts}"
cmd_opts = f"exec {namespace_opt} {params.pod} -- {dsconfig}"
if params.debug or params.dryrun:
print(f"{KUBECTL} {cmd_opts} {pass_str_red}")
if not args.dryrun:
utils.run(KUBECTL, f"{cmd_opts} {pass_str}")

In bash this can be easily fixed by switching to a heredoc and passing the command as a stdin to bash, I'm not 100% sure what the python equivalent is.

For example:

kubectl exec -n namespace ds-idrepo-0 -- dsconfig -h localhost -p 1636 --trustAll -D 'uid=admin' -w 'secret-password'

Becomes:

kubectl exec -n namespace ds-idrepo-0 -- bash << EOF
dsconfig -h localhost -p 1636 --trustAll -D 'uid=admin' -w 'secret-password'
EOF

The python equivalent might be (untested)

    cmd_opts = f"exec {namespace_opt} {params.pod} -- bash"
    dsconfig_with_pwd = f"{dsconfig} {pass_str}"
    if params.debug or params.dryrun:
        print(f"{KUBECTL} {cmd_opts} {dsconfig} {pass_str_red}")
    if not args.dryrun:
        utils.run(KUBECTL, f"{cmd_opts}", stdin=dsconfig_with_pwd)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions