Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add some password management support and local roxctl#49

Open
connorgorman wants to merge 2 commits intomasterstackrox/workflow:masterfrom
cgorman-passwords-roxctlstackrox/workflow:cgorman-passwords-roxctlCopy head branch name to clipboard
Open

Add some password management support and local roxctl#49
connorgorman wants to merge 2 commits intomasterstackrox/workflow:masterfrom
cgorman-passwords-roxctlstackrox/workflow:cgorman-passwords-roxctlCopy head branch name to clipboard

Conversation

@connorgorman
Copy link

I have a bunch of local scripts I use so figured I'd push them up

Copy link
Contributor

@viswajithiii viswajithiii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also need to create symlinks to all of these in bin. (with ln -s)

@@ -0,0 +1,3 @@
#! /bin/bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In ./lib/rox_password.sh, we have a function for this already, which does this but also respects a ROX_PASSWORD env, so probably want to use that.

Also, we probably want to rename this to roxpwd or something, so that it's more more what the command refers to

kubectl -n stackrox delete secret central-htpasswd
kubectl create -f newpass.yaml

echo "The new password may take time to propagate due to config map propagation times"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use einfo instead of echo

EOF

kubectl -n stackrox delete secret central-htpasswd
kubectl create -f newpass.yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why create a file? Just do kubectl create -f - <<EOF and put the contents there?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, use apply or replace?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah good points, full disclosure, this is copy pasta from the solutions repo, but I found myself using it all the time when I overwrote the password

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rename the file to changepw? pwd in a shell script context is print working directory

EOF

kubectl -n stackrox delete secret central-htpasswd
kubectl create -f newpass.yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, use apply or replace?

#! /bin/bash

if [[ -z "${ROX_API_TOKEN}" ]]; then
roxctl --insecure-skip-tls-verify -e localhost:8000 -p $(getpwd) $@
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

always quote variable expansions unless you want shell tokenization

if [[ -z "${ROX_API_TOKEN}" ]]; then
roxctl --insecure-skip-tls-verify -e localhost:8000 -p $(getpwd) $@
else
roxctl --insecure-skip-tls-verify -e localhost:8000 $@
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, maybe do

extra_args=()
if [[ -z "${ROX_API_TOKEN}" ]]; then
  extra_args+=(-p "$(getpwd)")
fi
roxctl ... "${extra_args[@]}" "$@"

kubectl -n stackrox delete secret central-htpasswd
kubectl create -f newpass.yaml

echo "The new password may take time to propagate due to config map propagation times"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given how getpwd is implemented, do you also want to overwrite the deploy/k8s/central-deploy/password file?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments

Close sidebar
Morty Proxy This is a proxified and sanitized view of the page, visit original site.