diff --git a/bitnami/apache/2.4/debian-12/Dockerfile b/bitnami/apache/2.4/debian-12/Dockerfile index 6cbb3ca70418..1bbfa85ec4ef 100644 --- a/bitnami/apache/2.4/debian-12/Dockerfile +++ b/bitnami/apache/2.4/debian-12/Dockerfile @@ -7,7 +7,7 @@ ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" ARG TARGETARCH LABEL org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2026-05-21T00:45:01Z" \ + org.opencontainers.image.created="2026-06-03T08:09:03Z" \ org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/apache/README.md" \ org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/apache" \ @@ -28,18 +28,18 @@ RUN --mount=type=secret,id=downloads_url,env=SECRET_DOWNLOADS_URL \ DOWNLOADS_URL=${SECRET_DOWNLOADS_URL:-${DOWNLOADS_URL}} ; \ mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ || exit 1 ; \ COMPONENTS=( \ - "render-template-1.0.9-165-linux-${OS_ARCH}-debian-12" \ + "render-template-1.0.9-166-linux-${OS_ARCH}-debian-12" \ "apache-2.4.67-1-linux-${OS_ARCH}-debian-12" \ ) ; \ for COMPONENT in "${COMPONENTS[@]}"; do \ if [ ! -f "${COMPONENT}.tar.gz" ]; then \ curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ + sha256sum -c "/opt/bitnami/checksums/${COMPONENT}.tar.gz.sha256" ; \ tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done + rm -rf "${COMPONENT}".tar.gz ; \ + done ; \ + rm -rf /opt/bitnami/checksums ; RUN apt-get update && apt-get upgrade -y && \ apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives RUN chmod g+rwX /opt/bitnami @@ -52,7 +52,7 @@ ENV APACHE_HTTPS_PORT_NUMBER="" \ APACHE_HTTP_PORT_NUMBER="" \ APP_VERSION="2.4.67" \ BITNAMI_APP_NAME="apache" \ - IMAGE_REVISION="4" \ + IMAGE_REVISION="6" \ PATH="/opt/bitnami/common/bin:/opt/bitnami/apache/bin:$PATH" EXPOSE 8080 8443 diff --git a/bitnami/apache/2.4/debian-12/prebuildfs/opt/bitnami/checksums/apache-2.4.67-1-linux-amd64-debian-12.tar.gz.sha256 b/bitnami/apache/2.4/debian-12/prebuildfs/opt/bitnami/checksums/apache-2.4.67-1-linux-amd64-debian-12.tar.gz.sha256 new file mode 100644 index 000000000000..ffe4d71f0d07 --- /dev/null +++ b/bitnami/apache/2.4/debian-12/prebuildfs/opt/bitnami/checksums/apache-2.4.67-1-linux-amd64-debian-12.tar.gz.sha256 @@ -0,0 +1 @@ +cc9ec4ed758ad8502b7057aa3527cc003261038cd75f0a5fa8aa885bfea46ff1 apache-2.4.67-1-linux-amd64-debian-12.tar.gz diff --git a/bitnami/apache/2.4/debian-12/prebuildfs/opt/bitnami/checksums/apache-2.4.67-1-linux-arm64-debian-12.tar.gz.sha256 b/bitnami/apache/2.4/debian-12/prebuildfs/opt/bitnami/checksums/apache-2.4.67-1-linux-arm64-debian-12.tar.gz.sha256 new file mode 100644 index 000000000000..06e58dbe1e02 --- /dev/null +++ b/bitnami/apache/2.4/debian-12/prebuildfs/opt/bitnami/checksums/apache-2.4.67-1-linux-arm64-debian-12.tar.gz.sha256 @@ -0,0 +1 @@ +01aa3fe1d54b7ecde2e19098de2fe93205c1c105ff31391f98f5afc3274aa99e apache-2.4.67-1-linux-arm64-debian-12.tar.gz diff --git a/bitnami/apache/2.4/debian-12/prebuildfs/opt/bitnami/checksums/render-template-1.0.9-166-linux-amd64-debian-12.tar.gz.sha256 b/bitnami/apache/2.4/debian-12/prebuildfs/opt/bitnami/checksums/render-template-1.0.9-166-linux-amd64-debian-12.tar.gz.sha256 new file mode 100644 index 000000000000..09a2ab4133ea --- /dev/null +++ b/bitnami/apache/2.4/debian-12/prebuildfs/opt/bitnami/checksums/render-template-1.0.9-166-linux-amd64-debian-12.tar.gz.sha256 @@ -0,0 +1 @@ +e2467be27e79a387c78b8ef3a57ceaa07bea65009972571f20dcf58631656e0b render-template-1.0.9-166-linux-amd64-debian-12.tar.gz diff --git a/bitnami/apache/2.4/debian-12/prebuildfs/opt/bitnami/checksums/render-template-1.0.9-166-linux-arm64-debian-12.tar.gz.sha256 b/bitnami/apache/2.4/debian-12/prebuildfs/opt/bitnami/checksums/render-template-1.0.9-166-linux-arm64-debian-12.tar.gz.sha256 new file mode 100644 index 000000000000..25ae43b180a6 --- /dev/null +++ b/bitnami/apache/2.4/debian-12/prebuildfs/opt/bitnami/checksums/render-template-1.0.9-166-linux-arm64-debian-12.tar.gz.sha256 @@ -0,0 +1 @@ +c2c7634c5c0882d2dbd822744f6b5bdb074a07a1abf710c67e1206f1c20b8afa render-template-1.0.9-166-linux-arm64-debian-12.tar.gz diff --git a/bitnami/apache/2.4/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/apache/2.4/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh index 1c69e0e48a5d..335c1c7c9ef7 100644 --- a/bitnami/apache/2.4/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ b/bitnami/apache/2.4/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh @@ -139,3 +139,40 @@ wait_for_log_entry() { return 1 fi } + +######################## +# Creates a secure temporary file containing the provided secret +# Arguments: +# $1 - secret to write to the temporary file +# Returns: +# String +######################### +credential_to_temp_file() { + local secret="$1" + local tmp_file + + # Use mktemp with a specific prefix for easier debugging if something lingers + if ! tmp_file=$(mktemp "${TMPDIR:-/tmp}/at.cred.XXXXXXXX"); then + echo "Error: Failed to create temp file" >&2 + return 1 + fi + + # Restrict permissions before writing the secret + chmod 0600 "$tmp_file" + # Write secret and ensure it's flushed to disk + printf "%s" "$secret" > "$tmp_file" + # Output the filename so the caller can capture it + echo "$tmp_file" +} + +######################## +# Cleans up temporary files created by credential_to_temp_file +# Arguments: +# None +# Returns: +# None +######################### +cleanup_credentials() { + debug "Cleaning up temporary files containing credentials" + rm -rf "${TMPDIR:-/tmp}"/at.cred.* +} diff --git a/bitnami/apache/2.4/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/apache/2.4/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh index 1337f6c2dd59..b16efabd3230 100644 --- a/bitnami/apache/2.4/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ b/bitnami/apache/2.4/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh @@ -131,6 +131,7 @@ relativize() { # -d|--dir-mode - mode for files. # -u|--user - user # -g|--group - group +# -n|--no-dereference - do not follow symlinks (use for runtime root chown of daemon-writable dirs) # Returns: # None ######################### @@ -140,6 +141,7 @@ configure_permissions_ownership() { local file_mode="" local user="" local group="" + local follow_symlinks="yes" # Validate arguments shift 1 @@ -161,6 +163,9 @@ configure_permissions_ownership() { shift group="${1:?missing group}" ;; + -n | --no-dereference) + follow_symlinks="no" + ;; *) echo "Invalid command line flag $1" >&2 return 1 @@ -169,22 +174,29 @@ configure_permissions_ownership() { shift done + # -L: follow symlinks and emits the target path + # This is dangerous at runtime, given a co-located lower-privileged process with write access + # to the target path can redirect the chown/chmod to arbitrary paths. Example: + # Lower-privileged process run: ln -s /etc /tmp/etc + # Then, setup.sh runs: configure_permissions_ownership --dir-mode 775 /tmp + local find_L_flag=(); [[ "$follow_symlinks" == "yes" ]] && find_L_flag=("-L") + # -h: changes symlink inode ownership without touching the target. + local chown_flags=(); [[ "$follow_symlinks" == "no" ]] && chown_flags=("-h") read -r -a filepaths <<<"$paths" for p in "${filepaths[@]}"; do if [[ -e "$p" ]]; then - find -L "$p" -printf "" if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" + find "${find_L_flag[@]}" "$p" -not -type l -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" fi if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" + find "${find_L_flag[@]}" "$p" -not -type l -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" fi if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" + find "${find_L_flag[@]}" "$p" -print0 | xargs -r -0 chown "${chown_flags[@]}" "${user}:${group}" elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" + find "${find_L_flag[@]}" "$p" -print0 | xargs -r -0 chown "${chown_flags[@]}" "${user}" elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" + find "${find_L_flag[@]}" "$p" -print0 | xargs -r -0 chgrp "${chown_flags[@]}" "${group}" fi else stderr_print "$p does not exist" diff --git a/bitnami/apache/2.4/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/bitnami-ssl.conf.tpl b/bitnami/apache/2.4/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/bitnami-ssl.conf.tpl index ff6de13a321e..66d6deb84f29 100644 --- a/bitnami/apache/2.4/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/bitnami-ssl.conf.tpl +++ b/bitnami/apache/2.4/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/bitnami-ssl.conf.tpl @@ -5,9 +5,11 @@ Listen 443 -SSLProtocol all -SSLv2 -SSLv3 -SSLHonorCipherOrder on -SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS !EDH !RC4" +SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1 +# Ciphers for TLS 1.2, see https://wiki.mozilla.org/Security/Server_Side_TLS +SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384 +SSLHonorCipherOrder off +SSLSessionTickets off SSLPassPhraseDialog builtin SSLSessionCache "shmcb:{{APACHE_LOGS_DIR}}/ssl_scache(512000)" SSLSessionCacheTimeout 300 @@ -19,7 +21,7 @@ SSLSessionCacheTimeout 300 SSLCertificateKeyFile "{{APACHE_CONF_DIR}}/bitnami/certs/tls.key" - Options Indexes FollowSymLinks + Options FollowSymLinks AllowOverride All Require all granted diff --git a/bitnami/apache/2.4/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/bitnami.conf.tpl b/bitnami/apache/2.4/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/bitnami.conf.tpl index 75a255c3efee..73d73314f8a3 100644 --- a/bitnami/apache/2.4/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/bitnami.conf.tpl +++ b/bitnami/apache/2.4/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/bitnami.conf.tpl @@ -6,7 +6,7 @@ SetEnvIf X-Forwarded-Proto https HTTPS=on DocumentRoot "{{APACHE_BASE_DIR}}/htdocs" - Options Indexes FollowSymLinks + Options FollowSymLinks AllowOverride All Require all granted diff --git a/bitnami/apache/2.4/debian-12/rootfs/opt/bitnami/scripts/libapache.sh b/bitnami/apache/2.4/debian-12/rootfs/opt/bitnami/scripts/libapache.sh index d6eb686df3f6..0e1a4818ccc7 100644 --- a/bitnami/apache/2.4/debian-12/rootfs/opt/bitnami/scripts/libapache.sh +++ b/bitnami/apache/2.4/debian-12/rootfs/opt/bitnami/scripts/libapache.sh @@ -803,6 +803,10 @@ apache_create_password_file() { local -r username="${2:?missing username}" local -r password="${3:?missing password}" - "${APACHE_BIN_DIR}/htpasswd" -bc "$file" "$username" "$password" - am_i_root && configure_permissions_ownership "$file" --file-mode "600" --user "$APACHE_DAEMON_USER" --group "$APACHE_DAEMON_GROUP" + # The -B flag uses bcrypt to hash the password, which is more secure than legacy APR1 (1000-iteration MD5) hash + # The -C flag computing time used for the bcrypt algorithm (default is 5) + "${APACHE_BIN_DIR}/htpasswd" -Bbc -C 12 "$file" "$username" "$password" + am_i_root && configure_permissions_ownership "$file" --user "$APACHE_DAEMON_USER" --group "$APACHE_DAEMON_GROUP" + # We can set strong permissions regardless the container is running as root or not + chmod 0600 "$file" }