Skip to content

Commit cb29ca9

Browse files
author
Bitnami Bot
committed
3.10.1-debian-10-r2 release
1 parent b97102a commit cb29ca9

File tree

4 files changed

+132
-38
lines changed

4 files changed

+132
-38
lines changed

3/debian-10/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ RUN echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && locale-gen
3131

3232
COPY rootfs /
3333
RUN /opt/bitnami/scripts/locales/add-extra-locales.sh
34-
RUN /opt/bitnami/scripts/apache/postunpack.sh
3534
RUN /opt/bitnami/scripts/php/postunpack.sh
35+
RUN /opt/bitnami/scripts/apache/postunpack.sh
3636
RUN /opt/bitnami/scripts/apache-modphp/postunpack.sh
3737
RUN /opt/bitnami/scripts/moodle/postunpack.sh
3838
RUN /opt/bitnami/scripts/mysql-client/postunpack.sh
@@ -41,7 +41,7 @@ ENV ALLOW_EMPTY_PASSWORD="no" \
4141
APACHE_HTTPS_PORT_NUMBER="" \
4242
APACHE_HTTP_PORT_NUMBER="" \
4343
BITNAMI_APP_NAME="moodle" \
44-
BITNAMI_IMAGE_VERSION="3.10.1-debian-10-r1" \
44+
BITNAMI_IMAGE_VERSION="3.10.1-debian-10-r2" \
4545
LANG="en_US.UTF-8" \
4646
LANGUAGE="en_US:en" \
4747
MARIADB_HOST="mariadb" \

3/debian-10/rootfs/opt/bitnami/scripts/libmysqlclient.sh

Lines changed: 110 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ mysql_client_validate() {
4545
}
4646

4747
# Only validate environment variables if any action needs to be performed
48-
check_yes_no_value "DB_TLS_ENABLED"
48+
check_yes_no_value "DB_ENABLE_SSL_WRAPPER"
4949

