-
Notifications
You must be signed in to change notification settings - Fork 772
Escape passwords in configurations and scripts #8842
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6e8e29a
Fix EntSearch readiness script
barkbay 835a611
iso-8601=seconds is not a valid flag with busybox
barkbay 169e034
Sanitize password string in Stackmon config
barkbay fc8cf63
Fix TestReconcileConfig_ReadinessProbe
barkbay 569208b
Update stack mon sidecar expected config
barkbay 87da548
Do not include symbols for now
barkbay c4b06b6
Merge branch 'main' into fix-readiness-scripts
barkbay File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,23 +118,23 @@ func readinessProbeScript(ent entv1.EnterpriseSearch, config *settings.Canonical | |
} | ||
basicAuthArgs := "" // no credentials: no basic auth | ||
if esAuth.Elasticsearch.Username != "" { | ||
basicAuthArgs = fmt.Sprintf("-u %s:%s", esAuth.Elasticsearch.Username, esAuth.Elasticsearch.Password) | ||
basicAuthArgs = fmt.Sprintf("-u %s:'%s'", esAuth.Elasticsearch.Username, esAuth.Elasticsearch.Password) | ||
} | ||
|
||
return []byte(`#!/usr/bin/env bash | ||
|
||
# fail should be called as a last resort to help the user to understand why the probe failed | ||
function fail { | ||
timestamp=$(date --iso-8601=seconds) | ||
echo "{\"timestamp\": \"${timestamp}\", \"message\": \"readiness probe failed\", "$1"}" | tee /proc/1/fd/2 2> /dev/null | ||
echo '{"timestamp": "'"${timestamp}"'", "message": "readiness probe failed", '"${1}"'}'| tee /proc/1/fd/2 2> /dev/null | ||
exit 1 | ||
} | ||
|
||
# request timeout can be overridden from an environment variable | ||
READINESS_PROBE_TIMEOUT=${READINESS_PROBE_TIMEOUT:=` + fmt.Sprintf("%d", ReadinessProbeTimeoutSec) + `} | ||
|
||
# request the health endpoint and expect http status code 200. Turning globbing off for unescaped IPv6 addresses | ||
status=$(curl -g -o /dev/null -w "%{http_code}" ` + url + ` ` + basicAuthArgs + ` -k -s --max-time ${READINESS_PROBE_TIMEOUT}) | ||
status=$(curl -g -o /dev/null -w "%{http_code}" ` + url + ` ` + basicAuthArgs + ` -k -s --max-time "${READINESS_PROBE_TIMEOUT}") | ||
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.
|
||
curl_rc=$? | ||
|
||
if [[ ${curl_rc} -ne 0 ]]; then | ||
|
@@ -144,7 +144,7 @@ func readinessProbeScript(ent entv1.EnterpriseSearch, config *settings.Canonical | |
if [[ ${status} == "200" ]]; then | ||
exit 0 | ||
else | ||
fail " \"status\": \"${status}\", \"version\":\"${version}\" " | ||
fail " \"status\": \"${status}\" " | ||
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.
|
||
fi | ||
`), nil | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.