Skip to content

Commit

Permalink
MARIADB_RANDOM_ROOT_PASSWORD - much more random
Browse files Browse the repository at this point in the history
With https://mariadb.com/kb/en/password-validation/#examples
it may be the case that the random root password fails
to meet the complexity requirements.

We take advantage that both bionic (for 10.2) and focal
onwards include pwgen-2.08 that included the added options
to be secure on multiple ways.

Though not necessary, take away a few characters in
realization that the scripting ability of our users
may not contain the basic escaping needed to process
this added security.
  • Loading branch information
grooverdan committed Mar 14, 2021
1 parent 0f355be commit ad1e335
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion 10.2/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ docker_setup_db() {
fi
# Generate random root password
if [ -n "$MARIADB_RANDOM_ROOT_PASSWORD" ]; then
export MARIADB_ROOT_PASSWORD="$(pwgen -1 32)"
export MARIADB_ROOT_PASSWORD="$(pwgen --numerals --capitalize --symbols --remove-chars="'\\" -1 32)"
export MYSQL_ROOT_PASSWORD=$MARIADB_ROOT_PASSWORD
mysql_note "GENERATED ROOT PASSWORD: $MARIADB_ROOT_PASSWORD"
fi
Expand Down
2 changes: 1 addition & 1 deletion 10.3/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ docker_setup_db() {
fi
# Generate random root password
if [ -n "$MARIADB_RANDOM_ROOT_PASSWORD" ]; then
export MARIADB_ROOT_PASSWORD="$(pwgen -1 32)"
export MARIADB_ROOT_PASSWORD="$(pwgen --numerals --capitalize --symbols --remove-chars="'\\" -1 32)"
export MYSQL_ROOT_PASSWORD=$MARIADB_ROOT_PASSWORD
mysql_note "GENERATED ROOT PASSWORD: $MARIADB_ROOT_PASSWORD"
fi
Expand Down
2 changes: 1 addition & 1 deletion 10.4/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ docker_setup_db() {
fi
# Generate random root password
if [ -n "$MARIADB_RANDOM_ROOT_PASSWORD" ]; then
export MARIADB_ROOT_PASSWORD="$(pwgen -1 32)"
export MARIADB_ROOT_PASSWORD="$(pwgen --numerals --capitalize --symbols --remove-chars="'\\" -1 32)"
export MYSQL_ROOT_PASSWORD=$MARIADB_ROOT_PASSWORD
mysql_note "GENERATED ROOT PASSWORD: $MARIADB_ROOT_PASSWORD"
fi
Expand Down
2 changes: 1 addition & 1 deletion 10.5/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ docker_setup_db() {
fi
# Generate random root password
if [ -n "$MARIADB_RANDOM_ROOT_PASSWORD" ]; then
export MARIADB_ROOT_PASSWORD="$(pwgen -1 32)"
export MARIADB_ROOT_PASSWORD="$(pwgen --numerals --capitalize --symbols --remove-chars="'\\" -1 32)"
export MYSQL_ROOT_PASSWORD=$MARIADB_ROOT_PASSWORD
mysql_note "GENERATED ROOT PASSWORD: $MARIADB_ROOT_PASSWORD"
fi
Expand Down
2 changes: 1 addition & 1 deletion docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ docker_setup_db() {
fi
# Generate random root password
if [ -n "$MARIADB_RANDOM_ROOT_PASSWORD" ]; then
export MARIADB_ROOT_PASSWORD="$(pwgen -1 32)"
export MARIADB_ROOT_PASSWORD="$(pwgen --numerals --capitalize --symbols --remove-chars="'\\" -1 32)"
export MYSQL_ROOT_PASSWORD=$MARIADB_ROOT_PASSWORD
mysql_note "GENERATED ROOT PASSWORD: $MARIADB_ROOT_PASSWORD"
fi
Expand Down

0 comments on commit ad1e335

Please sign in to comment.