5050
if [[ -n "$DB_CREATE_DATABASE_USER" || -n "$DB_CREATE_DATABASE_NAME" ]]; then
5151
if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then
@@ -78,9 +78,9 @@ mysql_client_validate() {
7878
# None
7979
#########################
8080
mysql_client_initialize() {
81-
# Wrap binary to force the usage of TLS
82-
if is_boolean_yes "$DB_TLS_ENABLED"; then
83-
mysql_client_wrap_binary_for_tls
81+
# Wrap binary to force the usage of SSL
82+
if is_boolean_yes "$DB_ENABLE_SSL_WRAPPER"; then
83+
mysql_client_wrap_binary_for_ssl
8484
fi
8585
# Wait for the database to be accessible if any action needs to be performed
8686
if [[ -n "$DB_CREATE_DATABASE_USER" || -n "$DB_CREATE_DATABASE_NAME" ]]; then
@@ -113,22 +113,24 @@ mysql_client_initialize() {
113113
}
114114

115115
########################
116-
# Wrap binary to force the usage of TLS
116+
# Wrap binary to force the usage of SSL
117117
# Globals:
118118
# DB_*
119119
# Arguments:
120120
# None
121121
# Returns:
122122
# None
123123
#########################
124-
mysql_client_wrap_binary_for_tls() {
124+
mysql_client_wrap_binary_for_ssl() {
125125
local -r wrapper_file="${DB_BIN_DIR}/mysql"
126126
local -r wrapped_binary_file="${DB_BASE_DIR}/.bin/mysql"
127+
local -a ssl_opts=()
128+
read -r -a ssl_opts <<< "$(mysql_client_extra_opts)"
127129

128130
mv "$wrapper_file" "$wrapped_binary_file"
129131
cat >"$wrapper_file" <<EOF
130132
#!/bin/sh
131-
exec "${wrapped_binary_file}" "\$@" --ssl=1
133+
exec "${wrapped_binary_file}" "\$@" ${ssl_opts[@]:-}
132134
EOF
133135
chmod +x "$wrapper_file"
134136
}
@@ -209,8 +211,9 @@ mysql_execute_print_output() {
209211
local -r db="${1:-}"
210212
local -r user="${2:-root}"
211213
local -r pass="${3:-}"
212-
local mysql_cmd opts
213-
read -r -a opts <<<"${@:4}"
214+
local -a opts extra_opts
215+
read -r -a opts <<< "${@:4}"
216+
read -r -a extra_opts <<< "$(mysql_client_extra_opts)"
214217

215218
# Process mysql CLI arguments
216219
local -a args=()
@@ -219,9 +222,11 @@ mysql_execute_print_output() {
219222
fi
220223
args+=("-N" "-u" "$user" "$db")
221224
[[ -n "$pass" ]] && args+=("-p$pass")
222-
[[ -n "${opts[*]:-}" ]] && args+=("${opts[@]:-}")
225+
[[ "${#opts[@]}" -gt 0 ]] && args+=("${opts[@]}")
226+
[[ "${#extra_opts[@]}" -gt 0 ]] && args+=("${extra_opts[@]}")
223227

224228
# Obtain the command specified via stdin
229+
local mysql_cmd
225230
mysql_cmd="$(</dev/stdin)"
226231
debug "Executing SQL command:\n$mysql_cmd"
227232
"$DB_BIN_DIR/mysql" "${args[@]}" <<<"$mysql_cmd"
@@ -246,7 +251,7 @@ mysql_execute() {
246251
}
247252

248253
########################
249-
# Execute an arbitrary query/queries against a remote MySQL/MariaDB service
254+
# Execute an arbitrary query/queries against a remote MySQL/MariaDB service and print to stdout
250255
# Stdin:
251256
# Query/queries to execute
252257
# Globals:
@@ -261,12 +266,32 @@ mysql_execute() {
261266
# $6 - Extra MySQL CLI options
262267
# Returns:
263268
# None
264-
mysql_remote_execute() {
269+
mysql_remote_execute_print_output() {
265270
local -r hostname="${1:?hostname is required}"
266271
local -r port="${2:?port is required}"
267272
local -a args=("-h" "$hostname" "-P" "$port" "--connect-timeout=5")
268273
shift 2
269-
debug_execute "mysql_execute_print_output" "$@" "${args[@]}"
274+
"mysql_execute_print_output" "$@" "${args[@]}"
275+
}
276+
277+
########################
278+
# Execute an arbitrary query/queries against a remote MySQL/MariaDB service
279+
# Stdin:
280+
# Query/queries to execute
281+
# Globals:
282+
# BITNAMI_DEBUG
283+
# DB_*
284+
# Arguments:
285+
# $1 - Remote MySQL/MariaDB service hostname
286+
# $2 - Remote MySQL/MariaDB service port
287+
# $3 - Database where to run the queries
288+
# $4 - User to run queries
289+
# $5 - Password
290+
# $6 - Extra MySQL CLI options
291+
# Returns:
292+
# None
293+
mysql_remote_execute() {
294+
debug_execute "mysql_remote_execute_print_output" "$@"
270295
}
271296

272297
########################
@@ -468,7 +493,7 @@ mysql_upgrade() {
468493
# Returns:
469494
# None
470495
#########################
471-
migrate_old_configuration() {
496+
mysql_migrate_old_configuration() {
472497
local -r old_custom_conf_file="$DB_VOLUME_DIR/conf/my_custom.cnf"
473498
local -r custom_conf_file="$DB_CONF_DIR/bitnami/my_custom.cnf"
474499
debug "Persisted configuration detected. Migrating any existing 'my_custom.cnf' file to new location"
@@ -529,10 +554,6 @@ mysql_ensure_user_exists() {
529554
--use-ldap)
530555
use_ldap="yes"
531556
;;
532-
--ssl-ca)
533-
shift
534-
ssl_ca="${1:?missing path to ssl CA}"
535-
;;
536557
--host)
537558
shift
538559
db_host="${1:?missing database host}"
@@ -558,22 +579,26 @@ mysql_ensure_user_exists() {
558579
fi
559580
fi
560581
debug "creating database user \'$user\'"
561-
local -a opts=()
562-
[[ -n "$db_host" ]] && opts+=("-h" "${db_host}")
563-
[[ -n "$db_port" ]] && opts+=("-P" "${db_port}")
564-
[[ -n "$ssl_ca" ]] && opts+=("--ssl-ca" "$ssl_ca")
582+
583+
local -a mysql_execute_cmd=("mysql_execute")
584+
local -a mysql_execute_print_output_cmd=("mysql_execute_print_output")
585+
if [[ -n "$db_host" && -n "$db_port" ]]; then
586+
mysql_execute_cmd=("mysql_remote_execute" "$db_host" "$db_port")
587+
mysql_execute_print_output_cmd=("mysql_remote_execute_print_output" "$db_host" "$db_port")
588+
fi
589+
565590
local mysql_create_user_cmd
566591
[[ "$DB_FLAVOR" = "mariadb" ]] && mysql_create_user_cmd="create or replace user" || mysql_create_user_cmd="create user if not exists"
567-
mysql_execute "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" "${opts[@]:-}" <<EOF
592+
"${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <<EOF
568593
${mysql_create_user_cmd} '${user}'@'%' ${auth_string};
569594
EOF
570595
debug "Removing all other hosts for the user"
571-
hosts=$(mysql_execute_print_output "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" "${opts[@]:-}" <<EOF
596+
hosts=$("${mysql_execute_print_output_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <<EOF
572597
select Host from user where User='${user}' and Host!='%';
573598
EOF
574599
)
575600
for host in $hosts; do
576-
mysql_execute "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" "${opts[@]:-}" <<EOF
601+
"${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <<EOF
577602
drop user '$user'@'$host';
578603
EOF
579604
done
@@ -713,16 +738,16 @@ mysql_ensure_database_exists() {
713738
shift
714739
done
715740

716-
local -a extra_args=()
717-
[[ -n "$character_set" ]] && extra_args=("character set = '${character_set}'")
718-
[[ -n "$collate" ]] && extra_args=("collate = '${collate}'")
719-
720741
local -a mysql_execute_cmd=("mysql_execute")
721742
[[ -n "$db_host" && -n "$db_port" ]] && mysql_execute_cmd=("mysql_remote_execute" "$db_host" "$db_port")
722743

744+
local -a create_database_args=()
745+
[[ -n "$character_set" ]] && create_database_args+=("character set = '${character_set}'")
746+
[[ -n "$collate" ]] && create_database_args+=("collate = '${collate}'")
747+
723748
debug "Creating database $database"
724749
"${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <<EOF
725-
create database if not exists \`$database\` ${extra_args[@]:-};
750+
create database if not exists \`$database\` ${create_database_args[@]:-};
726751
EOF
727752
}
728753

@@ -924,7 +949,7 @@ mysql_conf_set() {
924949
#########################
925950
mysql_update_custom_config() {
926951
# Persisted configuration files from old versions
927-
! is_dir_empty "$DB_VOLUME_DIR" && [[ -d "$DB_VOLUME_DIR/conf" ]] && migrate_old_configuration
952+
! is_dir_empty "$DB_VOLUME_DIR" && [[ -d "$DB_VOLUME_DIR/conf" ]] && mysql_migrate_old_configuration
928953

929954
# User injected custom configuration
930955
if [[ -f "$DB_CONF_DIR/my_custom.cnf" ]]; then
@@ -986,3 +1011,57 @@ mysql_healthcheck() {
9861011

9871012
mysqladmin "${args[@]}" ping && mysqladmin "${args[@]}" status
9881013
}
1014+
1015+
########################
1016+
# Prints flavor of 'mysql' client (useful to determine proper CLI flags that can be used)
1017+
# Globals:
1018+
# DB_*
1019+
# Arguments:
1020+
# None
1021+
# Returns:
1022+
# mysql client flavor
1023+
#########################
1024+
mysql_client_flavor() {
1025+
if "${DB_BIN_DIR}/mysql" "--version" 2>&1 | grep -q MariaDB; then
1026+
echo "mariadb"
1027+
else
1028+
echo "mysql"
1029+
fi
1030+
}
1031+
1032+
########################
1033+
# Prints extra options for MySQL client calls (i.e. SSL options)
1034+
# Globals:
1035+
# DB_*
1036+
# Arguments:
1037+
# None
1038+
# Returns:
1039+
# List of options to pass to "mysql" CLI
1040+
#########################
1041+
mysql_client_extra_opts() {
1042+
# Helper to get the proper value for the MySQL client environment variable
1043+
mysql_client_env_value() {
1044+
local env_name="MYSQL_CLIENT_${1:?missing name}"
1045+
if [[ -n "${!env_name:-}" ]]; then
1046+
echo "${!env_name:-}"
1047+
else
1048+
env_name="DB_CLIENT_${1}"
1049+
echo "${!env_name:-}"
1050+
fi
1051+
}
1052+
local -a opts=()
1053+
local key value
1054+
if is_boolean_yes "$DB_ENABLE_SSL"; then
1055+
if [[ "$(mysql_client_flavor)" = "mysql" ]]; then
1056+
opts+=("--ssl-mode=REQUIRED")
1057+
else
1058+
opts+=("--ssl=TRUE")
1059+
fi
1060+
# Add "--ssl-ca", "--ssl-key" and "--ssl-cert" options if the env vars are defined
1061+
for key in ca key cert; do
1062+
value="$(mysql_client_env_value "SSL_${key^^}_FILE")"
1063+
[[ -n "${value}" ]] && opts+=("--ssl-${key}=${value}")
1064+
done
1065+
fi
1066+
echo "${opts[@]:-}"
1067+
}

3/debian-10/rootfs/opt/bitnami/scripts/mysql-client-env.sh

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@ mysql_env_vars=(
2929
MYSQL_CLIENT_CREATE_DATABASE_PASSWORD
3030
MYSQL_CLIENT_CREATE_DATABASE_CHARACTER_SET
3131
MYSQL_CLIENT_CREATE_DATABASE_COLLATE
32-
MYSQL_CLIENT_TLS_ENABLED
32+
MYSQL_CLIENT_ENABLE_SSL_WRAPPER
33+
MYSQL_CLIENT_ENABLE_SSL
34+
MYSQL_CLIENT_SSL_CA_FILE
35+
MYSQL_CLIENT_SSL_CERT_FILE
36+
MYSQL_CLIENT_SSL_KEY_FILE
37+
MYSQL_CLIENT_EXTRA_FLAGS
3338
)
3439
for env_var in "${mysql_env_vars[@]}"; do
3540
file_env_var="${env_var}_FILE"
@@ -79,7 +84,17 @@ export MYSQL_CLIENT_CREATE_DATABASE_CHARACTER_SET="${MYSQL_CLIENT_CREATE_DATABAS
7984
export DB_CREATE_DATABASE_CHARACTER_SET="$MYSQL_CLIENT_CREATE_DATABASE_CHARACTER_SET"
8085
export MYSQL_CLIENT_CREATE_DATABASE_COLLATE="${MYSQL_CLIENT_CREATE_DATABASE_COLLATE:-}"
8186
export DB_CREATE_DATABASE_COLLATE="$MYSQL_CLIENT_CREATE_DATABASE_COLLATE"
82-
export MYSQL_CLIENT_TLS_ENABLED="${MYSQL_CLIENT_TLS_ENABLED:-no}"
83-
export DB_TLS_ENABLED="$MYSQL_CLIENT_TLS_ENABLED"
87+
export MYSQL_CLIENT_ENABLE_SSL_WRAPPER="${MYSQL_CLIENT_ENABLE_SSL_WRAPPER:-no}"
88+
export DB_ENABLE_SSL_WRAPPER="$MYSQL_CLIENT_ENABLE_SSL_WRAPPER"
89+
export MYSQL_CLIENT_ENABLE_SSL="${MYSQL_CLIENT_ENABLE_SSL:-no}"
90+
export DB_ENABLE_SSL="$MYSQL_CLIENT_ENABLE_SSL"
91+
export MYSQL_CLIENT_SSL_CA_FILE="${MYSQL_CLIENT_SSL_CA_FILE:-}"
92+
export DB_SSL_CA_FILE="$MYSQL_CLIENT_SSL_CA_FILE"
93+
export MYSQL_CLIENT_SSL_CERT_FILE="${MYSQL_CLIENT_SSL_CERT_FILE:-}"
94+
export DB_SSL_CERT_FILE="$MYSQL_CLIENT_SSL_CERT_FILE"
95+
export MYSQL_CLIENT_SSL_KEY_FILE="${MYSQL_CLIENT_SSL_KEY_FILE:-}"
96+
export DB_SSL_KEY_FILE="$MYSQL_CLIENT_SSL_KEY_FILE"
97+
export MYSQL_CLIENT_EXTRA_FLAGS="${MYSQL_CLIENT_EXTRA_FLAGS:-no}"
98+
export DB_EXTRA_FLAGS="$MYSQL_CLIENT_EXTRA_FLAGS"
8499

85100
# Custom environment variables may be defined below

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Non-root container images add an extra layer of security and are generally recom
4343
Learn more about the Bitnami tagging policy and the difference between rolling tags and immutable tags [in our documentation page](https://docs.bitnami.com/tutorials/understand-rolling-tags-containers/).
4444

4545

46-
* [`3`, `3-debian-10`, `3.10.1`, `3.10.1-debian-10-r1`, `latest` (3/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-moodle/blob/3.10.1-debian-10-r1/3/debian-10/Dockerfile)
46+
* [`3`, `3-debian-10`, `3.10.1`, `3.10.1-debian-10-r2`, `latest` (3/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-moodle/blob/3.10.1-debian-10-r2/3/debian-10/Dockerfile)
4747

4848
Subscribe to project updates by watching the [bitnami/moodle GitHub repo](https://github.com/bitnami/bitnami-docker-moodle).
4949

@@ -265,13 +265,13 @@ To configure Moodle<sup>TM</sup> to send email using SMTP you can set the follow
265265

266266
##### PHP configuration
267267

268+
- `PHP_EXPOSE_PHP`: Enables HTTP header with PHP version. No default.
268269
- `PHP_MAX_EXECUTION_TIME`: Maximum execution time for PHP scripts. No default.
269270
- `PHP_MAX_INPUT_TIME`: Maximum input time for PHP scripts. No default.
270271
- `PHP_MAX_INPUT_VARS`: Maximum amount of input variables for PHP scripts. No default.
271272
- `PHP_MEMORY_LIMIT`: Memory limit for PHP scripts. Default: **256M**
272273
- `PHP_POST_MAX_SIZE`: Maximum size for PHP POST requests. No default.
273274
- `PHP_UPLOAD_MAX_FILESIZE`: Maximum file size for PHP uploads. No default.
274-
- `PHP_EXPOSE_PHP`: Enables HTTP header with PHP version. No default.
275275

276276
##### Example
277277

0 commit comments

Comments
 (0)