安全的移动访问

本页面介绍了确保 Zabbix 移动应用和 Zabbix bridge adapter 安全的最佳实践。

保护移动设备

为防止他人打开您移动设备上的应用,请在应用的 设置 中启用应用锁。

如果设备丢失或遭到入侵,请在 Zabbix 前端中将其移除。 这会撤销并移除设备的访问凭据,因此该设备将无法再访问 Zabbix。 根据您的用户角色权限,您可以在以下部分移除设备:

  • 用户设置 > 设备 - 任何用户都可以移除自己的设备(需要 管理自己的设备 权限)。
  • 用户 > 设备 - 超级管理员 可以移除任何用户的设备(需要 管理用户设备 权限)。

您还可以限制移动设备可以访问的 Zabbix 部分。 为此,请为用户分配一个仅授予应用所需权限的用户角色。 所需的最小权限如下:

部分 配置
访问 UI 元素 清除所有复选框。
访问服务 将 对服务的读写访问权限 和 对服务的只读访问权限 设置为 None。
访问模块 清除所有复选框。
访问 API 清除 已启用 复选框。
访问操作 清除所有复选框。

若要允许用户在应用中更新问题,还需勾选其所需的操作:
- 添加问题评论
- 更改严重性
- 确认问题
- 抑制问题
- 关闭问题
- 创建和编辑自己的媒介

请注意,用户可以在应用中看到的问题还取决于其对主机的访问权限。
设备 勾选 已启用 复选框。

若要允许用户添加和移除自己的移动设备,还需勾选 管理自己的设备 复选框;否则,超级管理员 必须在 用户 > 设备 中管理其设备。

保护 Zabbix bridge adapter

Zabbix bridge adapter 将其数据(状态文件和加密密钥)存储在 Zabbix bridge adapter 配置文件中 DataDir 参数指定的目录中。 确保该目录具有 0700 权限,并且其中存储的所有文件都具有 0600 权限。

Zabbix bridge adapter 将移动设备的请求传递给 Zabbix API。 要限制可通过 Zabbix bridge adapter 调用的 API 方法,请使用其 AllowedAPIMethods 参数。 例如,仅允许移动应用所需的最小方法集;如果不希望使用移动应用的某些功能,也可以允许更少的方法(例如,如果移动应用用户不应更新问题,请不要允许使用 event.acknowledge)。

Encrypt connections between components

If Zabbix bridge adapter, Zabbix server, and Zabbix frontend (which provides Zabbix API) are installed on separate systems, it is recommended to encrypt the data flow between them. This section provides guidance for securing these connections:

  • From Zabbix server to Zabbix bridge adapter
  • From Zabbix bridge adapter to Zabbix frontend (API)

This section does not describe how to manage certificates. For general guidance, see Encryption using certificates.

TLS from Zabbix server to Zabbix bridge adapter

Zabbix server uses the URL specified in its BridgeAdapterURL parameter to connect to Zabbix bridge adapter. The bridge adapter uses its TLSConfig.Mode parameter to determine which connections it accepts:

  • none (default) - only unencrypted connections. BridgeAdapterURL must use http://.
  • tls - only encrypted connections; the bridge adapter presents its certificate to Zabbix server. BridgeAdapterURL must use https://.
  • mtls - in addition to tls, the bridge adapter verifies the client certificate of Zabbix server.

To configure tls:

1. Choose which CA will issue the Zabbix bridge adapter certificate:

  • The CA that issued the certificates already in use by Zabbix server - choose this if Zabbix server uses certificate-based encryption with Zabbix proxies or agents (its TLSCAFile, TLSCertFile, and TLSKeyFile parameters are set).
  • A CA whose certificate is in the CA store of the operating system where Zabbix server is installed (e.g., a public CA).
  • Any other CA (e.g., a private CA of your organization).

2. If you chose any other CA in step 1, prepare the following files on the system where Zabbix server is installed, all in PEM format:

  • A CA file with the certificate of the chosen CA.
  • A certificate (or certificate chain) for the server, issued by the chosen CA.
  • A private key for the server; make sure that it is readable only by the user that runs it (typically, zabbix).

3. Edit the Zabbix server configuration file:

BridgeAdapterURL=https://zabbix-bridge-adapter.example.com:10054/rpc

# If you chose any other CA in step 1 (already set if you chose the CA already in use by Zabbix server):
TLSCAFile=/etc/zabbix/certs/zabbix_ca_file.crt
TLSCertFile=/etc/zabbix/certs/zabbix_server.crt
TLSKeyFile=/etc/zabbix/certs/zabbix_server.key

4. On the system where Zabbix bridge adapter is installed, prepare the following files, all in PEM format:

  • A certificate (or certificate chain) for the bridge adapter, issued by the chosen CA; make sure that its Subject Alternative Name (SAN) extension contains the host name or IP address from Zabbix server's BridgeAdapterURL.
  • A private key for the bridge adapter; make sure that it is readable only by the user that runs it (typically, zabbix-bridge-adapter).

