安全最佳实践

概述

本节介绍以安全方式设置 Zabbix 的最佳实践。

本节中的实践并非 Zabbix 正常运行所必需,但建议采用,以提高系统安全性。

有关确保 Zabbix 移动应用和 Zabbix bridge adapter 安全的最佳实践,请参阅安全的移动访问。

UTF-8 编码

Zabbix 仅支持 UTF-8 编码。 已知它可以正常工作,且不存在任何安全缺陷。 用户应注意,如果使用其他某些编码,已知会存在安全问题。

Windows 安装程序路径

在使用 Windows 安装程序时,建议使用安装程序提供的默认路径。 如果在没有适当权限的情况下使用自定义路径,可能会危及安装的安全性。

用户自定义全局脚本中的宏

为增强安全性,建议在用户自定义全局脚本中使用宏函数而不是普通宏,因为宏不会自动转义。

Zabbix 安全公告和 CVE 数据库

请参阅 Zabbix 安全公告和 CVE 数据库。

HTML 电子邮件模板

创建或编辑用于 HTML 电子邮件的消息模板时,始终使用 htmlencode() 宏函数包装每个宏。 例如:

<b>Problem started</b> at {{EVENT.TIME}.htmlencode()} on {{EVENT.DATE}.htmlencode()}<br><b>Problem name:</b>
{{EVENT.NAME}.htmlencode()}<br><b>Host:</b> {{HOST.NAME}.htmlencode()}
<br><b>Severity:</b>
{{EVENT.SEVERITY}.htmlencode()}<br><b>Operational
data:</b> {{EVENT.OPDATA}.htmlencode()}<br><b>Original problem ID:</b> {{EVENT.ID}.htmlencode()}<br>{{TRIGGER.URL}.htmlencode()}

使用 htmlencode() 可确保宏值中的任何 HTML 字符都经过转义,并防止将 HTML 注入通知中(例如,攻击者在通知中插入恶意链接或钓鱼链接)。

注意:Zabbix 提供的默认 HTML 电子邮件消息已经对宏应用了 htmlencode()。 在编辑现有模板或创建新模板时,都应遵循此指导原则——在使用模板发送 HTML 电子邮件之前,请确认宏已进行编码。

Frontend connections to Zabbix server

To enhance security, it is recommended to allow frontend connections to Zabbix server only from known addresses. To do so, in the FrontendAllowedIP parameter of the server configuration file (zabbix_server.conf), list the IP addresses, CIDR ranges, or DNS names from which Zabbix frontend is allowed to connect, then restart Zabbix server. By default, this parameter is not set, and frontend connections are accepted from any address.

It is also recommended to encrypt these connections; see Secure connection between frontend and server.