From 4537b8edabfce5a48f80dab83274d6048b4551b1 Mon Sep 17 00:00:00 2001 From: Alexey Pustovalov Date: Tue, 20 Aug 2024 18:09:56 +0900 Subject: [PATCH] Clear ZBX, DB env variables before starting agent, server, proxy and web-service --- Dockerfiles/agent/alpine/docker-entrypoint.sh | 9 +++++++++ Dockerfiles/agent/centos/docker-entrypoint.sh | 9 +++++++++ Dockerfiles/agent/ol/docker-entrypoint.sh | 9 +++++++++ Dockerfiles/agent/rhel/docker-entrypoint.sh | 9 +++++++++ Dockerfiles/agent/ubuntu/docker-entrypoint.sh | 9 +++++++++ Dockerfiles/agent2/alpine/docker-entrypoint.sh | 9 +++++++++ Dockerfiles/agent2/centos/docker-entrypoint.sh | 9 +++++++++ Dockerfiles/agent2/ol/docker-entrypoint.sh | 9 +++++++++ Dockerfiles/agent2/rhel/docker-entrypoint.sh | 9 +++++++++ Dockerfiles/agent2/ubuntu/docker-entrypoint.sh | 9 +++++++++ Dockerfiles/proxy-mysql/alpine/docker-entrypoint.sh | 9 +++++++++ Dockerfiles/proxy-mysql/centos/docker-entrypoint.sh | 9 +++++++++ Dockerfiles/proxy-mysql/ol/docker-entrypoint.sh | 9 +++++++++ Dockerfiles/proxy-mysql/rhel/docker-entrypoint.sh | 9 +++++++++ Dockerfiles/proxy-mysql/ubuntu/docker-entrypoint.sh | 9 +++++++++ Dockerfiles/proxy-sqlite3/alpine/docker-entrypoint.sh | 9 +++++++++ Dockerfiles/proxy-sqlite3/centos/docker-entrypoint.sh | 9 +++++++++ Dockerfiles/proxy-sqlite3/ol/docker-entrypoint.sh | 9 +++++++++ Dockerfiles/proxy-sqlite3/rhel/docker-entrypoint.sh | 9 +++++++++ Dockerfiles/proxy-sqlite3/ubuntu/docker-entrypoint.sh | 9 +++++++++ Dockerfiles/server-mysql/alpine/docker-entrypoint.sh | 9 +++++++++ Dockerfiles/server-mysql/centos/docker-entrypoint.sh | 9 +++++++++ Dockerfiles/server-mysql/ol/docker-entrypoint.sh | 9 +++++++++ Dockerfiles/server-mysql/rhel/docker-entrypoint.sh | 9 +++++++++ Dockerfiles/server-mysql/ubuntu/docker-entrypoint.sh | 9 +++++++++ Dockerfiles/server-pgsql/alpine/docker-entrypoint.sh | 9 +++++++++ Dockerfiles/server-pgsql/centos/docker-entrypoint.sh | 9 +++++++++ Dockerfiles/server-pgsql/ol/docker-entrypoint.sh | 9 +++++++++ Dockerfiles/server-pgsql/ubuntu/docker-entrypoint.sh | 9 +++++++++ 29 files changed, 261 insertions(+) diff --git a/Dockerfiles/agent/alpine/docker-entrypoint.sh b/Dockerfiles/agent/alpine/docker-entrypoint.sh index dd580b4f1..e2bcb52f1 100755 --- a/Dockerfiles/agent/alpine/docker-entrypoint.sh +++ b/Dockerfiles/agent/alpine/docker-entrypoint.sh @@ -201,9 +201,18 @@ prepare_zbx_agent_config() { fi } +clear_zbx_env() { + [[ "${ZBX_CLEAR_ENV}" == "false" ]] && return + + for env_var in $(env | grep -E "^ZBX_"); do + unset "${env_var%%=*}" + done +} + prepare_agent() { echo "** Preparing Zabbix agent" prepare_zbx_agent_config + clear_zbx_env } ################################################# diff --git a/Dockerfiles/agent/centos/docker-entrypoint.sh b/Dockerfiles/agent/centos/docker-entrypoint.sh index dd580b4f1..e2bcb52f1 100755 --- a/Dockerfiles/agent/centos/docker-entrypoint.sh +++ b/Dockerfiles/agent/centos/docker-entrypoint.sh @@ -201,9 +201,18 @@ prepare_zbx_agent_config() { fi } +clear_zbx_env() { + [[ "${ZBX_CLEAR_ENV}" == "false" ]] && return + + for env_var in $(env | grep -E "^ZBX_"); do + unset "${env_var%%=*}" + done +} + prepare_agent() { echo "** Preparing Zabbix agent" prepare_zbx_agent_config + clear_zbx_env } ################################################# diff --git a/Dockerfiles/agent/ol/docker-entrypoint.sh b/Dockerfiles/agent/ol/docker-entrypoint.sh index dd580b4f1..e2bcb52f1 100755 --- a/Dockerfiles/agent/ol/docker-entrypoint.sh +++ b/Dockerfiles/agent/ol/docker-entrypoint.sh @@ -201,9 +201,18 @@ prepare_zbx_agent_config() { fi } +clear_zbx_env() { + [[ "${ZBX_CLEAR_ENV}" == "false" ]] && return + + for env_var in $(env | grep -E "^ZBX_"); do + unset "${env_var%%=*}" + done +} + prepare_agent() { echo "** Preparing Zabbix agent" prepare_zbx_agent_config + clear_zbx_env } ################################################# diff --git a/Dockerfiles/agent/rhel/docker-entrypoint.sh b/Dockerfiles/agent/rhel/docker-entrypoint.sh index dd580b4f1..e2bcb52f1 100755 --- a/Dockerfiles/agent/rhel/docker-entrypoint.sh +++ b/Dockerfiles/agent/rhel/docker-entrypoint.sh @@ -201,9 +201,18 @@ prepare_zbx_agent_config() { fi } +clear_zbx_env() { + [[ "${ZBX_CLEAR_ENV}" == "false" ]] && return + + for env_var in $(env | grep -E "^ZBX_"); do + unset "${env_var%%=*}" + done +} + prepare_agent() { echo "** Preparing Zabbix agent" prepare_zbx_agent_config + clear_zbx_env } ################################################# diff --git a/Dockerfiles/agent/ubuntu/docker-entrypoint.sh b/Dockerfiles/agent/ubuntu/docker-entrypoint.sh index dd580b4f1..e2bcb52f1 100755 --- a/Dockerfiles/agent/ubuntu/docker-entrypoint.sh +++ b/Dockerfiles/agent/ubuntu/docker-entrypoint.sh @@ -201,9 +201,18 @@ prepare_zbx_agent_config() { fi } +clear_zbx_env() { + [[ "${ZBX_CLEAR_ENV}" == "false" ]] && return + + for env_var in $(env | grep -E "^ZBX_"); do + unset "${env_var%%=*}" + done +} + prepare_agent() { echo "** Preparing Zabbix agent" prepare_zbx_agent_config + clear_zbx_env } ################################################# diff --git a/Dockerfiles/agent2/alpine/docker-entrypoint.sh b/Dockerfiles/agent2/alpine/docker-entrypoint.sh index afbd09455..ae77445a2 100755 --- a/Dockerfiles/agent2/alpine/docker-entrypoint.sh +++ b/Dockerfiles/agent2/alpine/docker-entrypoint.sh @@ -195,9 +195,18 @@ prepare_zbx_agent_config() { update_config_multiple_var $ZBX_AGENT_CONFIG "AllowKey" "${ZBX_ALLOWKEY}" } +clear_zbx_env() { + [[ "${ZBX_CLEAR_ENV}" == "false" ]] && return + + for env_var in $(env | grep -E "^ZBX_"); do + unset "${env_var%%=*}" + done +} + prepare_agent() { echo "** Preparing Zabbix agent" prepare_zbx_agent_config + clear_zbx_env } ################################################# diff --git a/Dockerfiles/agent2/centos/docker-entrypoint.sh b/Dockerfiles/agent2/centos/docker-entrypoint.sh index afbd09455..ae77445a2 100755 --- a/Dockerfiles/agent2/centos/docker-entrypoint.sh +++ b/Dockerfiles/agent2/centos/docker-entrypoint.sh @@ -195,9 +195,18 @@ prepare_zbx_agent_config() { update_config_multiple_var $ZBX_AGENT_CONFIG "AllowKey" "${ZBX_ALLOWKEY}" } +clear_zbx_env() { + [[ "${ZBX_CLEAR_ENV}" == "false" ]] && return + + for env_var in $(env | grep -E "^ZBX_"); do + unset "${env_var%%=*}" + done +} + prepare_agent() { echo "** Preparing Zabbix agent" prepare_zbx_agent_config + clear_zbx_env } ################################################# diff --git a/Dockerfiles/agent2/ol/docker-entrypoint.sh b/Dockerfiles/agent2/ol/docker-entrypoint.sh index afbd09455..ae77445a2 100755 --- a/Dockerfiles/agent2/ol/docker-entrypoint.sh +++ b/Dockerfiles/agent2/ol/docker-entrypoint.sh @@ -195,9 +195,18 @@ prepare_zbx_agent_config() { update_config_multiple_var $ZBX_AGENT_CONFIG "AllowKey" "${ZBX_ALLOWKEY}" } +clear_zbx_env() { + [[ "${ZBX_CLEAR_ENV}" == "false" ]] && return + + for env_var in $(env | grep -E "^ZBX_"); do + unset "${env_var%%=*}" + done +} + prepare_agent() { echo "** Preparing Zabbix agent" prepare_zbx_agent_config + clear_zbx_env } ################################################# diff --git a/Dockerfiles/agent2/rhel/docker-entrypoint.sh b/Dockerfiles/agent2/rhel/docker-entrypoint.sh index afbd09455..ae77445a2 100755 --- a/Dockerfiles/agent2/rhel/docker-entrypoint.sh +++ b/Dockerfiles/agent2/rhel/docker-entrypoint.sh @@ -195,9 +195,18 @@ prepare_zbx_agent_config() { update_config_multiple_var $ZBX_AGENT_CONFIG "AllowKey" "${ZBX_ALLOWKEY}" } +clear_zbx_env() { + [[ "${ZBX_CLEAR_ENV}" == "false" ]] && return + + for env_var in $(env | grep -E "^ZBX_"); do + unset "${env_var%%=*}" + done +} + prepare_agent() { echo "** Preparing Zabbix agent" prepare_zbx_agent_config + clear_zbx_env } ################################################# diff --git a/Dockerfiles/agent2/ubuntu/docker-entrypoint.sh b/Dockerfiles/agent2/ubuntu/docker-entrypoint.sh index afbd09455..ae77445a2 100755 --- a/Dockerfiles/agent2/ubuntu/docker-entrypoint.sh +++ b/Dockerfiles/agent2/ubuntu/docker-entrypoint.sh @@ -195,9 +195,18 @@ prepare_zbx_agent_config() { update_config_multiple_var $ZBX_AGENT_CONFIG "AllowKey" "${ZBX_ALLOWKEY}" } +clear_zbx_env() { + [[ "${ZBX_CLEAR_ENV}" == "false" ]] && return + + for env_var in $(env | grep -E "^ZBX_"); do + unset "${env_var%%=*}" + done +} + prepare_agent() { echo "** Preparing Zabbix agent" prepare_zbx_agent_config + clear_zbx_env } ################################################# diff --git a/Dockerfiles/proxy-mysql/alpine/docker-entrypoint.sh b/Dockerfiles/proxy-mysql/alpine/docker-entrypoint.sh index eba98a905..ccda51130 100755 --- a/Dockerfiles/proxy-mysql/alpine/docker-entrypoint.sh +++ b/Dockerfiles/proxy-mysql/alpine/docker-entrypoint.sh @@ -484,6 +484,14 @@ update_zbx_config() { fi } +clear_zbx_env() { + [[ "${ZBX_CLEAR_ENV}" == "false" ]] && return + + for env_var in $(env | grep -E "^(ZBX|DB|MYSQL)_"); do + unset "${env_var%%=*}" + done +} + prepare_db() { echo "** Preparing database" @@ -499,6 +507,7 @@ prepare_proxy() { prepare_db update_zbx_config + clear_zbx_env } ################################################# diff --git a/Dockerfiles/proxy-mysql/centos/docker-entrypoint.sh b/Dockerfiles/proxy-mysql/centos/docker-entrypoint.sh index 64fcb7d09..13c559488 100755 --- a/Dockerfiles/proxy-mysql/centos/docker-entrypoint.sh +++ b/Dockerfiles/proxy-mysql/centos/docker-entrypoint.sh @@ -481,6 +481,14 @@ update_zbx_config() { fi } +clear_zbx_env() { + [[ "${ZBX_CLEAR_ENV}" == "false" ]] && return + + for env_var in $(env | grep -E "^(ZBX|DB|MYSQL)_"); do + unset "${env_var%%=*}" + done +} + prepare_db() { echo "** Preparing database" @@ -496,6 +504,7 @@ prepare_proxy() { prepare_db update_zbx_config + clear_zbx_env } ################################################# diff --git a/Dockerfiles/proxy-mysql/ol/docker-entrypoint.sh b/Dockerfiles/proxy-mysql/ol/docker-entrypoint.sh index 64fcb7d09..13c559488 100755 --- a/Dockerfiles/proxy-mysql/ol/docker-entrypoint.sh +++ b/Dockerfiles/proxy-mysql/ol/docker-entrypoint.sh @@ -481,6 +481,14 @@ update_zbx_config() { fi } +clear_zbx_env() { + [[ "${ZBX_CLEAR_ENV}" == "false" ]] && return + + for env_var in $(env | grep -E "^(ZBX|DB|MYSQL)_"); do + unset "${env_var%%=*}" + done +} + prepare_db() { echo "** Preparing database" @@ -496,6 +504,7 @@ prepare_proxy() { prepare_db update_zbx_config + clear_zbx_env } ################################################# diff --git a/Dockerfiles/proxy-mysql/rhel/docker-entrypoint.sh b/Dockerfiles/proxy-mysql/rhel/docker-entrypoint.sh index 64fcb7d09..13c559488 100755 --- a/Dockerfiles/proxy-mysql/rhel/docker-entrypoint.sh +++ b/Dockerfiles/proxy-mysql/rhel/docker-entrypoint.sh @@ -481,6 +481,14 @@ update_zbx_config() { fi } +clear_zbx_env() { + [[ "${ZBX_CLEAR_ENV}" == "false" ]] && return + + for env_var in $(env | grep -E "^(ZBX|DB|MYSQL)_"); do + unset "${env_var%%=*}" + done +} + prepare_db() { echo "** Preparing database" @@ -496,6 +504,7 @@ prepare_proxy() { prepare_db update_zbx_config + clear_zbx_env } ################################################# diff --git a/Dockerfiles/proxy-mysql/ubuntu/docker-entrypoint.sh b/Dockerfiles/proxy-mysql/ubuntu/docker-entrypoint.sh index 36da8e5fb..3e3f36998 100755 --- a/Dockerfiles/proxy-mysql/ubuntu/docker-entrypoint.sh +++ b/Dockerfiles/proxy-mysql/ubuntu/docker-entrypoint.sh @@ -481,6 +481,14 @@ update_zbx_config() { fi } +clear_zbx_env() { + [[ "${ZBX_CLEAR_ENV}" == "false" ]] && return + + for env_var in $(env | grep -E "^(ZBX|DB|MYSQL)_"); do + unset "${env_var%%=*}" + done +} + prepare_db() { echo "** Preparing database" @@ -496,6 +504,7 @@ prepare_proxy() { prepare_db update_zbx_config + clear_zbx_env } ################################################# diff --git a/Dockerfiles/proxy-sqlite3/alpine/docker-entrypoint.sh b/Dockerfiles/proxy-sqlite3/alpine/docker-entrypoint.sh index 9c8809ddb..cb9977ea5 100755 --- a/Dockerfiles/proxy-sqlite3/alpine/docker-entrypoint.sh +++ b/Dockerfiles/proxy-sqlite3/alpine/docker-entrypoint.sh @@ -249,10 +249,19 @@ update_zbx_config() { fi } +clear_zbx_env() { + [[ "${ZBX_CLEAR_ENV}" == "false" ]] && return + + for env_var in $(env | grep -E "^ZBX_"); do + unset "${env_var%%=*}" + done +} + prepare_proxy() { echo "Preparing Zabbix proxy" update_zbx_config + clear_zbx_env } ################################################# diff --git a/Dockerfiles/proxy-sqlite3/centos/docker-entrypoint.sh b/Dockerfiles/proxy-sqlite3/centos/docker-entrypoint.sh index 9c8809ddb..cb9977ea5 100755 --- a/Dockerfiles/proxy-sqlite3/centos/docker-entrypoint.sh +++ b/Dockerfiles/proxy-sqlite3/centos/docker-entrypoint.sh @@ -249,10 +249,19 @@ update_zbx_config() { fi } +clear_zbx_env() { + [[ "${ZBX_CLEAR_ENV}" == "false" ]] && return + + for env_var in $(env | grep -E "^ZBX_"); do + unset "${env_var%%=*}" + done +} + prepare_proxy() { echo "Preparing Zabbix proxy" update_zbx_config + clear_zbx_env } ################################################# diff --git a/Dockerfiles/proxy-sqlite3/ol/docker-entrypoint.sh b/Dockerfiles/proxy-sqlite3/ol/docker-entrypoint.sh index 9c8809ddb..cb9977ea5 100755 --- a/Dockerfiles/proxy-sqlite3/ol/docker-entrypoint.sh +++ b/Dockerfiles/proxy-sqlite3/ol/docker-entrypoint.sh @@ -249,10 +249,19 @@ update_zbx_config() { fi } +clear_zbx_env() { + [[ "${ZBX_CLEAR_ENV}" == "false" ]] && return + + for env_var in $(env | grep -E "^ZBX_"); do + unset "${env_var%%=*}" + done +} + prepare_proxy() { echo "Preparing Zabbix proxy" update_zbx_config + clear_zbx_env } ################################################# diff --git a/Dockerfiles/proxy-sqlite3/rhel/docker-entrypoint.sh b/Dockerfiles/proxy-sqlite3/rhel/docker-entrypoint.sh index 9c8809ddb..cb9977ea5 100755 --- a/Dockerfiles/proxy-sqlite3/rhel/docker-entrypoint.sh +++ b/Dockerfiles/proxy-sqlite3/rhel/docker-entrypoint.sh @@ -249,10 +249,19 @@ update_zbx_config() { fi } +clear_zbx_env() { + [[ "${ZBX_CLEAR_ENV}" == "false" ]] && return + + for env_var in $(env | grep -E "^ZBX_"); do + unset "${env_var%%=*}" + done +} + prepare_proxy() { echo "Preparing Zabbix proxy" update_zbx_config + clear_zbx_env } ################################################# diff --git a/Dockerfiles/proxy-sqlite3/ubuntu/docker-entrypoint.sh b/Dockerfiles/proxy-sqlite3/ubuntu/docker-entrypoint.sh index 962472cc8..f18332699 100755 --- a/Dockerfiles/proxy-sqlite3/ubuntu/docker-entrypoint.sh +++ b/Dockerfiles/proxy-sqlite3/ubuntu/docker-entrypoint.sh @@ -249,10 +249,19 @@ update_zbx_config() { fi } +clear_zbx_env() { + [[ "${ZBX_CLEAR_ENV}" == "false" ]] && return + + for env_var in $(env | grep -E "^ZBX_"); do + unset "${env_var%%=*}" + done +} + prepare_proxy() { echo "Preparing Zabbix proxy" update_zbx_config + clear_zbx_env } ################################################# diff --git a/Dockerfiles/server-mysql/alpine/docker-entrypoint.sh b/Dockerfiles/server-mysql/alpine/docker-entrypoint.sh index b2f8f5169..8b960210b 100755 --- a/Dockerfiles/server-mysql/alpine/docker-entrypoint.sh +++ b/Dockerfiles/server-mysql/alpine/docker-entrypoint.sh @@ -497,6 +497,14 @@ update_zbx_config() { fi } +clear_zbx_env() { + [[ "${ZBX_CLEAR_ENV}" == "false" ]] && return + + for env_var in $(env | grep -E "^(ZBX|DB|MYSQL)_"); do + unset "${env_var%%=*}" + done +} + prepare_db() { echo "** Preparing database" @@ -512,6 +520,7 @@ prepare_server() { prepare_db update_zbx_config + clear_zbx_env } ################################################# diff --git a/Dockerfiles/server-mysql/centos/docker-entrypoint.sh b/Dockerfiles/server-mysql/centos/docker-entrypoint.sh index 0c7d1c6de..4459068d9 100755 --- a/Dockerfiles/server-mysql/centos/docker-entrypoint.sh +++ b/Dockerfiles/server-mysql/centos/docker-entrypoint.sh @@ -494,6 +494,14 @@ update_zbx_config() { fi } +clear_zbx_env() { + [[ "${ZBX_CLEAR_ENV}" == "false" ]] && return + + for env_var in $(env | grep -E "^(ZBX|DB|MYSQL)_"); do + unset "${env_var%%=*}" + done +} + prepare_db() { echo "** Preparing database" @@ -509,6 +517,7 @@ prepare_server() { prepare_db update_zbx_config + clear_zbx_env } ################################################# diff --git a/Dockerfiles/server-mysql/ol/docker-entrypoint.sh b/Dockerfiles/server-mysql/ol/docker-entrypoint.sh index 0c7d1c6de..4459068d9 100755 --- a/Dockerfiles/server-mysql/ol/docker-entrypoint.sh +++ b/Dockerfiles/server-mysql/ol/docker-entrypoint.sh @@ -494,6 +494,14 @@ update_zbx_config() { fi } +clear_zbx_env() { + [[ "${ZBX_CLEAR_ENV}" == "false" ]] && return + + for env_var in $(env | grep -E "^(ZBX|DB|MYSQL)_"); do + unset "${env_var%%=*}" + done +} + prepare_db() { echo "** Preparing database" @@ -509,6 +517,7 @@ prepare_server() { prepare_db update_zbx_config + clear_zbx_env } ################################################# diff --git a/Dockerfiles/server-mysql/rhel/docker-entrypoint.sh b/Dockerfiles/server-mysql/rhel/docker-entrypoint.sh index 0c7d1c6de..4459068d9 100755 --- a/Dockerfiles/server-mysql/rhel/docker-entrypoint.sh +++ b/Dockerfiles/server-mysql/rhel/docker-entrypoint.sh @@ -494,6 +494,14 @@ update_zbx_config() { fi } +clear_zbx_env() { + [[ "${ZBX_CLEAR_ENV}" == "false" ]] && return + + for env_var in $(env | grep -E "^(ZBX|DB|MYSQL)_"); do + unset "${env_var%%=*}" + done +} + prepare_db() { echo "** Preparing database" @@ -509,6 +517,7 @@ prepare_server() { prepare_db update_zbx_config + clear_zbx_env } ################################################# diff --git a/Dockerfiles/server-mysql/ubuntu/docker-entrypoint.sh b/Dockerfiles/server-mysql/ubuntu/docker-entrypoint.sh index f0c0f1254..b6c58fd49 100755 --- a/Dockerfiles/server-mysql/ubuntu/docker-entrypoint.sh +++ b/Dockerfiles/server-mysql/ubuntu/docker-entrypoint.sh @@ -494,6 +494,14 @@ update_zbx_config() { fi } +clear_zbx_env() { + [[ "${ZBX_CLEAR_ENV}" == "false" ]] && return + + for env_var in $(env | grep -E "^(ZBX|DB|MYSQL)_"); do + unset "${env_var%%=*}" + done +} + prepare_db() { echo "** Preparing database" @@ -509,6 +517,7 @@ prepare_server() { prepare_db update_zbx_config + clear_zbx_env } ################################################# diff --git a/Dockerfiles/server-pgsql/alpine/docker-entrypoint.sh b/Dockerfiles/server-pgsql/alpine/docker-entrypoint.sh index aa4c1647a..709bf6195 100755 --- a/Dockerfiles/server-pgsql/alpine/docker-entrypoint.sh +++ b/Dockerfiles/server-pgsql/alpine/docker-entrypoint.sh @@ -514,6 +514,14 @@ update_zbx_config() { fi } +clear_zbx_env() { + [[ "${ZBX_CLEAR_ENV}" == "false" ]] && return + + for env_var in $(env | grep -E "^(ZBX|DB|POSTGRES)_"); do + unset "${env_var%%=*}" + done +} + prepare_db() { echo "** Preparing database" @@ -528,6 +536,7 @@ prepare_server() { prepare_db update_zbx_config + clear_zbx_env } ################################################# diff --git a/Dockerfiles/server-pgsql/centos/docker-entrypoint.sh b/Dockerfiles/server-pgsql/centos/docker-entrypoint.sh index aa4c1647a..709bf6195 100755 --- a/Dockerfiles/server-pgsql/centos/docker-entrypoint.sh +++ b/Dockerfiles/server-pgsql/centos/docker-entrypoint.sh @@ -514,6 +514,14 @@ update_zbx_config() { fi } +clear_zbx_env() { + [[ "${ZBX_CLEAR_ENV}" == "false" ]] && return + + for env_var in $(env | grep -E "^(ZBX|DB|POSTGRES)_"); do + unset "${env_var%%=*}" + done +} + prepare_db() { echo "** Preparing database" @@ -528,6 +536,7 @@ prepare_server() { prepare_db update_zbx_config + clear_zbx_env } ################################################# diff --git a/Dockerfiles/server-pgsql/ol/docker-entrypoint.sh b/Dockerfiles/server-pgsql/ol/docker-entrypoint.sh index aa4c1647a..709bf6195 100755 --- a/Dockerfiles/server-pgsql/ol/docker-entrypoint.sh +++ b/Dockerfiles/server-pgsql/ol/docker-entrypoint.sh @@ -514,6 +514,14 @@ update_zbx_config() { fi } +clear_zbx_env() { + [[ "${ZBX_CLEAR_ENV}" == "false" ]] && return + + for env_var in $(env | grep -E "^(ZBX|DB|POSTGRES)_"); do + unset "${env_var%%=*}" + done +} + prepare_db() { echo "** Preparing database" @@ -528,6 +536,7 @@ prepare_server() { prepare_db update_zbx_config + clear_zbx_env } ################################################# diff --git a/Dockerfiles/server-pgsql/ubuntu/docker-entrypoint.sh b/Dockerfiles/server-pgsql/ubuntu/docker-entrypoint.sh index 1fe0cc67f..e2970a8cf 100755 --- a/Dockerfiles/server-pgsql/ubuntu/docker-entrypoint.sh +++ b/Dockerfiles/server-pgsql/ubuntu/docker-entrypoint.sh @@ -514,6 +514,14 @@ update_zbx_config() { fi } +clear_zbx_env() { + [[ "${ZBX_CLEAR_ENV}" == "false" ]] && return + + for env_var in $(env | grep -E "^(ZBX|DB|POSTGRES)_"); do + unset "${env_var%%=*}" + done +} + prepare_db() { echo "** Preparing database" @@ -528,6 +536,7 @@ prepare_server() { prepare_db update_zbx_config + clear_zbx_env } #################################################