diff options
author | Krzysztof Opasiak <k.opasiak@samsung.com> | 2020-09-02 11:02:12 +0200 |
---|---|---|
committer | Krzysztof Opasiak <k.opasiak@samsung.com> | 2020-09-02 11:02:12 +0200 |
commit | 7860146d73472e3b2ff9f7390638ae608c9f9d0f (patch) | |
tree | b7b0b72ece7923a16fecd5349072ffd7fe973090 /kubernetes/clamp/charts/mariadb/resources | |
parent | d56af0efca443e5aa285c4d493db4160c96fd0fb (diff) |
[CLAMP,COMMON] Escape special chars in mysql passwords
Fix both clamp and common mariadb-galera instances to make sure that
special characters in passwords are escaped properly.
Issue-ID: OOM-2328
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Change-Id: Iee48523d36d404ad7b21515f0d205f2f60a507ed
Diffstat (limited to 'kubernetes/clamp/charts/mariadb/resources')
-rwxr-xr-x | kubernetes/clamp/charts/mariadb/resources/config/init/docker-entrypoint.sh | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/kubernetes/clamp/charts/mariadb/resources/config/init/docker-entrypoint.sh b/kubernetes/clamp/charts/mariadb/resources/config/init/docker-entrypoint.sh index 6c69694011..71f32e2eff 100755 --- a/kubernetes/clamp/charts/mariadb/resources/config/init/docker-entrypoint.sh +++ b/kubernetes/clamp/charts/mariadb/resources/config/init/docker-entrypoint.sh @@ -18,6 +18,11 @@ for arg; do esac done +prepare_password() +{ + echo "$1" | sed -e "s/'/\\\\'/g; s/\"/\\\\\"/g" +} + # usage: file_env VAR [DEFAULT] # ie: file_env 'XYZ_DB_PASSWORD' 'example' # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of @@ -36,7 +41,7 @@ file_env() { elif [ "${!fileVar:-}" ]; then val="$(< "${!fileVar}")" fi - val=`echo -n $val | sed -e "s/'/''/g"` + val=`prepare_password $val` export "$var"="$val" unset "$fileVar" } |