mirror of
https://github.com/zabbix/zabbix-docker.git
synced 2025-01-05 21:29:17 +01:00
Merge remote-tracking branch 'origin/master' into 3.2
This commit is contained in:
commit
41e45d405d
@ -49,6 +49,23 @@ prepare_system() {
|
||||
fi
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
var_value="${var_value//\\/\\\\}"
|
||||
var_value="${var_value//[$'\n']/}"
|
||||
var_value="${var_value//\//\\/}"
|
||||
var_value="${var_value//./\\.}"
|
||||
var_value="${var_value//\*/\\*}"
|
||||
var_value="${var_value//^/\\^}"
|
||||
var_value="${var_value//\$/\\\$}"
|
||||
var_value="${var_value//\&/\\\&}"
|
||||
var_value="${var_value//\[/\\[}"
|
||||
var_value="${var_value//\[/\\]}"
|
||||
|
||||
echo $var_value
|
||||
}
|
||||
|
||||
update_config_var() {
|
||||
local config_path=$1
|
||||
local var_name=$2
|
||||
@ -81,8 +98,8 @@ update_config_var() {
|
||||
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
var_value=${var_value//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
var_value=$(escape_spec_char "$var_value")
|
||||
|
||||
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
|
||||
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
|
||||
@ -703,15 +720,17 @@ prepare_zbx_web_config() {
|
||||
echo "**** Zabbix related PHP configuration file not found"
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
server_name=${ZBX_SERVER_NAME//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
|
||||
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")
|
||||
server_pass=$(escape_spec_char "${DB_SERVER_ZBX_PASS}")
|
||||
|
||||
sed -i \
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_USER}/${DB_SERVER_ZBX_USER}/g" \
|
||||
-e "s/{DB_SERVER_PASS}/${DB_SERVER_ZBX_PASS}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
-e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \
|
||||
-e "s/{ZBX_SERVER_NAME}/$server_name/g" \
|
||||
|
@ -49,6 +49,23 @@ prepare_system() {
|
||||
fi
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
var_value="${var_value//\\/\\\\}"
|
||||
var_value="${var_value//[$'\n']/}"
|
||||
var_value="${var_value//\//\\/}"
|
||||
var_value="${var_value//./\\.}"
|
||||
var_value="${var_value//\*/\\*}"
|
||||
var_value="${var_value//^/\\^}"
|
||||
var_value="${var_value//\$/\\\$}"
|
||||
var_value="${var_value//\&/\\\&}"
|
||||
var_value="${var_value//\[/\\[}"
|
||||
var_value="${var_value//\[/\\]}"
|
||||
|
||||
echo $var_value
|
||||
}
|
||||
|
||||
update_config_var() {
|
||||
local config_path=$1
|
||||
local var_name=$2
|
||||
@ -81,8 +98,8 @@ update_config_var() {
|
||||
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
var_value=${var_value//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
var_value=$(escape_spec_char "$var_value")
|
||||
|
||||
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
|
||||
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
|
||||
@ -703,15 +720,17 @@ prepare_zbx_web_config() {
|
||||
echo "**** Zabbix related PHP configuration file not found"
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
server_name=${ZBX_SERVER_NAME//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
|
||||
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")
|
||||
server_pass=$(escape_spec_char "${DB_SERVER_ZBX_PASS}")
|
||||
|
||||
sed -i \
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_USER}/${DB_SERVER_ZBX_USER}/g" \
|
||||
-e "s/{DB_SERVER_PASS}/${DB_SERVER_ZBX_PASS}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
-e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \
|
||||
-e "s/{ZBX_SERVER_NAME}/$server_name/g" \
|
||||
|
@ -49,6 +49,23 @@ prepare_system() {
|
||||
fi
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
var_value="${var_value//\\/\\\\}"
|
||||
var_value="${var_value//[$'\n']/}"
|
||||
var_value="${var_value//\//\\/}"
|
||||
var_value="${var_value//./\\.}"
|
||||
var_value="${var_value//\*/\\*}"
|
||||
var_value="${var_value//^/\\^}"
|
||||
var_value="${var_value//\$/\\\$}"
|
||||
var_value="${var_value//\&/\\\&}"
|
||||
var_value="${var_value//\[/\\[}"
|
||||
var_value="${var_value//\[/\\]}"
|
||||
|
||||
echo $var_value
|
||||
}
|
||||
|
||||
update_config_var() {
|
||||
local config_path=$1
|
||||
local var_name=$2
|
||||
@ -81,8 +98,8 @@ update_config_var() {
|
||||
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
var_value=${var_value//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
var_value=$(escape_spec_char "$var_value")
|
||||
|
||||
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
|
||||
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
|
||||
@ -703,15 +720,17 @@ prepare_zbx_web_config() {
|
||||
echo "**** Zabbix related PHP configuration file not found"
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
server_name=${ZBX_SERVER_NAME//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
|
||||
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")
|
||||
server_pass=$(escape_spec_char "${DB_SERVER_ZBX_PASS}")
|
||||
|
||||
sed -i \
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_USER}/${DB_SERVER_ZBX_USER}/g" \
|
||||
-e "s/{DB_SERVER_PASS}/${DB_SERVER_ZBX_PASS}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
-e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \
|
||||
-e "s/{ZBX_SERVER_NAME}/$server_name/g" \
|
||||
|
@ -49,6 +49,23 @@ prepare_system() {
|
||||
fi
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
var_value="${var_value//\\/\\\\}"
|
||||
var_value="${var_value//[$'\n']/}"
|
||||
var_value="${var_value//\//\\/}"
|
||||
var_value="${var_value//./\\.}"
|
||||
var_value="${var_value//\*/\\*}"
|
||||
var_value="${var_value//^/\\^}"
|
||||
var_value="${var_value//\$/\\\$}"
|
||||
var_value="${var_value//\&/\\\&}"
|
||||
var_value="${var_value//\[/\\[}"
|
||||
var_value="${var_value//\[/\\]}"
|
||||
|
||||
echo $var_value
|
||||
}
|
||||
|
||||
update_config_var() {
|
||||
local config_path=$1
|
||||
local var_name=$2
|
||||
@ -81,8 +98,8 @@ update_config_var() {
|
||||
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
var_value=${var_value//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
var_value=$(escape_spec_char "$var_value")
|
||||
|
||||
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
|
||||
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
|
||||
@ -703,15 +720,17 @@ prepare_zbx_web_config() {
|
||||
echo "**** Zabbix related PHP configuration file not found"
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
server_name=${ZBX_SERVER_NAME//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
|
||||
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")
|
||||
server_pass=$(escape_spec_char "${DB_SERVER_ZBX_PASS}")
|
||||
|
||||
sed -i \
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_USER}/${DB_SERVER_ZBX_USER}/g" \
|
||||
-e "s/{DB_SERVER_PASS}/${DB_SERVER_ZBX_PASS}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
-e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \
|
||||
-e "s/{ZBX_SERVER_NAME}/$server_name/g" \
|
||||
|
@ -49,6 +49,23 @@ prepare_system() {
|
||||
fi
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
var_value="${var_value//\\/\\\\}"
|
||||
var_value="${var_value//[$'\n']/}"
|
||||
var_value="${var_value//\//\\/}"
|
||||
var_value="${var_value//./\\.}"
|
||||
var_value="${var_value//\*/\\*}"
|
||||
var_value="${var_value//^/\\^}"
|
||||
var_value="${var_value//\$/\\\$}"
|
||||
var_value="${var_value//\&/\\\&}"
|
||||
var_value="${var_value//\[/\\[}"
|
||||
var_value="${var_value//\[/\\]}"
|
||||
|
||||
echo $var_value
|
||||
}
|
||||
|
||||
update_config_var() {
|
||||
local config_path=$1
|
||||
local var_name=$2
|
||||
@ -81,8 +98,8 @@ update_config_var() {
|
||||
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
var_value=${var_value//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
var_value=$(escape_spec_char "$var_value")
|
||||
|
||||
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
|
||||
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
|
||||
@ -703,15 +720,17 @@ prepare_zbx_web_config() {
|
||||
echo "**** Zabbix related PHP configuration file not found"
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
server_name=${ZBX_SERVER_NAME//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
|
||||
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")
|
||||
server_pass=$(escape_spec_char "${DB_SERVER_ZBX_PASS}")
|
||||
|
||||
sed -i \
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_USER}/${DB_SERVER_ZBX_USER}/g" \
|
||||
-e "s/{DB_SERVER_PASS}/${DB_SERVER_ZBX_PASS}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
-e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \
|
||||
-e "s/{ZBX_SERVER_NAME}/$server_name/g" \
|
||||
|
@ -1,17 +0,0 @@
|
||||
[supervisord]
|
||||
nodaemon = true
|
||||
|
||||
[program:zabbix_java_gateway]
|
||||
command = /bin/bash /usr/sbin/%(program_name)s
|
||||
user = zabbix
|
||||
auto_start = true
|
||||
autorestart = true
|
||||
|
||||
startsecs=3
|
||||
startretries=3
|
||||
stopsignal=INT
|
||||
stopwaitsecs=2
|
||||
|
||||
redirect_stderr=true
|
||||
stdout_logfile = /dev/stdout
|
||||
stdout_logfile_maxbytes = 0
|
@ -1,35 +0,0 @@
|
||||
; supervisor config file
|
||||
|
||||
[unix_http_server]
|
||||
file = /var/run/supervisor.sock ; (the path to the socket file)
|
||||
chmod = 0700 ; sockef file mode (default 0700)
|
||||
username = zbx
|
||||
password = password
|
||||
|
||||
[supervisord]
|
||||
logfile = /dev/stdout ; (main log file;default $CWD/supervisord.log)
|
||||
pidfile = /var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
|
||||
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
|
||||
critical = critical
|
||||
user = root
|
||||
logfile_maxbytes = 0
|
||||
logfile_backupcount = 0
|
||||
loglevel = info
|
||||
|
||||
; the below section must remain in the config file for RPC
|
||||
; (supervisorctl/web interface) to work, additional interfaces may be
|
||||
; added by defining them in separate rpcinterface: sections
|
||||
[rpcinterface:supervisor]
|
||||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
||||
|
||||
[supervisorctl]
|
||||
serverurl = unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
|
||||
|
||||
; The [include] section can just contain the "files" setting. This
|
||||
; setting can list multiple files (separated by whitespace or
|
||||
; newlines). It can also contain wildcards. The filenames are
|
||||
; interpreted as relative to this file. Included files *cannot*
|
||||
; include files themselves.
|
||||
|
||||
[include]
|
||||
files = /etc/supervisor/conf.d/*.conf
|
@ -49,6 +49,23 @@ prepare_system() {
|
||||
fi
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
var_value="${var_value//\\/\\\\}"
|
||||
var_value="${var_value//[$'\n']/}"
|
||||
var_value="${var_value//\//\\/}"
|
||||
var_value="${var_value//./\\.}"
|
||||
var_value="${var_value//\*/\\*}"
|
||||
var_value="${var_value//^/\\^}"
|
||||
var_value="${var_value//\$/\\\$}"
|
||||
var_value="${var_value//\&/\\\&}"
|
||||
var_value="${var_value//\[/\\[}"
|
||||
var_value="${var_value//\[/\\]}"
|
||||
|
||||
echo $var_value
|
||||
}
|
||||
|
||||
update_config_var() {
|
||||
local config_path=$1
|
||||
local var_name=$2
|
||||
@ -81,8 +98,8 @@ update_config_var() {
|
||||
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
var_value=${var_value//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
var_value=$(escape_spec_char "$var_value")
|
||||
|
||||
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
|
||||
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
|
||||
@ -703,15 +720,17 @@ prepare_zbx_web_config() {
|
||||
echo "**** Zabbix related PHP configuration file not found"
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
server_name=${ZBX_SERVER_NAME//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
|
||||
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")
|
||||
server_pass=$(escape_spec_char "${DB_SERVER_ZBX_PASS}")
|
||||
|
||||
sed -i \
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_USER}/${DB_SERVER_ZBX_USER}/g" \
|
||||
-e "s/{DB_SERVER_PASS}/${DB_SERVER_ZBX_PASS}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
-e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \
|
||||
-e "s/{ZBX_SERVER_NAME}/$server_name/g" \
|
||||
|
@ -49,6 +49,23 @@ prepare_system() {
|
||||
fi
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
var_value="${var_value//\\/\\\\}"
|
||||
var_value="${var_value//[$'\n']/}"
|
||||
var_value="${var_value//\//\\/}"
|
||||
var_value="${var_value//./\\.}"
|
||||
var_value="${var_value//\*/\\*}"
|
||||
var_value="${var_value//^/\\^}"
|
||||
var_value="${var_value//\$/\\\$}"
|
||||
var_value="${var_value//\&/\\\&}"
|
||||
var_value="${var_value//\[/\\[}"
|
||||
var_value="${var_value//\[/\\]}"
|
||||
|
||||
echo $var_value
|
||||
}
|
||||
|
||||
update_config_var() {
|
||||
local config_path=$1
|
||||
local var_name=$2
|
||||
@ -81,8 +98,8 @@ update_config_var() {
|
||||
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
var_value=${var_value//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
var_value=$(escape_spec_char "$var_value")
|
||||
|
||||
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
|
||||
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
|
||||
@ -703,15 +720,17 @@ prepare_zbx_web_config() {
|
||||
echo "**** Zabbix related PHP configuration file not found"
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
server_name=${ZBX_SERVER_NAME//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
|
||||
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")
|
||||
server_pass=$(escape_spec_char "${DB_SERVER_ZBX_PASS}")
|
||||
|
||||
sed -i \
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_USER}/${DB_SERVER_ZBX_USER}/g" \
|
||||
-e "s/{DB_SERVER_PASS}/${DB_SERVER_ZBX_PASS}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
-e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \
|
||||
-e "s/{ZBX_SERVER_NAME}/$server_name/g" \
|
||||
|
@ -49,6 +49,23 @@ prepare_system() {
|
||||
fi
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
var_value="${var_value//\\/\\\\}"
|
||||
var_value="${var_value//[$'\n']/}"
|
||||
var_value="${var_value//\//\\/}"
|
||||
var_value="${var_value//./\\.}"
|
||||
var_value="${var_value//\*/\\*}"
|
||||
var_value="${var_value//^/\\^}"
|
||||
var_value="${var_value//\$/\\\$}"
|
||||
var_value="${var_value//\&/\\\&}"
|
||||
var_value="${var_value//\[/\\[}"
|
||||
var_value="${var_value//\[/\\]}"
|
||||
|
||||
echo $var_value
|
||||
}
|
||||
|
||||
update_config_var() {
|
||||
local config_path=$1
|
||||
local var_name=$2
|
||||
@ -81,8 +98,8 @@ update_config_var() {
|
||||
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
var_value=${var_value//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
var_value=$(escape_spec_char "$var_value")
|
||||
|
||||
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
|
||||
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
|
||||
@ -703,15 +720,17 @@ prepare_zbx_web_config() {
|
||||
echo "**** Zabbix related PHP configuration file not found"
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
server_name=${ZBX_SERVER_NAME//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
|
||||
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")
|
||||
server_pass=$(escape_spec_char "${DB_SERVER_ZBX_PASS}")
|
||||
|
||||
sed -i \
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_USER}/${DB_SERVER_ZBX_USER}/g" \
|
||||
-e "s/{DB_SERVER_PASS}/${DB_SERVER_ZBX_PASS}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
-e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \
|
||||
-e "s/{ZBX_SERVER_NAME}/$server_name/g" \
|
||||
|
@ -49,6 +49,23 @@ prepare_system() {
|
||||
fi
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
var_value="${var_value//\\/\\\\}"
|
||||
var_value="${var_value//[$'\n']/}"
|
||||
var_value="${var_value//\//\\/}"
|
||||
var_value="${var_value//./\\.}"
|
||||
var_value="${var_value//\*/\\*}"
|
||||
var_value="${var_value//^/\\^}"
|
||||
var_value="${var_value//\$/\\\$}"
|
||||
var_value="${var_value//\&/\\\&}"
|
||||
var_value="${var_value//\[/\\[}"
|
||||
var_value="${var_value//\[/\\]}"
|
||||
|
||||
echo $var_value
|
||||
}
|
||||
|
||||
update_config_var() {
|
||||
local config_path=$1
|
||||
local var_name=$2
|
||||
@ -81,8 +98,8 @@ update_config_var() {
|
||||
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
var_value=${var_value//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
var_value=$(escape_spec_char "$var_value")
|
||||
|
||||
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
|
||||
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
|
||||
@ -703,15 +720,17 @@ prepare_zbx_web_config() {
|
||||
echo "**** Zabbix related PHP configuration file not found"
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
server_name=${ZBX_SERVER_NAME//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
|
||||
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")
|
||||
server_pass=$(escape_spec_char "${DB_SERVER_ZBX_PASS}")
|
||||
|
||||
sed -i \
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_USER}/${DB_SERVER_ZBX_USER}/g" \
|
||||
-e "s/{DB_SERVER_PASS}/${DB_SERVER_ZBX_PASS}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
-e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \
|
||||
-e "s/{ZBX_SERVER_NAME}/$server_name/g" \
|
||||
|
@ -49,6 +49,23 @@ prepare_system() {
|
||||
fi
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
var_value="${var_value//\\/\\\\}"
|
||||
var_value="${var_value//[$'\n']/}"
|
||||
var_value="${var_value//\//\\/}"
|
||||
var_value="${var_value//./\\.}"
|
||||
var_value="${var_value//\*/\\*}"
|
||||
var_value="${var_value//^/\\^}"
|
||||
var_value="${var_value//\$/\\\$}"
|
||||
var_value="${var_value//\&/\\\&}"
|
||||
var_value="${var_value//\[/\\[}"
|
||||
var_value="${var_value//\[/\\]}"
|
||||
|
||||
echo $var_value
|
||||
}
|
||||
|
||||
update_config_var() {
|
||||
local config_path=$1
|
||||
local var_name=$2
|
||||
@ -81,8 +98,8 @@ update_config_var() {
|
||||
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
var_value=${var_value//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
var_value=$(escape_spec_char "$var_value")
|
||||
|
||||
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
|
||||
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
|
||||
@ -703,15 +720,17 @@ prepare_zbx_web_config() {
|
||||
echo "**** Zabbix related PHP configuration file not found"
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
server_name=${ZBX_SERVER_NAME//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
|
||||
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")
|
||||
server_pass=$(escape_spec_char "${DB_SERVER_ZBX_PASS}")
|
||||
|
||||
sed -i \
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_USER}/${DB_SERVER_ZBX_USER}/g" \
|
||||
-e "s/{DB_SERVER_PASS}/${DB_SERVER_ZBX_PASS}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
-e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \
|
||||
-e "s/{ZBX_SERVER_NAME}/$server_name/g" \
|
||||
|
@ -49,6 +49,23 @@ prepare_system() {
|
||||
fi
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
var_value="${var_value//\\/\\\\}"
|
||||
var_value="${var_value//[$'\n']/}"
|
||||
var_value="${var_value//\//\\/}"
|
||||
var_value="${var_value//./\\.}"
|
||||
var_value="${var_value//\*/\\*}"
|
||||
var_value="${var_value//^/\\^}"
|
||||
var_value="${var_value//\$/\\\$}"
|
||||
var_value="${var_value//\&/\\\&}"
|
||||
var_value="${var_value//\[/\\[}"
|
||||
var_value="${var_value//\[/\\]}"
|
||||
|
||||
echo $var_value
|
||||
}
|
||||
|
||||
update_config_var() {
|
||||
local config_path=$1
|
||||
local var_name=$2
|
||||
@ -81,8 +98,8 @@ update_config_var() {
|
||||
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
var_value=${var_value//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
var_value=$(escape_spec_char "$var_value")
|
||||
|
||||
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
|
||||
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
|
||||
@ -703,15 +720,17 @@ prepare_zbx_web_config() {
|
||||
echo "**** Zabbix related PHP configuration file not found"
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
server_name=${ZBX_SERVER_NAME//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
|
||||
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")
|
||||
server_pass=$(escape_spec_char "${DB_SERVER_ZBX_PASS}")
|
||||
|
||||
sed -i \
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_USER}/${DB_SERVER_ZBX_USER}/g" \
|
||||
-e "s/{DB_SERVER_PASS}/${DB_SERVER_ZBX_PASS}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
-e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \
|
||||
-e "s/{ZBX_SERVER_NAME}/$server_name/g" \
|
||||
|
@ -1,18 +0,0 @@
|
||||
[supervisord]
|
||||
nodaemon = true
|
||||
|
||||
[program:zabbix_proxy]
|
||||
command = /usr/sbin/%(program_name)s --foreground -c /etc/zabbix/zabbix_proxy.conf
|
||||
user = zabbix
|
||||
auto_start = true
|
||||
autorestart = true
|
||||
|
||||
startsecs=5
|
||||
startretries=3
|
||||
stopsignal=INT
|
||||
stopwaitsecs=5
|
||||
|
||||
redirect_stderr=true
|
||||
|
||||
stdout_logfile = /dev/stdout
|
||||
stdout_logfile_maxbytes = 0
|
@ -1,35 +0,0 @@
|
||||
; supervisor config file
|
||||
|
||||
[unix_http_server]
|
||||
file = /var/run/supervisor.sock ; (the path to the socket file)
|
||||
chmod = 0700 ; sockef file mode (default 0700)
|
||||
username = zbx
|
||||
password = password
|
||||
|
||||
[supervisord]
|
||||
logfile = /dev/stdout ; (main log file;default $CWD/supervisord.log)
|
||||
pidfile = /var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
|
||||
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
|
||||
critical = critical
|
||||
user = root
|
||||
logfile_maxbytes = 0
|
||||
logfile_backupcount = 0
|
||||
loglevel = info
|
||||
|
||||
; the below section must remain in the config file for RPC
|
||||
; (supervisorctl/web interface) to work, additional interfaces may be
|
||||
; added by defining them in separate rpcinterface: sections
|
||||
[rpcinterface:supervisor]
|
||||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
||||
|
||||
[supervisorctl]
|
||||
serverurl = unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
|
||||
|
||||
; The [include] section can just contain the "files" setting. This
|
||||
; setting can list multiple files (separated by whitespace or
|
||||
; newlines). It can also contain wildcards. The filenames are
|
||||
; interpreted as relative to this file. Included files *cannot*
|
||||
; include files themselves.
|
||||
|
||||
[include]
|
||||
files = /etc/supervisor/conf.d/*.conf
|
@ -49,6 +49,23 @@ prepare_system() {
|
||||
fi
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
var_value="${var_value//\\/\\\\}"
|
||||
var_value="${var_value//[$'\n']/}"
|
||||
var_value="${var_value//\//\\/}"
|
||||
var_value="${var_value//./\\.}"
|
||||
var_value="${var_value//\*/\\*}"
|
||||
var_value="${var_value//^/\\^}"
|
||||
var_value="${var_value//\$/\\\$}"
|
||||
var_value="${var_value//\&/\\\&}"
|
||||
var_value="${var_value//\[/\\[}"
|
||||
var_value="${var_value//\[/\\]}"
|
||||
|
||||
echo $var_value
|
||||
}
|
||||
|
||||
update_config_var() {
|
||||
local config_path=$1
|
||||
local var_name=$2
|
||||
@ -81,8 +98,8 @@ update_config_var() {
|
||||
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
var_value=${var_value//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
var_value=$(escape_spec_char "$var_value")
|
||||
|
||||
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
|
||||
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
|
||||
@ -703,15 +720,17 @@ prepare_zbx_web_config() {
|
||||
echo "**** Zabbix related PHP configuration file not found"
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
server_name=${ZBX_SERVER_NAME//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
|
||||
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")
|
||||
server_pass=$(escape_spec_char "${DB_SERVER_ZBX_PASS}")
|
||||
|
||||
sed -i \
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_USER}/${DB_SERVER_ZBX_USER}/g" \
|
||||
-e "s/{DB_SERVER_PASS}/${DB_SERVER_ZBX_PASS}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
-e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \
|
||||
-e "s/{ZBX_SERVER_NAME}/$server_name/g" \
|
||||
|
@ -49,6 +49,23 @@ prepare_system() {
|
||||
fi
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
var_value="${var_value//\\/\\\\}"
|
||||
var_value="${var_value//[$'\n']/}"
|
||||
var_value="${var_value//\//\\/}"
|
||||
var_value="${var_value//./\\.}"
|
||||
var_value="${var_value//\*/\\*}"
|
||||
var_value="${var_value//^/\\^}"
|
||||
var_value="${var_value//\$/\\\$}"
|
||||
var_value="${var_value//\&/\\\&}"
|
||||
var_value="${var_value//\[/\\[}"
|
||||
var_value="${var_value//\[/\\]}"
|
||||
|
||||
echo $var_value
|
||||
}
|
||||
|
||||
update_config_var() {
|
||||
local config_path=$1
|
||||
local var_name=$2
|
||||
@ -81,8 +98,8 @@ update_config_var() {
|
||||
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
var_value=${var_value//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
var_value=$(escape_spec_char "$var_value")
|
||||
|
||||
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
|
||||
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
|
||||
@ -703,15 +720,17 @@ prepare_zbx_web_config() {
|
||||
echo "**** Zabbix related PHP configuration file not found"
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
server_name=${ZBX_SERVER_NAME//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
|
||||
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")
|
||||
server_pass=$(escape_spec_char "${DB_SERVER_ZBX_PASS}")
|
||||
|
||||
sed -i \
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_USER}/${DB_SERVER_ZBX_USER}/g" \
|
||||
-e "s/{DB_SERVER_PASS}/${DB_SERVER_ZBX_PASS}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
-e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \
|
||||
-e "s/{ZBX_SERVER_NAME}/$server_name/g" \
|
||||
|
@ -49,6 +49,23 @@ prepare_system() {
|
||||
fi
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
var_value="${var_value//\\/\\\\}"
|
||||
var_value="${var_value//[$'\n']/}"
|
||||
var_value="${var_value//\//\\/}"
|
||||
var_value="${var_value//./\\.}"
|
||||
var_value="${var_value//\*/\\*}"
|
||||
var_value="${var_value//^/\\^}"
|
||||
var_value="${var_value//\$/\\\$}"
|
||||
var_value="${var_value//\&/\\\&}"
|
||||
var_value="${var_value//\[/\\[}"
|
||||
var_value="${var_value//\[/\\]}"
|
||||
|
||||
echo $var_value
|
||||
}
|
||||
|
||||
update_config_var() {
|
||||
local config_path=$1
|
||||
local var_name=$2
|
||||
@ -81,8 +98,8 @@ update_config_var() {
|
||||
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
var_value=${var_value//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
var_value=$(escape_spec_char "$var_value")
|
||||
|
||||
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
|
||||
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
|
||||
@ -703,15 +720,17 @@ prepare_zbx_web_config() {
|
||||
echo "**** Zabbix related PHP configuration file not found"
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
server_name=${ZBX_SERVER_NAME//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
|
||||
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")
|
||||
server_pass=$(escape_spec_char "${DB_SERVER_ZBX_PASS}")
|
||||
|
||||
sed -i \
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_USER}/${DB_SERVER_ZBX_USER}/g" \
|
||||
-e "s/{DB_SERVER_PASS}/${DB_SERVER_ZBX_PASS}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
-e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \
|
||||
-e "s/{ZBX_SERVER_NAME}/$server_name/g" \
|
||||
|
@ -49,6 +49,23 @@ prepare_system() {
|
||||
fi
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
var_value="${var_value//\\/\\\\}"
|
||||
var_value="${var_value//[$'\n']/}"
|
||||
var_value="${var_value//\//\\/}"
|
||||
var_value="${var_value//./\\.}"
|
||||
var_value="${var_value//\*/\\*}"
|
||||
var_value="${var_value//^/\\^}"
|
||||
var_value="${var_value//\$/\\\$}"
|
||||
var_value="${var_value//\&/\\\&}"
|
||||
var_value="${var_value//\[/\\[}"
|
||||
var_value="${var_value//\[/\\]}"
|
||||
|
||||
echo $var_value
|
||||
}
|
||||
|
||||
update_config_var() {
|
||||
local config_path=$1
|
||||
local var_name=$2
|
||||
@ -81,8 +98,8 @@ update_config_var() {
|
||||
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
var_value=${var_value//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
var_value=$(escape_spec_char "$var_value")
|
||||
|
||||
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
|
||||
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
|
||||
@ -703,15 +720,17 @@ prepare_zbx_web_config() {
|
||||
echo "**** Zabbix related PHP configuration file not found"
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
server_name=${ZBX_SERVER_NAME//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
|
||||
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")
|
||||
server_pass=$(escape_spec_char "${DB_SERVER_ZBX_PASS}")
|
||||
|
||||
sed -i \
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_USER}/${DB_SERVER_ZBX_USER}/g" \
|
||||
-e "s/{DB_SERVER_PASS}/${DB_SERVER_ZBX_PASS}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
-e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \
|
||||
-e "s/{ZBX_SERVER_NAME}/$server_name/g" \
|
||||
|
@ -49,6 +49,23 @@ prepare_system() {
|
||||
fi
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
var_value="${var_value//\\/\\\\}"
|
||||
var_value="${var_value//[$'\n']/}"
|
||||
var_value="${var_value//\//\\/}"
|
||||
var_value="${var_value//./\\.}"
|
||||
var_value="${var_value//\*/\\*}"
|
||||
var_value="${var_value//^/\\^}"
|
||||
var_value="${var_value//\$/\\\$}"
|
||||
var_value="${var_value//\&/\\\&}"
|
||||
var_value="${var_value//\[/\\[}"
|
||||
var_value="${var_value//\[/\\]}"
|
||||
|
||||
echo $var_value
|
||||
}
|
||||
|
||||
update_config_var() {
|
||||
local config_path=$1
|
||||
local var_name=$2
|
||||
@ -81,8 +98,8 @@ update_config_var() {
|
||||
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
var_value=${var_value//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
var_value=$(escape_spec_char "$var_value")
|
||||
|
||||
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
|
||||
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
|
||||
@ -703,15 +720,17 @@ prepare_zbx_web_config() {
|
||||
echo "**** Zabbix related PHP configuration file not found"
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
server_name=${ZBX_SERVER_NAME//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
|
||||
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")
|
||||
server_pass=$(escape_spec_char "${DB_SERVER_ZBX_PASS}")
|
||||
|
||||
sed -i \
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_USER}/${DB_SERVER_ZBX_USER}/g" \
|
||||
-e "s/{DB_SERVER_PASS}/${DB_SERVER_ZBX_PASS}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
-e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \
|
||||
-e "s/{ZBX_SERVER_NAME}/$server_name/g" \
|
||||
|
@ -49,6 +49,23 @@ prepare_system() {
|
||||
fi
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
var_value="${var_value//\\/\\\\}"
|
||||
var_value="${var_value//[$'\n']/}"
|
||||
var_value="${var_value//\//\\/}"
|
||||
var_value="${var_value//./\\.}"
|
||||
var_value="${var_value//\*/\\*}"
|
||||
var_value="${var_value//^/\\^}"
|
||||
var_value="${var_value//\$/\\\$}"
|
||||
var_value="${var_value//\&/\\\&}"
|
||||
var_value="${var_value//\[/\\[}"
|
||||
var_value="${var_value//\[/\\]}"
|
||||
|
||||
echo $var_value
|
||||
}
|
||||
|
||||
update_config_var() {
|
||||
local config_path=$1
|
||||
local var_name=$2
|
||||
@ -81,8 +98,8 @@ update_config_var() {
|
||||
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
var_value=${var_value//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
var_value=$(escape_spec_char "$var_value")
|
||||
|
||||
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
|
||||
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
|
||||
@ -703,15 +720,17 @@ prepare_zbx_web_config() {
|
||||
echo "**** Zabbix related PHP configuration file not found"
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
server_name=${ZBX_SERVER_NAME//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
|
||||
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")
|
||||
server_pass=$(escape_spec_char "${DB_SERVER_ZBX_PASS}")
|
||||
|
||||
sed -i \
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_USER}/${DB_SERVER_ZBX_USER}/g" \
|
||||
-e "s/{DB_SERVER_PASS}/${DB_SERVER_ZBX_PASS}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
-e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \
|
||||
-e "s/{ZBX_SERVER_NAME}/$server_name/g" \
|
||||
|
@ -49,6 +49,23 @@ prepare_system() {
|
||||
fi
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
var_value="${var_value//\\/\\\\}"
|
||||
var_value="${var_value//[$'\n']/}"
|
||||
var_value="${var_value//\//\\/}"
|
||||
var_value="${var_value//./\\.}"
|
||||
var_value="${var_value//\*/\\*}"
|
||||
var_value="${var_value//^/\\^}"
|
||||
var_value="${var_value//\$/\\\$}"
|
||||
var_value="${var_value//\&/\\\&}"
|
||||
var_value="${var_value//\[/\\[}"
|
||||
var_value="${var_value//\[/\\]}"
|
||||
|
||||
echo $var_value
|
||||
}
|
||||
|
||||
update_config_var() {
|
||||
local config_path=$1
|
||||
local var_name=$2
|
||||
@ -81,8 +98,8 @@ update_config_var() {
|
||||
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
var_value=${var_value//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
var_value=$(escape_spec_char "$var_value")
|
||||
|
||||
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
|
||||
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
|
||||
@ -703,15 +720,17 @@ prepare_zbx_web_config() {
|
||||
echo "**** Zabbix related PHP configuration file not found"
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
server_name=${ZBX_SERVER_NAME//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
|
||||
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")
|
||||
server_pass=$(escape_spec_char "${DB_SERVER_ZBX_PASS}")
|
||||
|
||||
sed -i \
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_USER}/${DB_SERVER_ZBX_USER}/g" \
|
||||
-e "s/{DB_SERVER_PASS}/${DB_SERVER_ZBX_PASS}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
-e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \
|
||||
-e "s/{ZBX_SERVER_NAME}/$server_name/g" \
|
||||
|
@ -49,6 +49,23 @@ prepare_system() {
|
||||
fi
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
var_value="${var_value//\\/\\\\}"
|
||||
var_value="${var_value//[$'\n']/}"
|
||||
var_value="${var_value//\//\\/}"
|
||||
var_value="${var_value//./\\.}"
|
||||
var_value="${var_value//\*/\\*}"
|
||||
var_value="${var_value//^/\\^}"
|
||||
var_value="${var_value//\$/\\\$}"
|
||||
var_value="${var_value//\&/\\\&}"
|
||||
var_value="${var_value//\[/\\[}"
|
||||
var_value="${var_value//\[/\\]}"
|
||||
|
||||
echo $var_value
|
||||
}
|
||||
|
||||
update_config_var() {
|
||||
local config_path=$1
|
||||
local var_name=$2
|
||||
@ -81,8 +98,8 @@ update_config_var() {
|
||||
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
var_value=${var_value//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
var_value=$(escape_spec_char "$var_value")
|
||||
|
||||
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
|
||||
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
|
||||
@ -703,15 +720,17 @@ prepare_zbx_web_config() {
|
||||
echo "**** Zabbix related PHP configuration file not found"
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
server_name=${ZBX_SERVER_NAME//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
|
||||
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")
|
||||
server_pass=$(escape_spec_char "${DB_SERVER_ZBX_PASS}")
|
||||
|
||||
sed -i \
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_USER}/${DB_SERVER_ZBX_USER}/g" \
|
||||
-e "s/{DB_SERVER_PASS}/${DB_SERVER_ZBX_PASS}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
-e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \
|
||||
-e "s/{ZBX_SERVER_NAME}/$server_name/g" \
|
||||
|
@ -49,6 +49,23 @@ prepare_system() {
|
||||
fi
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
var_value="${var_value//\\/\\\\}"
|
||||
var_value="${var_value//[$'\n']/}"
|
||||
var_value="${var_value//\//\\/}"
|
||||
var_value="${var_value//./\\.}"
|
||||
var_value="${var_value//\*/\\*}"
|
||||
var_value="${var_value//^/\\^}"
|
||||
var_value="${var_value//\$/\\\$}"
|
||||
var_value="${var_value//\&/\\\&}"
|
||||
var_value="${var_value//\[/\\[}"
|
||||
var_value="${var_value//\[/\\]}"
|
||||
|
||||
echo $var_value
|
||||
}
|
||||
|
||||
update_config_var() {
|
||||
local config_path=$1
|
||||
local var_name=$2
|
||||
@ -81,8 +98,8 @@ update_config_var() {
|
||||
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
var_value=${var_value//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
var_value=$(escape_spec_char "$var_value")
|
||||
|
||||
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
|
||||
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
|
||||
@ -703,15 +720,17 @@ prepare_zbx_web_config() {
|
||||
echo "**** Zabbix related PHP configuration file not found"
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
server_name=${ZBX_SERVER_NAME//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
|
||||
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")
|
||||
server_pass=$(escape_spec_char "${DB_SERVER_ZBX_PASS}")
|
||||
|
||||
sed -i \
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_USER}/${DB_SERVER_ZBX_USER}/g" \
|
||||
-e "s/{DB_SERVER_PASS}/${DB_SERVER_ZBX_PASS}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
-e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \
|
||||
-e "s/{ZBX_SERVER_NAME}/$server_name/g" \
|
||||
|
@ -49,6 +49,23 @@ prepare_system() {
|
||||
fi
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
var_value="${var_value//\\/\\\\}"
|
||||
var_value="${var_value//[$'\n']/}"
|
||||
var_value="${var_value//\//\\/}"
|
||||
var_value="${var_value//./\\.}"
|
||||
var_value="${var_value//\*/\\*}"
|
||||
var_value="${var_value//^/\\^}"
|
||||
var_value="${var_value//\$/\\\$}"
|
||||
var_value="${var_value//\&/\\\&}"
|
||||
var_value="${var_value//\[/\\[}"
|
||||
var_value="${var_value//\[/\\]}"
|
||||
|
||||
echo $var_value
|
||||
}
|
||||
|
||||
update_config_var() {
|
||||
local config_path=$1
|
||||
local var_name=$2
|
||||
@ -81,8 +98,8 @@ update_config_var() {
|
||||
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
var_value=${var_value//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
var_value=$(escape_spec_char "$var_value")
|
||||
|
||||
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
|
||||
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
|
||||
@ -703,15 +720,17 @@ prepare_zbx_web_config() {
|
||||
echo "**** Zabbix related PHP configuration file not found"
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
server_name=${ZBX_SERVER_NAME//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
|
||||
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")
|
||||
server_pass=$(escape_spec_char "${DB_SERVER_ZBX_PASS}")
|
||||
|
||||
sed -i \
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_USER}/${DB_SERVER_ZBX_USER}/g" \
|
||||
-e "s/{DB_SERVER_PASS}/${DB_SERVER_ZBX_PASS}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
-e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \
|
||||
-e "s/{ZBX_SERVER_NAME}/$server_name/g" \
|
||||
|
@ -49,6 +49,23 @@ prepare_system() {
|
||||
fi
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
var_value="${var_value//\\/\\\\}"
|
||||
var_value="${var_value//[$'\n']/}"
|
||||
var_value="${var_value//\//\\/}"
|
||||
var_value="${var_value//./\\.}"
|
||||
var_value="${var_value//\*/\\*}"
|
||||
var_value="${var_value//^/\\^}"
|
||||
var_value="${var_value//\$/\\\$}"
|
||||
var_value="${var_value//\&/\\\&}"
|
||||
var_value="${var_value//\[/\\[}"
|
||||
var_value="${var_value//\[/\\]}"
|
||||
|
||||
echo $var_value
|
||||
}
|
||||
|
||||
update_config_var() {
|
||||
local config_path=$1
|
||||
local var_name=$2
|
||||
@ -81,8 +98,8 @@ update_config_var() {
|
||||
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
var_value=${var_value//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
var_value=$(escape_spec_char "$var_value")
|
||||
|
||||
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
|
||||
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
|
||||
@ -703,15 +720,17 @@ prepare_zbx_web_config() {
|
||||
echo "**** Zabbix related PHP configuration file not found"
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
server_name=${ZBX_SERVER_NAME//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
|
||||
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")
|
||||
server_pass=$(escape_spec_char "${DB_SERVER_ZBX_PASS}")
|
||||
|
||||
sed -i \
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_USER}/${DB_SERVER_ZBX_USER}/g" \
|
||||
-e "s/{DB_SERVER_PASS}/${DB_SERVER_ZBX_PASS}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
-e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \
|
||||
-e "s/{ZBX_SERVER_NAME}/$server_name/g" \
|
||||
|
@ -49,6 +49,23 @@ prepare_system() {
|
||||
fi
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
var_value="${var_value//\\/\\\\}"
|
||||
var_value="${var_value//[$'\n']/}"
|
||||
var_value="${var_value//\//\\/}"
|
||||
var_value="${var_value//./\\.}"
|
||||
var_value="${var_value//\*/\\*}"
|
||||
var_value="${var_value//^/\\^}"
|
||||
var_value="${var_value//\$/\\\$}"
|
||||
var_value="${var_value//\&/\\\&}"
|
||||
var_value="${var_value//\[/\\[}"
|
||||
var_value="${var_value//\[/\\]}"
|
||||
|
||||
echo $var_value
|
||||
}
|
||||
|
||||
update_config_var() {
|
||||
local config_path=$1
|
||||
local var_name=$2
|
||||
@ -81,8 +98,8 @@ update_config_var() {
|
||||
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
var_value=${var_value//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
var_value=$(escape_spec_char "$var_value")
|
||||
|
||||
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
|
||||
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
|
||||
@ -703,15 +720,17 @@ prepare_zbx_web_config() {
|
||||
echo "**** Zabbix related PHP configuration file not found"
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
server_name=${ZBX_SERVER_NAME//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
|
||||
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")
|
||||
server_pass=$(escape_spec_char "${DB_SERVER_ZBX_PASS}")
|
||||
|
||||
sed -i \
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_USER}/${DB_SERVER_ZBX_USER}/g" \
|
||||
-e "s/{DB_SERVER_PASS}/${DB_SERVER_ZBX_PASS}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
-e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \
|
||||
-e "s/{ZBX_SERVER_NAME}/$server_name/g" \
|
||||
|
@ -49,6 +49,23 @@ prepare_system() {
|
||||
fi
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
var_value="${var_value//\\/\\\\}"
|
||||
var_value="${var_value//[$'\n']/}"
|
||||
var_value="${var_value//\//\\/}"
|
||||
var_value="${var_value//./\\.}"
|
||||
var_value="${var_value//\*/\\*}"
|
||||
var_value="${var_value//^/\\^}"
|
||||
var_value="${var_value//\$/\\\$}"
|
||||
var_value="${var_value//\&/\\\&}"
|
||||
var_value="${var_value//\[/\\[}"
|
||||
var_value="${var_value//\[/\\]}"
|
||||
|
||||
echo $var_value
|
||||
}
|
||||
|
||||
update_config_var() {
|
||||
local config_path=$1
|
||||
local var_name=$2
|
||||
@ -81,8 +98,8 @@ update_config_var() {
|
||||
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
var_value=${var_value//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
var_value=$(escape_spec_char "$var_value")
|
||||
|
||||
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
|
||||
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
|
||||
@ -703,15 +720,17 @@ prepare_zbx_web_config() {
|
||||
echo "**** Zabbix related PHP configuration file not found"
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
server_name=${ZBX_SERVER_NAME//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
|
||||
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")
|
||||
server_pass=$(escape_spec_char "${DB_SERVER_ZBX_PASS}")
|
||||
|
||||
sed -i \
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_USER}/${DB_SERVER_ZBX_USER}/g" \
|
||||
-e "s/{DB_SERVER_PASS}/${DB_SERVER_ZBX_PASS}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
-e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \
|
||||
-e "s/{ZBX_SERVER_NAME}/$server_name/g" \
|
||||
|
@ -49,6 +49,23 @@ prepare_system() {
|
||||
fi
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
var_value="${var_value//\\/\\\\}"
|
||||
var_value="${var_value//[$'\n']/}"
|
||||
var_value="${var_value//\//\\/}"
|
||||
var_value="${var_value//./\\.}"
|
||||
var_value="${var_value//\*/\\*}"
|
||||
var_value="${var_value//^/\\^}"
|
||||
var_value="${var_value//\$/\\\$}"
|
||||
var_value="${var_value//\&/\\\&}"
|
||||
var_value="${var_value//\[/\\[}"
|
||||
var_value="${var_value//\[/\\]}"
|
||||
|
||||
echo $var_value
|
||||
}
|
||||
|
||||
update_config_var() {
|
||||
local config_path=$1
|
||||
local var_name=$2
|
||||
@ -81,8 +98,8 @@ update_config_var() {
|
||||
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
var_value=${var_value//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
var_value=$(escape_spec_char "$var_value")
|
||||
|
||||
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
|
||||
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
|
||||
@ -703,15 +720,17 @@ prepare_zbx_web_config() {
|
||||
echo "**** Zabbix related PHP configuration file not found"
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
server_name=${ZBX_SERVER_NAME//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
|
||||
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")
|
||||
server_pass=$(escape_spec_char "${DB_SERVER_ZBX_PASS}")
|
||||
|
||||
sed -i \
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_USER}/${DB_SERVER_ZBX_USER}/g" \
|
||||
-e "s/{DB_SERVER_PASS}/${DB_SERVER_ZBX_PASS}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
-e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \
|
||||
-e "s/{ZBX_SERVER_NAME}/$server_name/g" \
|
||||
|
@ -49,6 +49,23 @@ prepare_system() {
|
||||
fi
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
var_value="${var_value//\\/\\\\}"
|
||||
var_value="${var_value//[$'\n']/}"
|
||||
var_value="${var_value//\//\\/}"
|
||||
var_value="${var_value//./\\.}"
|
||||
var_value="${var_value//\*/\\*}"
|
||||
var_value="${var_value//^/\\^}"
|
||||
var_value="${var_value//\$/\\\$}"
|
||||
var_value="${var_value//\&/\\\&}"
|
||||
var_value="${var_value//\[/\\[}"
|
||||
var_value="${var_value//\[/\\]}"
|
||||
|
||||
echo $var_value
|
||||
}
|
||||
|
||||
update_config_var() {
|
||||
local config_path=$1
|
||||
local var_name=$2
|
||||
@ -81,8 +98,8 @@ update_config_var() {
|
||||
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
var_value=${var_value//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
var_value=$(escape_spec_char "$var_value")
|
||||
|
||||
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
|
||||
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
|
||||
@ -703,15 +720,17 @@ prepare_zbx_web_config() {
|
||||
echo "**** Zabbix related PHP configuration file not found"
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
server_name=${ZBX_SERVER_NAME//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
|
||||
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")
|
||||
server_pass=$(escape_spec_char "${DB_SERVER_ZBX_PASS}")
|
||||
|
||||
sed -i \
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_USER}/${DB_SERVER_ZBX_USER}/g" \
|
||||
-e "s/{DB_SERVER_PASS}/${DB_SERVER_ZBX_PASS}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
-e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \
|
||||
-e "s/{ZBX_SERVER_NAME}/$server_name/g" \
|
||||
|
@ -49,6 +49,23 @@ prepare_system() {
|
||||
fi
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
var_value="${var_value//\\/\\\\}"
|
||||
var_value="${var_value//[$'\n']/}"
|
||||
var_value="${var_value//\//\\/}"
|
||||
var_value="${var_value//./\\.}"
|
||||
var_value="${var_value//\*/\\*}"
|
||||
var_value="${var_value//^/\\^}"
|
||||
var_value="${var_value//\$/\\\$}"
|
||||
var_value="${var_value//\&/\\\&}"
|
||||
var_value="${var_value//\[/\\[}"
|
||||
var_value="${var_value//\[/\\]}"
|
||||
|
||||
echo $var_value
|
||||
}
|
||||
|
||||
update_config_var() {
|
||||
local config_path=$1
|
||||
local var_name=$2
|
||||
@ -81,8 +98,8 @@ update_config_var() {
|
||||
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
var_value=${var_value//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
var_value=$(escape_spec_char "$var_value")
|
||||
|
||||
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
|
||||
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
|
||||
@ -703,15 +720,17 @@ prepare_zbx_web_config() {
|
||||
echo "**** Zabbix related PHP configuration file not found"
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
server_name=${ZBX_SERVER_NAME//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
|
||||
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")
|
||||
server_pass=$(escape_spec_char "${DB_SERVER_ZBX_PASS}")
|
||||
|
||||
sed -i \
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_USER}/${DB_SERVER_ZBX_USER}/g" \
|
||||
-e "s/{DB_SERVER_PASS}/${DB_SERVER_ZBX_PASS}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
-e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \
|
||||
-e "s/{ZBX_SERVER_NAME}/$server_name/g" \
|
||||
|
@ -49,6 +49,23 @@ prepare_system() {
|
||||
fi
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
var_value="${var_value//\\/\\\\}"
|
||||
var_value="${var_value//[$'\n']/}"
|
||||
var_value="${var_value//\//\\/}"
|
||||
var_value="${var_value//./\\.}"
|
||||
var_value="${var_value//\*/\\*}"
|
||||
var_value="${var_value//^/\\^}"
|
||||
var_value="${var_value//\$/\\\$}"
|
||||
var_value="${var_value//\&/\\\&}"
|
||||
var_value="${var_value//\[/\\[}"
|
||||
var_value="${var_value//\[/\\]}"
|
||||
|
||||
echo $var_value
|
||||
}
|
||||
|
||||
update_config_var() {
|
||||
local config_path=$1
|
||||
local var_name=$2
|
||||
@ -81,8 +98,8 @@ update_config_var() {
|
||||
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
var_value=${var_value//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
var_value=$(escape_spec_char "$var_value")
|
||||
|
||||
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
|
||||
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
|
||||
@ -703,15 +720,17 @@ prepare_zbx_web_config() {
|
||||
echo "**** Zabbix related PHP configuration file not found"
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
server_name=${ZBX_SERVER_NAME//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
|
||||
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")
|
||||
server_pass=$(escape_spec_char "${DB_SERVER_ZBX_PASS}")
|
||||
|
||||
sed -i \
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_USER}/${DB_SERVER_ZBX_USER}/g" \
|
||||
-e "s/{DB_SERVER_PASS}/${DB_SERVER_ZBX_PASS}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
-e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \
|
||||
-e "s/{ZBX_SERVER_NAME}/$server_name/g" \
|
||||
|
@ -49,6 +49,23 @@ prepare_system() {
|
||||
fi
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
var_value="${var_value//\\/\\\\}"
|
||||
var_value="${var_value//[$'\n']/}"
|
||||
var_value="${var_value//\//\\/}"
|
||||
var_value="${var_value//./\\.}"
|
||||
var_value="${var_value//\*/\\*}"
|
||||
var_value="${var_value//^/\\^}"
|
||||
var_value="${var_value//\$/\\\$}"
|
||||
var_value="${var_value//\&/\\\&}"
|
||||
var_value="${var_value//\[/\\[}"
|
||||
var_value="${var_value//\[/\\]}"
|
||||
|
||||
echo $var_value
|
||||
}
|
||||
|
||||
update_config_var() {
|
||||
local config_path=$1
|
||||
local var_name=$2
|
||||
@ -81,8 +98,8 @@ update_config_var() {
|
||||
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
var_value=${var_value//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
var_value=$(escape_spec_char "$var_value")
|
||||
|
||||
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
|
||||
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
|
||||
@ -703,15 +720,17 @@ prepare_zbx_web_config() {
|
||||
echo "**** Zabbix related PHP configuration file not found"
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
server_name=${ZBX_SERVER_NAME//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
|
||||
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")
|
||||
server_pass=$(escape_spec_char "${DB_SERVER_ZBX_PASS}")
|
||||
|
||||
sed -i \
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_USER}/${DB_SERVER_ZBX_USER}/g" \
|
||||
-e "s/{DB_SERVER_PASS}/${DB_SERVER_ZBX_PASS}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
-e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \
|
||||
-e "s/{ZBX_SERVER_NAME}/$server_name/g" \
|
||||
|
@ -49,6 +49,23 @@ prepare_system() {
|
||||
fi
|
||||
}
|
||||
|
||||
escape_spec_char() {
|
||||
local var_value=$1
|
||||
|
||||
var_value="${var_value//\\/\\\\}"
|
||||
var_value="${var_value//[$'\n']/}"
|
||||
var_value="${var_value//\//\\/}"
|
||||
var_value="${var_value//./\\.}"
|
||||
var_value="${var_value//\*/\\*}"
|
||||
var_value="${var_value//^/\\^}"
|
||||
var_value="${var_value//\$/\\\$}"
|
||||
var_value="${var_value//\&/\\\&}"
|
||||
var_value="${var_value//\[/\\[}"
|
||||
var_value="${var_value//\[/\\]}"
|
||||
|
||||
echo $var_value
|
||||
}
|
||||
|
||||
update_config_var() {
|
||||
local config_path=$1
|
||||
local var_name=$2
|
||||
@ -81,8 +98,8 @@ update_config_var() {
|
||||
var_value=$ZABBIX_USER_HOME_DIR/enc/$var_value
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
var_value=${var_value//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
var_value=$(escape_spec_char "$var_value")
|
||||
|
||||
if [ "$(grep -E "^$var_name=" $config_path)" ] && [ "$is_multiple" != "true" ]; then
|
||||
sed -i -e "/^$var_name=/s/=.*/=$var_value/" "$config_path"
|
||||
@ -703,15 +720,17 @@ prepare_zbx_web_config() {
|
||||
echo "**** Zabbix related PHP configuration file not found"
|
||||
fi
|
||||
|
||||
# Escaping "/" character in parameter value
|
||||
server_name=${ZBX_SERVER_NAME//\//\\/}
|
||||
# Escaping characters in parameter value
|
||||
server_name=$(escape_spec_char "${ZBX_SERVER_NAME}")
|
||||
server_user=$(escape_spec_char "${DB_SERVER_ZBX_USER}")
|
||||
server_pass=$(escape_spec_char "${DB_SERVER_ZBX_PASS}")
|
||||
|
||||
sed -i \
|
||||
-e "s/{DB_SERVER_HOST}/${DB_SERVER_HOST}/g" \
|
||||
-e "s/{DB_SERVER_PORT}/${DB_SERVER_PORT}/g" \
|
||||
-e "s/{DB_SERVER_DBNAME}/${DB_SERVER_DBNAME}/g" \
|
||||
-e "s/{DB_SERVER_USER}/${DB_SERVER_ZBX_USER}/g" \
|
||||
-e "s/{DB_SERVER_PASS}/${DB_SERVER_ZBX_PASS}/g" \
|
||||
-e "s/{DB_SERVER_USER}/$server_user/g" \
|
||||
-e "s/{DB_SERVER_PASS}/$server_pass/g" \
|
||||
-e "s/{ZBX_SERVER_HOST}/${ZBX_SERVER_HOST}/g" \
|
||||
-e "s/{ZBX_SERVER_PORT}/${ZBX_SERVER_PORT}/g" \
|
||||
-e "s/{ZBX_SERVER_NAME}/$server_name/g" \
|
||||
|
Loading…
Reference in New Issue
Block a user