5. Edit the Zabbix bridge adapter configuration file:

TLSConfig.Mode=tls
TLSConfig.CertFile=/etc/zabbix/certs/zabbix_bridge_adapter.crt
TLSConfig.KeyFile=/etc/zabbix/certs/zabbix_bridge_adapter.key

6. Restart Zabbix bridge adapter:

systemctl restart zabbix-bridge-adapter

7. Restart Zabbix server. For example (see other options):

systemctl restart zabbix-server

To configure mtls:

1. Choose which CA will issue the certificates of Zabbix server and Zabbix bridge adapter:

2. If you chose any other CA in step 1, prepare the following files on the system where Zabbix server is installed, all in PEM format:

  • A CA file with the certificate of the chosen CA.
  • A certificate (or certificate chain) for the server, issued by the chosen CA.
  • A private key for the server; make sure that it is readable only by the user that runs it (typically, zabbix).

3. Edit the Zabbix server configuration file:

BridgeAdapterURL=https://zabbix-bridge-adapter.example.com:10054/rpc

# Already set if you chose the CA already in use by Zabbix server:
TLSCAFile=/etc/zabbix/certs/zabbix_ca_file.crt
TLSCertFile=/etc/zabbix/certs/zabbix_server.crt
TLSKeyFile=/etc/zabbix/certs/zabbix_server.key

4. On the system where Zabbix bridge adapter is installed, prepare the following files, all in PEM format:

  • A CA file with the certificate of the chosen CA (even if it is a public CA, because the bridge adapter does not use the CA store of the operating system).
  • A certificate (or certificate chain) for the bridge adapter, issued by the chosen CA; make sure that its Subject Alternative Name (SAN) extension contains the host name or IP address from Zabbix server's BridgeAdapterURL.
  • A private key for the bridge adapter; make sure that it is readable only by the user that runs it (typically, zabbix-bridge-adapter).

5. Edit the Zabbix bridge adapter configuration file:

TLSConfig.Mode=mtls
TLSConfig.CertFile=/etc/zabbix/certs/zabbix_bridge_adapter.crt
TLSConfig.KeyFile=/etc/zabbix/certs/zabbix_bridge_adapter.key
TLSConfig.CAFile=/etc/zabbix/certs/zabbix_ca_file.crt

# Common Name (CN) of the Zabbix server certificate (exact, case-sensitive match; SANs are not checked):
TLSConfig.AllowedCN=zabbix-server

6. Restart Zabbix bridge adapter:

systemctl restart zabbix-bridge-adapter

7. Restart Zabbix server. For example (see other options):

systemctl restart zabbix-server

TLS from Zabbix bridge adapter to Zabbix API

Zabbix bridge adapter uses the URL specified in its ZabbixAPIURL parameter to connect to Zabbix API. The bridge adapter uses its ZabbixAPITLSConnect parameter to determine how strictly it verifies the Zabbix frontend certificate:

  • disabled - the connection is not encrypted. Only with this option, ZabbixAPIURL must use http://.
  • required (default) - the connection is encrypted, but the bridge adapter accepts any certificate.
  • verify_ca - the connection is encrypted, and the certificate must be issued by a CA from the ZabbixAPITLSCAFile file.
  • verify_full - the connection is encrypted, the certificate must be issued by a CA from the ZabbixAPITLSCAFile file, and the host name in ZabbixAPIURL must match the certificate.

To configure required, verify_ca, or verify_full:

1. On the system where Zabbix frontend is installed, make sure that:

  • Zabbix frontend is served over HTTPS (see Setting up SSL for Zabbix frontend).
  • For verify_full, the Subject Alternative Name (SAN) extension of the Zabbix frontend certificate contains the host name or IP address from the bridge adapter's ZabbixAPIURL.

2. For verify_ca and verify_full, on the system where Zabbix bridge adapter is installed, prepare a PEM file with the CA certificate that issued the Zabbix frontend certificate.

  • If the Zabbix frontend certificate is self-signed, the file contains the Zabbix frontend certificate itself.
  • If the Zabbix frontend certificate is issued by a public CA, the file can be the CA bundle of the operating system (e.g., /etc/ssl/certs/ca-certificates.crt on Ubuntu). The bridge adapter uses CA certificates only from this file, not from the CA store of the operating system.
  • Make sure that the PEM file is readable by the user that runs the bridge adapter (typically, zabbix-bridge-adapter).

3. Edit the Zabbix bridge adapter configuration file:

ZabbixAPIURL=https://zabbix.example.com/zabbix/api_jsonrpc.php

# For required, verify_ca, or verify_full:
ZabbixAPITLSConnect=verify_full

# For verify_ca or verify_full:
ZabbixAPITLSCAFile=/etc/zabbix/certs/zabbix_api_ca.crt

4. Restart Zabbix bridge adapter:

systemctl restart zabbix-bridge-adapter