From fd114369e9bebc5031af83a90adc97edba3c6693 Mon Sep 17 00:00:00 2001 From: tteckster Date: Tue, 11 Jun 2024 13:50:59 -0400 Subject: [PATCH] Update zabbix-install.sh Escape Special Characters --- install/zabbix-install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/install/zabbix-install.sh b/install/zabbix-install.sh index 31416f1d..e70bbed9 100644 --- a/install/zabbix-install.sh +++ b/install/zabbix-install.sh @@ -31,7 +31,8 @@ msg_info "Setting up PostgreSQL" $STD apt-get install -y postgresql DB_NAME=zabbixdb DB_USER=zabbix -DB_PASS="$(openssl rand -base64 18 | cut -c1-13)" +RAW_PASS="$(openssl rand -base64 18 | cut -c1-13)" +DB_PASS=$(printf '%s\n' "$RAW_PASS" | sed 's/[&/\]/\\&/g') $STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';" $STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;" $STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';"