mirror of
https://github.com/zabbix/zabbix-docker.git
synced 2024-11-28 10:43:10 +01:00
Fixed possible injection of traps in trap receiver
This commit is contained in:
parent
734ddd0c56
commit
076f7bee2c
@ -44,4 +44,19 @@ done
|
|||||||
|
|
||||||
[[ "$ZBX_SNMP_TRAP_USE_DNS" == "true" ]] && ! [[ ${host} =~ \[(.*?)\].*\-\> ]] && sender_addr=$host
|
[[ "$ZBX_SNMP_TRAP_USE_DNS" == "true" ]] && ! [[ ${host} =~ \[(.*?)\].*\-\> ]] && sender_addr=$host
|
||||||
|
|
||||||
|
# Header in Zabbix format shouldn't exist anywhere in vars, it is injection
|
||||||
|
# Must exit with 0
|
||||||
|
date_regex=$(echo "$ZBX_SNMP_TRAP_DATE_FORMAT" | sed -e 's/^+//g' \
|
||||||
|
-e 's/%Y/[0-9]\{4\}/g' \
|
||||||
|
-e 's/%m/[0-9]\{2\}/g' \
|
||||||
|
-e 's/%d/[0-9]\{2\}/g' \
|
||||||
|
-e 's/%T/[0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}/g' \
|
||||||
|
-e 's/%z/[\+\-][0-9]\{4\}/g' \
|
||||||
|
-e 's/%H/[0-9]\{2\}/g' \
|
||||||
|
-e 's/%M/[0-9]\{2\}/g' \
|
||||||
|
-e 's/%S/[0-9]\{2\}/g')
|
||||||
|
|
||||||
|
zbx_trap_regex="$date_regex ZBXTRAP"
|
||||||
|
echo "$vars" | grep -qE "$zbx_trap_regex" && exit 0
|
||||||
|
|
||||||
echo -e "$date ZBXTRAP $sender_addr$ZBX_SNMP_TRAP_FORMAT$sender$ZBX_SNMP_TRAP_FORMAT$vars" >> $ZABBIX_TRAPS_FILE
|
echo -e "$date ZBXTRAP $sender_addr$ZBX_SNMP_TRAP_FORMAT$sender$ZBX_SNMP_TRAP_FORMAT$vars" >> $ZABBIX_TRAPS_FILE
|
||||||
|
@ -44,4 +44,19 @@ done
|
|||||||
|
|
||||||
[[ "$ZBX_SNMP_TRAP_USE_DNS" == "true" ]] && ! [[ ${host} =~ \[(.*?)\].*\-\> ]] && sender_addr=$host
|
[[ "$ZBX_SNMP_TRAP_USE_DNS" == "true" ]] && ! [[ ${host} =~ \[(.*?)\].*\-\> ]] && sender_addr=$host
|
||||||
|
|
||||||
|
# Header in Zabbix format shouldn't exist anywhere in vars, it is injection
|
||||||
|
# Must exit with 0
|
||||||
|
date_regex=$(echo "$ZBX_SNMP_TRAP_DATE_FORMAT" | sed -e 's/^+//g' \
|
||||||
|
-e 's/%Y/[0-9]\{4\}/g' \
|
||||||
|
-e 's/%m/[0-9]\{2\}/g' \
|
||||||
|
-e 's/%d/[0-9]\{2\}/g' \
|
||||||
|
-e 's/%T/[0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}/g' \
|
||||||
|
-e 's/%z/[\+\-][0-9]\{4\}/g' \
|
||||||
|
-e 's/%H/[0-9]\{2\}/g' \
|
||||||
|
-e 's/%M/[0-9]\{2\}/g' \
|
||||||
|
-e 's/%S/[0-9]\{2\}/g')
|
||||||
|
|
||||||
|
zbx_trap_regex="$date_regex ZBXTRAP"
|
||||||
|
echo "$vars" | grep -qE "$zbx_trap_regex" && exit 0
|
||||||
|
|
||||||
echo -e "$date ZBXTRAP $sender_addr$ZBX_SNMP_TRAP_FORMAT$sender$ZBX_SNMP_TRAP_FORMAT$vars" >> $ZABBIX_TRAPS_FILE
|
echo -e "$date ZBXTRAP $sender_addr$ZBX_SNMP_TRAP_FORMAT$sender$ZBX_SNMP_TRAP_FORMAT$vars" >> $ZABBIX_TRAPS_FILE
|
||||||
|
@ -44,4 +44,19 @@ done
|
|||||||
|
|
||||||
[[ "$ZBX_SNMP_TRAP_USE_DNS" == "true" ]] && ! [[ ${host} =~ \[(.*?)\].*\-\> ]] && sender_addr=$host
|
[[ "$ZBX_SNMP_TRAP_USE_DNS" == "true" ]] && ! [[ ${host} =~ \[(.*?)\].*\-\> ]] && sender_addr=$host
|
||||||
|
|
||||||
|
# Header in Zabbix format shouldn't exist anywhere in vars, it is injection
|
||||||
|
# Must exit with 0
|
||||||
|
date_regex=$(echo "$ZBX_SNMP_TRAP_DATE_FORMAT" | sed -e 's/^+//g' \
|
||||||
|
-e 's/%Y/[0-9]\{4\}/g' \
|
||||||
|
-e 's/%m/[0-9]\{2\}/g' \
|
||||||
|
-e 's/%d/[0-9]\{2\}/g' \
|
||||||
|
-e 's/%T/[0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}/g' \
|
||||||
|
-e 's/%z/[\+\-][0-9]\{4\}/g' \
|
||||||
|
-e 's/%H/[0-9]\{2\}/g' \
|
||||||
|
-e 's/%M/[0-9]\{2\}/g' \
|
||||||
|
-e 's/%S/[0-9]\{2\}/g')
|
||||||
|
|
||||||
|
zbx_trap_regex="$date_regex ZBXTRAP"
|
||||||
|
echo "$vars" | grep -qE "$zbx_trap_regex" && exit 0
|
||||||
|
|
||||||
echo -e "$date ZBXTRAP $sender_addr$ZBX_SNMP_TRAP_FORMAT$sender$ZBX_SNMP_TRAP_FORMAT$vars" >> $ZABBIX_TRAPS_FILE
|
echo -e "$date ZBXTRAP $sender_addr$ZBX_SNMP_TRAP_FORMAT$sender$ZBX_SNMP_TRAP_FORMAT$vars" >> $ZABBIX_TRAPS_FILE
|
||||||
|
@ -44,4 +44,19 @@ done
|
|||||||
|
|
||||||
[[ "$ZBX_SNMP_TRAP_USE_DNS" == "true" ]] && ! [[ ${host} =~ \[(.*?)\].*\-\> ]] && sender_addr=$host
|
[[ "$ZBX_SNMP_TRAP_USE_DNS" == "true" ]] && ! [[ ${host} =~ \[(.*?)\].*\-\> ]] && sender_addr=$host
|
||||||
|
|
||||||
|
# Header in Zabbix format shouldn't exist anywhere in vars, it is injection
|
||||||
|
# Must exit with 0
|
||||||
|
date_regex=$(echo "$ZBX_SNMP_TRAP_DATE_FORMAT" | sed -e 's/^+//g' \
|
||||||
|
-e 's/%Y/[0-9]\{4\}/g' \
|
||||||
|
-e 's/%m/[0-9]\{2\}/g' \
|
||||||
|
-e 's/%d/[0-9]\{2\}/g' \
|
||||||
|
-e 's/%T/[0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}/g' \
|
||||||
|
-e 's/%z/[\+\-][0-9]\{4\}/g' \
|
||||||
|
-e 's/%H/[0-9]\{2\}/g' \
|
||||||
|
-e 's/%M/[0-9]\{2\}/g' \
|
||||||
|
-e 's/%S/[0-9]\{2\}/g')
|
||||||
|
|
||||||
|
zbx_trap_regex="$date_regex ZBXTRAP"
|
||||||
|
echo "$vars" | grep -qE "$zbx_trap_regex" && exit 0
|
||||||
|
|
||||||
echo -e "$date ZBXTRAP $sender_addr$ZBX_SNMP_TRAP_FORMAT$sender$ZBX_SNMP_TRAP_FORMAT$vars" >> $ZABBIX_TRAPS_FILE
|
echo -e "$date ZBXTRAP $sender_addr$ZBX_SNMP_TRAP_FORMAT$sender$ZBX_SNMP_TRAP_FORMAT$vars" >> $ZABBIX_TRAPS_FILE
|
||||||
|
@ -44,4 +44,19 @@ done
|
|||||||
|
|
||||||
[[ "$ZBX_SNMP_TRAP_USE_DNS" == "true" ]] && ! [[ ${host} =~ \[(.*?)\].*\-\> ]] && sender_addr=$host
|
[[ "$ZBX_SNMP_TRAP_USE_DNS" == "true" ]] && ! [[ ${host} =~ \[(.*?)\].*\-\> ]] && sender_addr=$host
|
||||||
|
|
||||||
|
# Header in Zabbix format shouldn't exist anywhere in vars, it is injection
|
||||||
|
# Must exit with 0
|
||||||
|
date_regex=$(echo "$ZBX_SNMP_TRAP_DATE_FORMAT" | sed -e 's/^+//g' \
|
||||||
|
-e 's/%Y/[0-9]\{4\}/g' \
|
||||||
|
-e 's/%m/[0-9]\{2\}/g' \
|
||||||
|
-e 's/%d/[0-9]\{2\}/g' \
|
||||||
|
-e 's/%T/[0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}/g' \
|
||||||
|
-e 's/%z/[\+\-][0-9]\{4\}/g' \
|
||||||
|
-e 's/%H/[0-9]\{2\}/g' \
|
||||||
|
-e 's/%M/[0-9]\{2\}/g' \
|
||||||
|
-e 's/%S/[0-9]\{2\}/g')
|
||||||
|
|
||||||
|
zbx_trap_regex="$date_regex ZBXTRAP"
|
||||||
|
echo "$vars" | grep -qE "$zbx_trap_regex" && exit 0
|
||||||
|
|
||||||
echo -e "$date ZBXTRAP $sender_addr$ZBX_SNMP_TRAP_FORMAT$sender$ZBX_SNMP_TRAP_FORMAT$vars" >> $ZABBIX_TRAPS_FILE
|
echo -e "$date ZBXTRAP $sender_addr$ZBX_SNMP_TRAP_FORMAT$sender$ZBX_SNMP_TRAP_FORMAT$vars" >> $ZABBIX_TRAPS_FILE
|
||||||
|
Loading…
Reference in New Issue
Block a user