收集 Snort IDS 日志
本文档介绍了如何使用 Bindplane 代理将 Snort IDS 日志注入到 Google Security Operations。
Snort 是一种开源的入侵检测和防御系统,可针对网络入侵提醒、协议分析事件和流量异常生成 syslog 消息。解析器使用 grok 模式从 syslog 格式和 JSON 格式的日志中提取字段,并将这些字段映射到统一数据模型 (UDM)。
准备工作
请确保满足以下前提条件:
- Google SecOps 实例
- Windows Server 2016 或更高版本,或者具有
systemd的 Linux 主机 - Bindplane 代理与 Snort 设备之间的网络连接
- 如果在代理后面运行,请确保防火墙端口已根据 Bindplane 代理要求打开
- 对 Snort 设备的终端访问权限
获取 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该服务应显示为 正在运行。
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 /opt/observiq-otel-collector/config.yamlWindows:
notepad "C:\Program Files\observIQ OpenTelemetry Collector\config.yaml"
修改配置文件
将
config.yaml的全部内容替换为以下配置:receivers: udplog: listen_address: "0.0.0.0:514" exporters: chronicle/snort_ids: compression: gzip creds_file_path: '/etc/bindplane-agent/ingestion-auth.json' customer_id: '<customer_id>' endpoint: malachiteingestion-pa.googleapis.com log_type: SNORT_IDS raw_log_field: body service: pipelines: logs/snort_ids_to_chronicle: receivers: - udplog exporters: - chronicle/snort_ids
配置参数
替换以下占位符:
接收器配置:
listen_address:要监听的 IP 地址和端口:0.0.0.0侦听所有接口(推荐)- 端口
514是标准 syslog 端口(在 Linux 上需要 root 权限;对于非 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:从 Google SecOps 控制台复制的客户 IDendpoint:区域端点网址:- 美国:
malachiteingestion-pa.googleapis.com - 欧洲:
europe-malachiteingestion-pa.googleapis.com - 亚洲:
asia-southeast1-malachiteingestion-pa.googleapis.com - 如需查看完整列表,请参阅区域级端点
- 美国:
保存配置文件
- 修改后,保存文件:
- Linux:依次按
Ctrl+O、Enter和Ctrl+X - Windows:依次点击文件 > 保存
- Linux:依次按
重启 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"
- 按
在 Snort v2.x 上配置 syslog 导出
- 使用终端登录 Snort 设备。
- 修改以下文件:
/etc/snort/snort.conf。 - 转到
6) Configure output plugins。 添加以下条目:
# syslog output alert_syslog: host=<BINDPLANE_IP>:<PORT_NUMBER>, LOG_AUTH LOG_ALERT- 将
<BINDPLANE_IP>替换为 Bindplane 代理 IP 地址,并将<PORT_NUMBER>替换为端口号。
- 将
保存文件。
启动 snort 服务。
停止 rsyslog 服务。
修改以下文件:
/etc/rsyslogd.conf:# remote host is: name/ip:port *.* @@<BINDPLANE_IP>:<PORT_NUMBER>- 将
<BINDPLANE_IP>替换为 Bindplane 代理 IP 地址,并将<PORT_NUMBER>替换为端口号。
- 将
启动 rsyslog 服务。
在 Snort v3.1.53 上配置 syslog 导出
- 使用终端登录 Snort 设备。
- 停止 rsyslog 和 snort 服务。
- 前往 Snort 安装目录:
/usr/local/etc/snort/。 - 修改 Snort 配置文件:
snort.lua。 在配置输出选项中,附加以下代码:
alert_syslog = { facility = 'local3', level = 'info', }保存 Snort 配置文件。
前往 rsyslog 服务默认配置文件目录:
/etc/rsyslog.d。创建新文件:
3-snort.conf。如需通过 TCP 或 UDP 发送日志,请添加以下配置:
local3.* @@<BINDPLANE_IP>:<PORT_NUMBER>- 将
<BINDPLANE_IP>替换为 Bindplane 代理 IP 地址,并将<PORT_NUMBER>替换为端口号。
- 将
保存文件。
启动 rsyslog,然后启动 snort 服务。
UDM 映射表
| 日志字段 | UDM 映射 | 逻辑 |
|---|---|---|
| agent.hostname | observer.hostname | 从原始日志的 agent.hostname 字段中获取的值。 |
| agent.id | observer.asset_id | 从原始日志中的 agent.id 字段获取的值,并与 agent.type 连接,如下所示:agent.type:agent.id。 |
| agent.type | observer.application | 从原始日志的 agent.type 字段中获取的值。 |
| agent.version | observer.platform_version | 从原始日志的 agent.version 字段中获取的值。 |
| alert.category | security_result.category_details | 从原始日志的 alert.category 字段中获取的值。 |
| alert.rev | security_result.rule_version | 从原始日志的 alert.rev 字段中获取的值。 |
| alert.rule | security_result.summary | 从原始日志的 alert.rule 字段中提取的值(不含英文双引号)。 |
| alert.severity | security_result.severity | 如果 alert.severity 大于或等于 4,则设置为 LOW。如果 alert.severity 为 2 或 3,则设置为 MEDIUM。如果 alert.severity 为 1,则设置为 HIGH。否则,设置为 UNKNOWN_SEVERITY。 |
| alert.signature | security_result.rule_name | 从原始日志的 alert.signature 字段中获取的值。 |
| alert.signature_id | security_result.rule_id | 从原始日志的 alert.signature_id 字段中获取的值。 |
| app_proto | network.application_protocol | 如果 app_proto 为 dns、smb 或 http,则转换为大写并使用该值。否则,请将其设置为 UNKNOWN_APPLICATION_PROTOCOL。 |
| 类别 | security_result.category | 如果 category 为 trojan-activity,则设置为 NETWORK_MALICIOUS。如果 category 为 policy-violation,则设置为 POLICY_VIOLATION。否则,设置为 UNKNOWN_CATEGORY。 |
| classtype | security_result.rule_type | 如果原始日志中的 classtype 字段不为空或不为 unknown,则取自该字段的值。 |
| community_id | network.community_id | 从原始日志的 community_id 字段中获取的值。 |
| date_log | 用于在 time 字段为空时设置事件时间戳。 |
|
| 降序 | metadata.description | 从原始日志的 desc 字段中获取的值。 |
| dest_ip | target.ip | 从原始日志的 dest_ip 字段中获取的值。 |
| dest_port | target.port | 从原始日志的 dest_port 字段中获取的值,并转换为整数。 |
| dstport | target.port | 从原始日志的 dstport 字段中获取的值,并转换为整数。 |
| file.filename | security_result.about.file.full_path | 如果原始日志中的 file.filename 字段不为空或不为 /,则取自该字段的值。 |
| file.size | security_result.about.file.size | 从原始日志的 file.size 字段中获取的值,并转换为无符号整数。 |
| host.name | principal.hostname | 从原始日志的 host.name 字段中获取的值。 |
| 主机名 | principal.hostname | 从原始日志的 hostname 字段中获取的值。 |
| inter_host | intermediary.hostname | 从原始日志的 inter_host 字段中获取的值。 |
| log.file.path | principal.process.file.full_path | 从原始日志的 log.file.path 字段中获取的值。 |
| metadata.version | metadata.product_version | 从原始日志的 metadata.version 字段中获取的值。 |
| proto | network.ip_protocol | 从原始日志的 proto 字段中获取的值。如果该值为数字,则使用对照表将其转换为相应的 IP 协议名称。 |
| rule_name | security_result.rule_name | 从原始日志的 rule_name 字段中获取的值。 |
| signature_id | security_result.rule_id | 从原始日志的 signature_id 字段中获取的值。 |
| signature_rev | security_result.rule_version | 从原始日志的 signature_rev 字段中获取的值。 |
| src_ip | principal.ip | 从原始日志的 src_ip 字段中获取的值。 |
| src_port | principal.port | 从原始日志的 src_port 字段中获取的值,并转换为整数。 |
| srcport | principal.port | 从原始日志的 srcport 字段中获取的值,并转换为整数。 |
| 时间 | 用于设置事件时间戳。 | |
| metadata.event_type | 一律设置为 SCAN_NETWORK |
|
| metadata.log_type | 硬编码为 SNORT_IDS。 |
|
| metadata.product_name | 硬编码为 SNORT_IDS。 |
|
| metadata.vendor_name | 硬编码为 SNORT。 |
|
| security_result.action | 如果 alert.action 为 allowed,则设置为 ALLOW;否则,设置为 UNKNOWN_ACTION。 |