收集 H3C Comware 平台交换机日志
本文档介绍了如何使用 Bindplane 将 H3C Comware 平台交换机日志注入到 Google Security Operations。
H3C Comware 平台交换机是企业级网络交换机,可通过 Comware 操作系统提供第 2 层和第 3 层交换功能、高级安全功能和全面的网络管理。交换机通过信息中心功能支持广泛的日志记录功能,可用于监控网络运行、安全事件和系统诊断。
准备工作
请确保满足以下前提条件:
- Google SecOps 实例
- Windows Server 2016 或更高版本,或者具有
systemd的 Linux 主机 - Bindplane 代理与 H3C Comware 平台交换机之间的网络连接
- 如果在代理后面运行,请确保防火墙端口根据 Bindplane 代理要求处于开放状态
- 通过控制台、Telnet 或 SSH 对 H3C Comware 平台交换机管理控制台的特权访问
- 已启用信息中心功能的 H3C Comware 平台交换机(默认启用)
获取 Google SecOps 注入身份验证文件
- 登录 Google SecOps 控制台。
- 依次前往 SIEM 设置 > 收集代理。
- 下载注入身份验证文件。将文件安全地保存在将要安装 Bindplane 的系统上。
获取 Google SecOps 客户 ID
- 登录 Google SecOps 控制台。
- 依次前往 SIEM 设置 > 配置文件。
- 复制并保存组织详细信息部分中的客户 ID。
安装 Bindplane 代理
按照以下说明在 Windows 或 Linux 操作系统上安装 Bindplane 代理。
Windows 安装
- 以管理员身份打开命令提示符或 PowerShell。
运行以下命令:
msiexec /i "https://github.com/observIQ/bindplane-agent/releases/latest/download/observiq-otel-collector.msi" /quiet等待安装完成。
运行以下命令来验证安装:
sc query observiq-otel-collector
该服务应显示为 RUNNING。
Linux 安装
- 打开具有 root 或 sudo 权限的终端。
运行以下命令:
sudo sh -c "$(curl -fsSlL https://github.com/observiq/bindplane-agent/releases/latest/download/install_unix.sh)" install_unix.sh等待安装完成。
运行以下命令来验证安装:
sudo systemctl status observiq-otel-collector
该服务应显示为有效(正在运行)。
其他安装资源
如需了解其他安装选项和问题排查信息,请参阅 Bindplane 代理安装指南。
配置 Bindplane 代理以注入 syslog 并将其发送到 Google SecOps
找到配置文件
Linux:
sudo nano /etc/bindplane-agent/config.yamlWindows:
notepad "C:\Program Files\observIQ OpenTelemetry Collector\config.yaml"
修改配置文件
将
config.yaml的全部内容替换为以下配置:receivers: udplog: listen_address: "0.0.0.0:514" exporters: chronicle/h3c_switch: compression: gzip creds_file_path: '/etc/bindplane-agent/ingestion-auth.json' customer_id: 'YOUR_CUSTOMER_ID' endpoint: malachiteingestion-pa.googleapis.com log_type: H3C_SWITCH raw_log_field: body ingestion_labels: env: production service: pipelines: logs/h3c_to_chronicle: receivers: - udplog exporters: - chronicle/h3c_switch
配置参数
替换以下占位符:
接收器配置:
listen_address:设置为0.0.0.0:514可在 UDP 端口 51 上监听所有接口。如果您在 Linux 上以非 root 身份运行,则可以使用其他端口,例如1514。
导出器配置:
creds_file_path:提取身份验证文件的完整路径:- Linux:
/etc/bindplane-agent/ingestion-auth.json - Windows:
C:\Program Files\observIQ OpenTelemetry Collector\ingestion-auth.json
- Linux:
customer_id:将YOUR_CUSTOMER_ID替换为上一步中的客户 ID。endpoint:区域端点网址:- 美国:
malachiteingestion-pa.googleapis.com - 欧洲:
europe-malachiteingestion-pa.googleapis.com - 亚洲:
asia-southeast1-malachiteingestion-pa.googleapis.com - 如需查看完整列表,请参阅区域级端点
- 美国:
log_type:设置为H3C_SWITCH,与所示完全一致。ingestion_labels:采用 YAML 格式的可选标签(例如env: production)。
保存配置文件
修改后,保存文件:
- Linux:依次按
Ctrl+O、Enter和Ctrl+X - Windows:依次点击文件 > 保存
重启 Bindplane 代理以应用更改
如需在 Linux 中重启 Bindplane 代理,请运行以下命令:
sudo systemctl restart observiq-otel-collector验证服务是否正在运行:
sudo systemctl status observiq-otel-collector检查日志是否存在错误:
sudo journalctl -u observiq-otel-collector -f
如需在 Windows 中重启 Bindplane 代理,请选择以下选项之一:
以管理员身份运行命令提示符或 PowerShell:
net stop observiq-otel-collector && net start observiq-otel-collector服务控制台:
- 按
Win+R,输入services.msc,然后按 Enter 键。 - 找到 observIQ OpenTelemetry 收集器。
右键点击并选择重新启动。
验证服务是否正在运行:
sc query observiq-otel-collector检查日志是否存在错误:
type "C:\Program Files\observIQ OpenTelemetry Collector\log\collector.log"
- 按
配置 H3C Comware 平台交换机 syslog 转发
配置 H3C Comware 平台交换机以将 syslog 消息发送到 Bindplane 代理。
访问交换机 CLI
- 使用以下方法之一登录 H3C Comware 平台交换机:
- 控制台端口连接
- Telnet
- SSH
输入以下命令,进入系统视图:
<H3C> system-view
提示会变为 [H3C],表示您处于系统视图中。
验证信息中心是否已启用
信息中心在 H3C Comware 平台交换机上默认处于启用状态。如需验证或启用信息中心,请输入以下命令:
[H3C] info-center enable如果信息中心已启用,系统会显示:
Info: Information center is enabled.
配置时间戳格式(可选)
发送到日志主机的系统信息的默认时间戳格式为日期。如需配置时间戳格式,请使用以下命令:
[H3C] info-center timestamp loghost date可用的时间戳格式:
date:格式为“Mmm dd hh:mm:ss:ms yyyy”(例如 Dec 8 10:12:21:708 2012)iso:ISO 8601 格式(例如 2012-09-21T15:32:55)no-year-date:不含年份的当前系统日期和时间none:无时间戳信息
配置日志主机
将 Bindplane 代理主机指定为日志主机。设施参数可以设置为 local0 到 local7,默认值为 local7。
[H3C] info-center loghost BINDPLANE_AGENT_IP port 514 facility local7将
BINDPLANE_AGENT_IP替换为运行 Bindplane 代理的主机的 IP 地址。例如,如果 Bindplane 代理在主机 192.168.1.100 上运行,则:
[H3C] info-center loghost 192.168.1.100 port 514 facility local7参数:
BINDPLANE_AGENT_IP:Bindplane 代理主机 IP 地址port 514:UDP 端口号(必须与 Bindplane 代理中配置的端口一致)facility local7:Syslog facility(local0 到 local7 均有效;默认值为 local7)
配置源接口(可选)
只有在通过 info-center enable 命令启用信息中心后,info-center loghost source 命令才会生效。如需为日志消息指定来源接口,请执行以下操作:
[H3C] info-center loghost source INTERFACE_TYPE INTERFACE_NUMBER例如,如需使用 VLAN 接口 1 作为来源,请执行以下操作:
[H3C] info-center loghost source vlan-interface 1
停用默认日志输出到日志主机
默认情况下,系统会将所有模块的信息输出到日志宿主。如需控制哪些模块发送日志,请先停用默认输出:
[H3C] undo info-center source default loghost
配置日志输出规则
配置哪些模块和严重级别应将日志发送到日志宿主。系统信息按严重程度从 0 到 7 降序分为 8 个级别。该开关会输出严重程度高于或等于指定级别的系统信息。例如,如果您配置的输出规则的严重程度值为 6(信息性),则严重程度值介于 0 到 6 之间的信息将输出。
严重级别(0-7):
- 0:紧急情况
- 1:提醒
- 2:严重
- 3:错误
- 4:警告
- 5:通知
- 6:信息
- 7:调试
如需为所有模块配置信息级别或更高级别的日志输出,请执行以下操作:
[H3C] info-center source default loghost level informational如需为特定模块(例如 ARP 和 IP)配置日志输出,请执行以下操作:
[H3C] info-center source arp loghost level informational [H3C] info-center source ip loghost level informational如需查看可用的源模块,请使用以下命令:
[H3C] info-center source ?
保存配置
保存配置,以确保在重新启动后配置保持不变:
[H3C] save当系统提示您确认时,输入
Y进行确认。
验证配置
如需验证信息中心配置,请使用以下命令:
[H3C] display info-center
此命令会显示当前信息中心配置,包括日志主机设置、输出规则和渠道配置。
完整配置示例
以下示例展示了将所有模块中信息级别或更高级别的日志发送到 192.168.1.100 的日志主机的完整配置:
<H3C> system-view [H3C] info-center enable [H3C] info-center timestamp loghost date [H3C] info-center loghost 192.168.1.100 port 514 facility local7 [H3C] undo info-center source default loghost [H3C] info-center source default loghost level informational [H3C] save
特定模块的配置示例
以下示例展示了如何配置以将信息级别的 ARP 和 IP 模块日志发送到日志主机:
<H3C> system-view [H3C] info-center enable [H3C] info-center loghost 192.168.1.100 port 514 facility local7 [H3C] undo info-center source default loghost [H3C] info-center source arp loghost level informational [H3C] info-center source ip loghost level informational [H3C] save
UDM 映射表
| 日志字段 | UDM 映射 | 逻辑 |
|---|---|---|
| extensions.auth.type | 事件中使用的身份验证类型 | |
| 主机名 | intermediary.asset.hostname | 与中介相关联的资产的主机名 |
| 主机名 | intermediary.hostname | 中介实体的主机名 |
| inter_ip | intermediary.asset.ip | 与中介机构相关联的资产的 IP 地址 |
| inter_ip | intermediary.ip | 中介实体的 IP 地址 |
| IPAddr、prin_ip | principal.asset.ip | 与正文相关联的资产的 IP 地址 |
| IPAddr、prin_ip | principal.ip | 主实体的 IP 地址 |
| prin_port | principal.port | 与正文关联的端口号 |
| 用户、用户 | principal.user.userid | 主账号的用户 ID |
| tar_host | target.asset.hostname | 与目标相关联的资产的主机名 |
| tar_host | target.hostname | 目标实体的主机名 |
| tar_ip | target.asset.ip | 与目标相关联的资产的 IP 地址 |
| tar_ip | target.ip | 目标实体的 IP 地址 |
| tar_port | target.port | 与目标相关联的端口号 |
| tar_user | target.user.userid | 目标的相应用户 ID |
| Line、OperateType、OperateTime、OperateState、OperateEndTime、EventIndex、CommandSource、ConfigSource、ConfigDestination | additional.fields | 标准 UDM 字段未涵盖的其他元数据字段 |
| 降序 | metadata.description | 事件的说明 |
| 时间戳 | metadata.event_timestamp | 事件发生时的时间戳 |
| metadata.event_type | 活动类型(例如,USER_LOGIN、NETWORK_CONNECTION) | |
| event_type | metadata.product_event_type | 特定于产品的事件类型标识符 |
| metadata.product_name | 生成事件的产品的名称 | |
| metadata.vendor_name | 商品的供应商名称 |
需要更多帮助?获得社区成员和 Google SecOps 专业人士的解答。