Skip to content

Commit 97f741d

Browse files
committed
Update string escape logic to match #109
1 parent c7f305c commit 97f741d

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,11 @@ Container images are configured using parameters passed at runtime (such as thos
159159
| `-p 3306` | Mariadb listens on this port. |
160160
| `-e PUID=1000` | for UserID - see below for explanation |
161161
| `-e PGID=1000` | for GroupID - see below for explanation |
162-
| `-e MYSQL_ROOT_PASSWORD=ROOT_ACCESS_PASSWORD` | Set this to root password for installation (minimum 4 characters). |
162+
| `-e MYSQL_ROOT_PASSWORD=ROOT_ACCESS_PASSWORD` | Set this to root password for installation (minimum 4 characters & non-alphanumeric passwords must be properly escaped). |
163163
| `-e TZ=Europe/London` | Specify a timezone to use EG Europe/London. |
164164
| `-e MYSQL_DATABASE=USER_DB_NAME` | Specify the name of a database to be created on image startup. |
165165
| `-e MYSQL_USER=MYSQL_USER` | This user will have superuser access to the database specified by MYSQL_DATABASE (do not use root here). |
166-
| `-e MYSQL_PASSWORD=DATABASE_PASSWORD` | Set this to the password you want to use for you MYSQL_USER (minimum 4 characters). |
166+
| `-e MYSQL_PASSWORD=DATABASE_PASSWORD` | Set this to the password you want to use for you MYSQL_USER (minimum 4 characters & non-alphanumeric passwords must be properly escaped). |
167167
| `-e REMOTE_SQL=http://URL1/your.sql,https://URL2/your.sql` | Set this to ingest sql files from an http/https endpoint (comma seperated array). |
168168
| `-v /config` | Contains the db itself and all assorted settings. |
169169

@@ -276,7 +276,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
276276

277277
## Versions
278278

279-
* **11.10.22:** - Rebase master to Alpine 3.16, migrate to s6v3.
279+
* **11.10.22:** - Rebase master to Alpine 3.16, migrate to s6v3, remove password escape logic which caused problems for a small subset of users.
280280
* **06.07.21:** - Rebase master to alpine.
281281
* **03.07.21:** - Rebase to 3.14.
282282
* **08.02.21:** - Fix new installs.

readme-vars.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ param_container_name: "{{ project_name }}"
2525
param_usage_include_net: false
2626
param_usage_include_env: true
2727
param_env_vars:
28-
- { env_var: "MYSQL_ROOT_PASSWORD", env_value: "ROOT_ACCESS_PASSWORD", desc: "Set this to root password for installation (minimum 4 characters)." }
28+
- { env_var: "MYSQL_ROOT_PASSWORD", env_value: "ROOT_ACCESS_PASSWORD", desc: "Set this to root password for installation (minimum 4 characters & non-alphanumeric passwords must be properly escaped)." }
2929
- { env_var: "TZ", env_value: "Europe/London", desc: "Specify a timezone to use EG Europe/London." }
3030
param_usage_include_vols: true
3131
param_volumes:
@@ -41,7 +41,7 @@ opt_param_usage_include_env: true
4141
opt_param_env_vars:
4242
- { env_var: "MYSQL_DATABASE", env_value: "USER_DB_NAME", desc: "Specify the name of a database to be created on image startup." }
4343
- { env_var: "MYSQL_USER", env_value: "MYSQL_USER", desc: "This user will have superuser access to the database specified by MYSQL_DATABASE (do not use root here)." }
44-
- { env_var: "MYSQL_PASSWORD", env_value: "DATABASE_PASSWORD", desc: "Set this to the password you want to use for you MYSQL_USER (minimum 4 characters)." }
44+
- { env_var: "MYSQL_PASSWORD", env_value: "DATABASE_PASSWORD", desc: "Set this to the password you want to use for you MYSQL_USER (minimum 4 characters & non-alphanumeric passwords must be properly escaped)." }
4545
- { env_var: "REMOTE_SQL", env_value: "http://URL1/your.sql,https://URL2/your.sql", desc: "Set this to ingest sql files from an http/https endpoint (comma seperated array)." }
4646
opt_param_usage_include_vols: false
4747
opt_param_usage_include_ports: false
@@ -96,7 +96,7 @@ app_setup_block: |
9696
9797
# changelog
9898
changelogs:
99-
- { date: "11.10.22:", desc: "Rebase master to Alpine 3.16, migrate to s6v3." }
99+
- { date: "11.10.22:", desc: "Rebase master to Alpine 3.16, migrate to s6v3, remove password escape logic which caused problems for a small subset of users." }
100100
- { date: "06.07.21:", desc: "Rebase master to alpine." }
101101
- { date: "03.07.21:", desc: "Rebase to 3.14." }
102102
- { date: "08.02.21:", desc: "Fix new installs." }

root/etc/s6-overlay/s6-rc.d/init-mariadb-initdb/run

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ if [[ -z "${MYSQL_ROOT_PASSWORD}" ]]; then
4444
else
4545
TEST_LEN=${#MYSQL_ROOT_PASSWORD}
4646
fi
47-
MYSQL_ROOT_PASSWORD=$(sed -E 's/('\'')/\\\1/g' <<< "${MYSQL_ROOT_PASSWORD}")
47+
4848
if [[ "${TEST_LEN}" -lt "4" ]]; then
4949
MYSQL_PASS="CREATE USER 'root'@'%' IDENTIFIED BY '' ;"
5050
else
@@ -57,7 +57,6 @@ if [[ "${MYSQL_USER+x}" ]] && \
5757
[[ "${MYSQL_DATABASE+x}" ]] && \
5858
[[ "${MYSQL_PASSWORD+x}" ]] && \
5959
[[ "${#MYSQL_PASSWORD}" -gt "3" ]]; then
60-
MYSQL_PASSWORD=$(sed -E 's/('\'')/\\\1/g' <<< "${MYSQL_PASSWORD}")
6160
read -r -d '' MYSQL_DB_SETUP << EOM
6261
CREATE DATABASE \`${MYSQL_DATABASE}\`;
6362
CREATE USER '${MYSQL_USER}'@'%' IDENTIFIED BY '${MYSQL_PASSWORD}';

0 commit comments

Comments
 (0)