Skip to content

Commit

Permalink
Fixed EXPOSE_WEB_SERVER_INFO parameter for Apache on Ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
dotneft committed Dec 6, 2024
1 parent 1fd73dc commit da22cf7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
16 changes: 9 additions & 7 deletions Dockerfiles/web-apache-mysql/ubuntu/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ ZABBIX_ETC_DIR="/etc/zabbix"
ZABBIX_WWW_ROOT="/usr/share/zabbix"
# Apache main configuration file
HTTPD_CONF_FILE="/etc/apache2/apache2.conf"
# Apache security configuration file
HTTPD_SECURITY_CONF_FILE="/etc/apache2/conf-enabled/security.conf"

# usage: file_env VAR [DEFAULT]
# as example: file_env 'MYSQL_PASSWORD' 'zabbix'
Expand Down Expand Up @@ -240,18 +242,18 @@ prepare_zbx_web_config() {
fi

: ${EXPOSE_WEB_SERVER_INFO:="on"}
if [ "${EXPOSE_WEB_SERVER_INFO}" = "off" ]; then
[[ "${EXPOSE_WEB_SERVER_INFO}" != "off" ]] && EXPOSE_WEB_SERVER_INFO="on"
export EXPOSE_WEB_SERVER_INFO=${EXPOSE_WEB_SERVER_INFO}

if [ "${EXPOSE_WEB_SERVER_INFO}" == "off" ]; then
sed -i \
-e "s/^\(\s*ServerTokens\).*\$/\1 Prod/g" \
"$HTTPD_CONF_FILE"
else
EXPOSE_WEB_SERVER_INFO="on"
"$HTTPD_SECURITY_CONF_FILE"
fi

export EXPOSE_WEB_SERVER_INFO=${EXPOSE_WEB_SERVER_INFO}
sed -i \
-e "s/^\(\s*ServerSignature\).*\$/\1 ${EXPOSE_WEB_SERVER_INFO^}/g" \
"$HTTPD_CONF_FILE"
-e "s/^\(\s*ServerSignature\).*\$/\1 ${EXPOSE_WEB_SERVER_INFO}/g" \
"$HTTPD_SECURITY_CONF_FILE"
}

#################################################
Expand Down
16 changes: 9 additions & 7 deletions Dockerfiles/web-apache-pgsql/ubuntu/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ ZABBIX_ETC_DIR="/etc/zabbix"
ZABBIX_WWW_ROOT="/usr/share/zabbix"
# Apache main configuration file
HTTPD_CONF_FILE="/etc/apache2/apache2.conf"
# Apache security configuration file
HTTPD_SECURITY_CONF_FILE="/etc/apache2/conf-enabled/security.conf"

# usage: file_env VAR [DEFAULT]
# as example: file_env 'MYSQL_PASSWORD' 'zabbix'
Expand Down Expand Up @@ -231,18 +233,18 @@ prepare_zbx_web_config() {
fi

: ${EXPOSE_WEB_SERVER_INFO:="on"}
if [ "${EXPOSE_WEB_SERVER_INFO}" = "off" ]; then
[[ "${EXPOSE_WEB_SERVER_INFO}" != "off" ]] && EXPOSE_WEB_SERVER_INFO="on"
export EXPOSE_WEB_SERVER_INFO=${EXPOSE_WEB_SERVER_INFO}

if [ "${EXPOSE_WEB_SERVER_INFO}" == "off" ]; then
sed -i \
-e "s/^\(\s*ServerTokens\).*\$/\1 Prod/g" \
"$HTTPD_CONF_FILE"
else
EXPOSE_WEB_SERVER_INFO="on"
"$HTTPD_SECURITY_CONF_FILE"
fi

export EXPOSE_WEB_SERVER_INFO=${EXPOSE_WEB_SERVER_INFO}
sed -i \
-e "s/^\(\s*ServerSignature\).*\$/\1 ${EXPOSE_WEB_SERVER_INFO^}/g" \
"$HTTPD_CONF_FILE"
-e "s/^\(\s*ServerSignature\).*\$/\1 ${EXPOSE_WEB_SERVER_INFO}/g" \
"$HTTPD_SECURITY_CONF_FILE"
}

#################################################
Expand Down

0 comments on commit da22cf7

Please sign in to comment.