Skip to content

Commit

Permalink
fix: escape special characters for password
Browse files Browse the repository at this point in the history
  • Loading branch information
yabinji committed Mar 5, 2024
1 parent 1903a52 commit b17f280
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions addons/mogdb/scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,10 @@ docker_setup_env() {

# append GS_HOST_AUTH_METHOD to pg_hba.conf for "host" connections
mogdb_setup_hba_conf() {
# if [ -e /tmp/pg_hba.conf ]; then
# cat /tmp/pg_hba.conf >"$PGDATA/pg_hba.conf"
# echo "Successfully replaced $PGDATA/pg_hba.conf with /tmp/pg_hba.conf."
# fi
if [ -e /tmp/pg_hba.conf ]; then
cat /tmp/pg_hba.conf >"$PGDATA/pg_hba.conf"
echo "Successfully replaced $PGDATA/pg_hba.conf with /tmp/pg_hba.conf."
fi

{
echo
Expand All @@ -298,6 +298,7 @@ mogdb_setup_hba_conf() {
fi
echo "host all all 0.0.0.0/0 $GS_HOST_AUTH_METHOD"
echo "host replication $GS_USER 0.0.0.0/0 md5"
echo "host replication $GS_USERNAME 0.0.0.0/0 md5"
if [ -n "$SERVER_MODE" ]; then
echo "host replication repuser $OG_SUBNET trust"
fi
Expand Down
4 changes: 2 additions & 2 deletions addons/mogdb/templates/clusterdefinition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ spec:
- image: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}
command:
- |
original_role=$(su -l omm -c "gsql -h 127.0.0.1 -p 26000 -U ${KB_RSM_USERNAME} -W ${KB_RSM_PASSWORD} -dpostgres -t -c 'select local_role from pg_stat_get_wal_senders() limit 1'")
original_role=$(su -l omm -c "gsql -h 127.0.0.1 -p 26000 -U ${KB_RSM_USERNAME} -W \"${KB_RSM_PASSWORD}\" -dpostgres -t -c 'select local_role from pg_stat_get_wal_senders() limit 1'")
if [ -z "$original_role" ]; then
original_role=$(su -l omm -c "gsql -h 127.0.0.1 -p 26000 -U ${KB_RSM_USERNAME} -W ${KB_RSM_PASSWORD} -dpostgres -t -c 'select local_role from pg_stat_get_wal_receiver() limit 1'")
original_role=$(su -l omm -c "gsql -h 127.0.0.1 -p 26000 -U ${KB_RSM_USERNAME} -W \"${KB_RSM_PASSWORD}\" -dpostgres -t -c 'select local_role from pg_stat_get_wal_receiver() limit 1'")
fi
role=$(echo ${original_role} | tr 'A-Z' 'a-z')
Expand Down

0 comments on commit b17f280

Please sign in to comment.