-
Notifications
You must be signed in to change notification settings - Fork 0
Add some password management support and local roxctl #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| if [ -z "$1" ]; then | ||
| echo "Missing new password. Usage: $0 newpassword" | ||
| exit | ||
| fi | ||
| NEWPASS=`htpasswd -B -n -b admin $1 | base64` | ||
|
|
||
| cat > newpass.yaml << EOF | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| type: Opaque | ||
| metadata: | ||
| name: central-htpasswd | ||
| namespace: stackrox | ||
| labels: | ||
| app.kubernetes.io/name: stackrox | ||
| annotations: | ||
| "helm.sh/hook": "pre-install" | ||
| data: | ||
| htpasswd: $NEWPASS | ||
| EOF | ||
|
|
||
| kubectl -n stackrox delete secret central-htpasswd | ||
| kubectl create -f newpass.yaml | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why create a file? Just do
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, use
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
|
||
| echo "The new password may take time to propagate due to config map propagation times" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given how |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| #! /bin/bash | ||
|
|
||
| getpwd | pbcopy |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| #! /bin/bash | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In Also, we probably want to rename this to |
||
|
|
||
| cat "${GOPATH}/src/github.com/stackrox/rox/deploy/k8s/central-deploy/password" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| #! /bin/bash | ||
|
|
||
| if [[ -z "${ROX_API_TOKEN}" ]]; then | ||
| roxctl --insecure-skip-tls-verify -e localhost:8000 -p $(getpwd) $@ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. always quote variable expansions unless you want shell tokenization |
||
| else | ||
| roxctl --insecure-skip-tls-verify -e localhost:8000 $@ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also, maybe do |
||
| fi | ||
There was a problem hiding this comment.
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?pwdin a shell script context is print working directory