收集 Snort 日志

支持的平台:

本文档介绍了如何使用 Bindplane 将 Snort 日志收集到 Google 安全运营团队。解析器会尝试使用 grok 模式来提取相关字段,以处理两种不同的 Snort 日志格式(SYSLOG + JSON)。根据识别出的格式,该模型会进一步处理数据,将提取的字段映射到统一数据模型 (UDM) 架构,对值进行标准化,并使用其他上下文丰富输出。

准备工作

  • 确保您有一个 Google Security Operations 实例。
  • 确保您使用的是 Windows 2016 或更高版本,或者使用了带有 systemd 的 Linux 主机。
  • 如果在代理后面运行,请确保防火墙端口处于打开状态。
  • 确保您拥有对 Snort 的超级用户访问权限。

获取 Google SecOps 提取身份验证文件

  1. 登录 Google SecOps 控制台。
  2. 依次前往 SIEM 设置 > 收集代理
  3. 下载提取身份验证文件。将该文件安全地保存在将安装 BindPlane 的系统上。

获取 Google SecOps 客户 ID

  1. 登录 Google SecOps 控制台。
  2. 依次选择 SIEM 设置 > 配置文件
  3. 复制并保存组织详细信息部分中的客户 ID

安装 Bindplane 代理

Windows 安装

  1. 以管理员身份打开命令提示符PowerShell
  2. 运行以下命令:

    msiexec /i "https://github.com/observIQ/bindplane-agent/releases/latest/download/observiq-otel-collector.msi" /quiet
    

Linux 安装

  1. 打开具有 root 或 sudo 权限的终端。
  2. 运行以下命令:

    sudo sh -c "$(curl -fsSlL https://github.com/observiq/bindplane-agent/releases/latest/download/install_unix.sh)" install_unix.sh
    

其他安装资源

  • 如需了解其他安装选项,请参阅此安装指南

配置 Bindplane 代理以注入 Syslog 并将其发送到 Google SecOps

  1. 访问配置文件:

    1. 找到 config.yaml 文件。通常,在 Linux 上,该目录位于 /etc/bindplane-agent/ 目录中;在 Windows 上,该目录位于安装目录中。
    2. 使用文本编辑器(例如 nanovi 或记事本)打开该文件。
  2. 按如下方式修改 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
    
  3. 根据基础架构中的需要替换端口和 IP 地址。

  4. <customer_id> 替换为实际的客户 ID。

  5. 获取 Google SecOps 提取身份验证文件部分中,将 /path/to/ingestion-authentication-file.json 更新为身份验证文件的保存路径。

重启 Bindplane 代理以应用更改

  • 如需在 Linux 中重启 Bindplane 代理,请运行以下命令:

    sudo systemctl restart bindplane-agent
    
  • 如需在 Windows 中重启 Bindplane 代理,您可以使用服务控制台,也可以输入以下命令:

    net stop BindPlaneAgent && net start BindPlaneAgent
    

在 Snort v2.x 上配置 Syslog 导出

  1. 使用终端登录 Snort 设备。
  2. 修改以下文件:/etc/snort/snort.conf
  3. 转到 6) Configure output plugins
  4. 添加以下条目:

    # syslog
    output alert_syslog: host=BINDPLANE_IP_ADDRESS:PORT_NUMBER, LOG_AUTH LOG_ALERT
    
  5. 替换以下内容:

    • BINDPLANE_IP_ADDRESS: Bindplane Agent IP address.
    • PORT_NUMBER: Bindplane Agent port number.
  6. 保存文件。

  7. 启动 snort 服务。

  8. 停止 rsyslog 服务。

  9. 修改以下文件:/etc/rsyslogd.conf

    # remote host is: name/ip:port
    *.* @@BINDPLANE_IP_ADDRESS:PORT_NUMBER
    
  10. 替换以下内容:

    • BINDPLANE_IP_ADDRESS: Bindplane Agent IP address.
    • PORT_NUMBER: Bindplane Agent port number.
  11. 启动 rsyslog 服务。

在 Snort v3.1.53 上配置 Syslog 导出

  1. 使用终端登录 Snort 设备。
  2. 停止 rsyslogsnort 服务。
  3. 前往以下 Snort 安装目录:/usr/local/etc/snort/
  4. 修改以下 Snort 配置文件:snort.lua

  5. 配置输出选项中,附加以下代码(您可以使用任何设施和级别):

    alert_syslog =
      {
        facility = 'local3',
        level = 'info',
      }
    
  6. 保存 Snort 配置文件。

  7. 前往 rsyslog 服务默认配置文件目录:/etc/rsyslog.d

  8. 创建一个新文件:3-snort.conf

    # cd /etc/rsyslog.d
    # vi 3-snort.conf
    
  9. 如需通过 TCP 或 UDP 发送日志,请添加以下配置:local3.* @@BINDPLANE_IP_ADDRESS:PORT_NUMBER

  10. 替换以下内容:

    • BINDPLANE_IP_ADDRESS: Bindplane agent IP address.
    • PORT_NUMBER: Bindplane agent port number.
  11. 保存文件。

  12. 启动 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_protodnssmbhttp,请转换为大写形式并使用该值。否则,请将其设置为 UNKNOWN_APPLICATION_PROTOCOL
类别 security_result.category 如果 categorytrojan-activity,请设置为 NETWORK_MALICIOUS。如果 categorypolicy-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 字段提取的值,并转换为整数。
时间 用于设置事件时间戳。
is_alert 如果 alert.severity 为 1,则设置为 true,否则不映射。
is_significant 如果 alert.severity 为 1,则设置为 true,否则不映射。
metadata.event_type 一律设置为 SCAN_NETWORK
metadata.log_type 已硬编码为 SNORT_IDS
metadata.product_name 已硬编码为 SNORT_IDS
metadata.vendor_name 已硬编码为 SNORT
security_result.action 如果 alert.actionallowed,则设置为 ALLOW,否则设置为 UNKNOWN_ACTION

变化

2024-12-04

增强功能

  • 添加了 Grok 模式来处理 SYSLOG 格式日志。
  • 如果 net_proto 的值为 Tcp,则将 network.ip_protocol 的值设置为 TCP

2024-11-21

增强功能

  • 添加了 Grok 模式来处理 SYSLOG 格式日志。

2022-09-22

增强功能

  • 为字段“agent.hostname”添加了 on_error 条件,以解析未解析的日志。

2022-07-05

增强功能

  • 添加了 Grok 模式来处理 syslog 格式日志。

需要更多帮助?向社区成员和 Google SecOps 专业人士寻求解答。