收集 Snort 日志
本文档介绍如何使用 Bindplane 将 Snort 日志收集到 Google Security Operations。解析器尝试使用 grok
模式处理两种不同的 Snort 日志格式 (SYSLOG + JSON),以提取相关字段。根据识别出的格式,它会进一步处理数据,将提取的字段映射到统一数据模型 (UDM) 架构,对值进行归一化处理,并使用其他上下文信息丰富输出。
准备工作
- 确保您拥有 Google Security Operations 实例。
- 确保您使用的是 Windows 2016 或更高版本,或者具有
systemd
的 Linux 主机。 - 如果通过代理运行,请确保防火墙端口处于开放状态。
- 确保您拥有对 Snort 的特权访问权限。
获取 Google SecOps 注入身份验证文件
- 登录 Google SecOps 控制台。
- 依次前往 SIEM 设置 > 收集代理。
- 下载注入身份验证文件。将文件安全地保存在将要安装 Bindplane 的系统上。
获取 Google SecOps 客户 ID
- 登录 Google SecOps 控制台。
- 依次前往 SIEM 设置 > 配置文件。
- 复制并保存组织详细信息部分中的客户 ID。
安装 Bindplane 代理
Windows 安装
- 以管理员身份打开命令提示符或 PowerShell。
运行以下命令:
msiexec /i "https://github.com/observIQ/bindplane-agent/releases/latest/download/observiq-otel-collector.msi" /quiet
Linux 安装
- 打开具有 root 或 sudo 权限的终端。
运行以下命令:
sudo sh -c "$(curl -fsSlL https://github.com/observiq/bindplane-agent/releases/latest/download/install_unix.sh)" install_unix.sh
其他安装资源
- 如需了解其他安装选项,请参阅此安装指南。
配置 Bindplane 代理以注入 Syslog 并将其发送到 Google SecOps
访问配置文件:
- 找到
config.yaml
文件。通常,它位于 Linux 上的/etc/bindplane-agent/
目录中或 Windows 上的安装目录中。 - 使用文本编辑器(例如
nano
、vi
或记事本)打开该文件。
- 找到
按如下方式修改
config.yaml
文件:receivers: udplog: # Replace the port and IP address as required listen_address: "0.0.0.0:514" exporters: chronicle/chronicle_w_labels: compression: gzip # Adjust the path to the credentials file you downloaded in Step 1 creds: '/path/to/ingestion-authentication-file.json' # Replace with your actual customer ID from Step 2 customer_id: <customer_id> endpoint: malachiteingestion-pa.googleapis.com # Add optional ingestion labels for better organization ingestion_labels: log_type: SNORT_IDS raw_log_field: body service: pipelines: logs/source0__chronicle_w_labels-0: receivers: - udplog exporters: - chronicle/chronicle_w_labels
根据基础架构的需要替换端口和 IP 地址。
将
<customer_id>
替换为实际的客户 ID。将
/path/to/ingestion-authentication-file.json
更新为获取 Google SecOps 提取身份验证文件部分中保存身份验证文件的路径。
重启 Bindplane 代理以应用更改
如需在 Linux 中重启 Bindplane 代理,请运行以下命令:
sudo systemctl restart bindplane-agent
如需在 Windows 中重启 Bindplane 代理,您可以使用服务控制台,也可以输入以下命令:
net stop BindPlaneAgent && net start BindPlaneAgent
在 Snort v2.x 上配置 syslog 导出
- 使用终端登录 Snort 设备。
- 修改以下文件:
/etc/snort/snort.conf
- 转到
6) Configure output plugins
。 添加以下条目:
# syslog output alert_syslog: host=BINDPLANE_IP_ADDRESS:PORT_NUMBER, LOG_AUTH LOG_ALERT
替换以下内容:
- BINDPLANE_IP_ADDRESS: Bindplane Agent IP address.
- PORT_NUMBER: Bindplane Agent port number.
保存文件。
启动 snort 服务。
停止 rsyslog 服务。
修改以下文件:
/etc/rsyslogd.conf
# remote host is: name/ip:port *.* @@BINDPLANE_IP_ADDRESS:PORT_NUMBER
替换以下内容:
- BINDPLANE_IP_ADDRESS: Bindplane Agent IP address.
- PORT_NUMBER: Bindplane Agent 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
:# cd /etc/rsyslog.d # vi 3-snort.conf
如需通过 TCP 或 UDP 发送日志,请添加以下配置:
local3.* @@BINDPLANE_IP_ADDRESS:PORT_NUMBER
替换以下内容:
- BINDPLANE_IP_ADDRESS: Bindplane agent IP address.
- PORT_NUMBER: Bindplane agent 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 。 |
需要更多帮助?从社区成员和 Google SecOps 专业人士那里获得解答。