From ff80c7e2ec817b9910d8f016c6c683ac8b2c043e Mon Sep 17 00:00:00 2001 From: Bitnami Bot Date: Thu, 10 Mar 2022 07:42:01 +0000 Subject: [PATCH] 2.4.52-debian-10-r73 release --- bitnami/apache/2.4/debian-10/Dockerfile | 2 +- .../rootfs/opt/bitnami/scripts/apache-env.sh | 2 ++ .../opt/bitnami/scripts/apache/postunpack.sh | 1 + .../opt/bitnami/scripts/apache/setup.sh | 3 +++ .../rootfs/opt/bitnami/scripts/libapache.sh | 21 +++++++++++++++++++ bitnami/apache/README.md | 2 +- 6 files changed, 29 insertions(+), 2 deletions(-) diff --git a/bitnami/apache/2.4/debian-10/Dockerfile b/bitnami/apache/2.4/debian-10/Dockerfile index 44f6d1a29ba8..20c82a617e43 100644 --- a/bitnami/apache/2.4/debian-10/Dockerfile +++ b/bitnami/apache/2.4/debian-10/Dockerfile @@ -21,7 +21,7 @@ RUN /opt/bitnami/scripts/apache/postunpack.sh ENV APACHE_HTTPS_PORT_NUMBER="" \ APACHE_HTTP_PORT_NUMBER="" \ BITNAMI_APP_NAME="apache" \ - BITNAMI_IMAGE_VERSION="2.4.52-debian-10-r72" \ + BITNAMI_IMAGE_VERSION="2.4.52-debian-10-r73" \ PATH="/opt/bitnami/common/bin:/opt/bitnami/apache/bin:$PATH" EXPOSE 8080 8443 diff --git a/bitnami/apache/2.4/debian-10/rootfs/opt/bitnami/scripts/apache-env.sh b/bitnami/apache/2.4/debian-10/rootfs/opt/bitnami/scripts/apache-env.sh index eec592498ecd..ccbd724cb02f 100644 --- a/bitnami/apache/2.4/debian-10/rootfs/opt/bitnami/scripts/apache-env.sh +++ b/bitnami/apache/2.4/debian-10/rootfs/opt/bitnami/scripts/apache-env.sh @@ -23,6 +23,7 @@ export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" apache_env_vars=( APACHE_HTTP_PORT_NUMBER APACHE_HTTPS_PORT_NUMBER + APACHE_SERVER_TOKENS APACHE_HTTP_PORT APACHE_HTTPS_PORT ) @@ -72,5 +73,6 @@ export WEB_SERVER_HTTP_PORT_NUMBER="$APACHE_HTTP_PORT_NUMBER" APACHE_HTTPS_PORT_NUMBER="${APACHE_HTTPS_PORT_NUMBER:-"${APACHE_HTTPS_PORT:-}"}" export APACHE_HTTPS_PORT_NUMBER="${APACHE_HTTPS_PORT_NUMBER:-}" export WEB_SERVER_HTTPS_PORT_NUMBER="$APACHE_HTTPS_PORT_NUMBER" +export APACHE_SERVER_TOKENS="${APACHE_SERVER_TOKENS:-Prod}" # Custom environment variables may be defined below diff --git a/bitnami/apache/2.4/debian-10/rootfs/opt/bitnami/scripts/apache/postunpack.sh b/bitnami/apache/2.4/debian-10/rootfs/opt/bitnami/scripts/apache/postunpack.sh index e7d67d19321d..8a133f545c27 100755 --- a/bitnami/apache/2.4/debian-10/rootfs/opt/bitnami/scripts/apache/postunpack.sh +++ b/bitnami/apache/2.4/debian-10/rootfs/opt/bitnami/scripts/apache/postunpack.sh @@ -59,6 +59,7 @@ apache_setup_bitnami_config() { Include "${APACHE_CONF_DIR}/extra/httpd-default.conf" PidFile "${APACHE_PID_FILE}" TraceEnable Off +ServerTokens ${APACHE_SERVER_TOKENS} Include "${APACHE_CONF_DIR}/deflate.conf" IncludeOptional "${APACHE_VHOSTS_DIR}/*.conf" Include "${APACHE_CONF_DIR}/bitnami/bitnami.conf" diff --git a/bitnami/apache/2.4/debian-10/rootfs/opt/bitnami/scripts/apache/setup.sh b/bitnami/apache/2.4/debian-10/rootfs/opt/bitnami/scripts/apache/setup.sh index 4aec08b33dd0..3d7279aad46a 100755 --- a/bitnami/apache/2.4/debian-10/rootfs/opt/bitnami/scripts/apache/setup.sh +++ b/bitnami/apache/2.4/debian-10/rootfs/opt/bitnami/scripts/apache/setup.sh @@ -56,5 +56,8 @@ fi [[ -n "$APACHE_HTTP_PORT_NUMBER" ]] && info "Configuring the HTTP port" && apache_configure_http_port "$APACHE_HTTP_PORT_NUMBER" [[ -n "$APACHE_HTTPS_PORT_NUMBER" ]] && info "Configuring the HTTPS port" && apache_configure_https_port "$APACHE_HTTPS_PORT_NUMBER" +# Configure ServerTokens with user values +[[ -n "$APACHE_SERVER_TOKENS" ]] && info "Configuring Apache ServerTokens directive" && apache_configure_server_tokens "$APACHE_SERVER_TOKENS" + # Fix logging issue when running as root ! am_i_root || chmod o+w "$(readlink /dev/stdout)" "$(readlink /dev/stderr)" diff --git a/bitnami/apache/2.4/debian-10/rootfs/opt/bitnami/scripts/libapache.sh b/bitnami/apache/2.4/debian-10/rootfs/opt/bitnami/scripts/libapache.sh index 5a8bae06cbcc..2a6b3c70deed 100644 --- a/bitnami/apache/2.4/debian-10/rootfs/opt/bitnami/scripts/libapache.sh +++ b/bitnami/apache/2.4/debian-10/rootfs/opt/bitnami/scripts/libapache.sh @@ -112,6 +112,27 @@ apache_configure_https_port() { fi } +######################## +# Configure Apache's ServerTokens directive +# Globals: +# APACHE_CONF_DIR +# Arguments: +# $1 - Value for ServerTokens directive +# Returns: +# None +######################### +apache_configure_server_tokens() { + local -r value=${1:?missing value} + local -r server_tokens_exp="s|^\s*ServerTokens\s+\w+\s*$|ServerTokens ${value}|" + local apache_configuration + + if [[ -w "$APACHE_CONF_FILE" ]]; then + debug "Configuring ServerTokens ${value} on file ${APACHE_CONF_FILE}" + apache_configuration="$(sed -E -e "$server_tokens_exp" "$APACHE_CONF_FILE")" + echo "$apache_configuration" > "$APACHE_CONF_FILE" + fi +} + ######################## # Enable a module in the Apache configuration file # Globals: diff --git a/bitnami/apache/README.md b/bitnami/apache/README.md index 1db4e521a04b..2b84bbc5720d 100644 --- a/bitnami/apache/README.md +++ b/bitnami/apache/README.md @@ -49,7 +49,7 @@ Non-root container images add an extra layer of security and are generally recom 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/). -* [`2.4`, `2.4-debian-10`, `2.4.52`, `2.4.52-debian-10-r72`, `latest` (2.4/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-apache/blob/2.4.52-debian-10-r72/2.4/debian-10/Dockerfile) +* [`2.4`, `2.4-debian-10`, `2.4.52`, `2.4.52-debian-10-r73`, `latest` (2.4/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-apache/blob/2.4.52-debian-10-r73/2.4/debian-10/Dockerfile) Subscribe to project updates by watching the [bitnami/apache GitHub repo](https://github.com/bitnami/bitnami-docker-apache).