收集 Apple macOS syslog 数据

支持的平台:

此解析器使用 Grok 模式从 Apple macOS syslog 消息中提取字段,并使用提取的值(包括时间戳、主机名、中间主机、命令行、进程 ID 和说明)填充统一数据模型 (UDM)。如果存在主机名,解析器会将事件归类为 STATUS_UPDATE;否则,它会为事件分配类别 GENERIC_EVENT。最后,解析器会使用供应商和产品信息丰富 UDM 事件。

准备工作

  • 确保您有一个 Google Security Operations 实例。
  • 确保您拥有对受审核主机的 root 访问权限。
  • 确保您已在受审核的主机上安装 rsyslog。
  • 确保您使用的是 Windows 2012 SP2 或更高版本,或者使用了 systemd 的 Linux 主机。
  • 如果在代理后面运行,请确保防火墙端口处于打开状态。

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

  1. 登录 Google SecOps 控制台。
  2. 依次前往 SIEM 设置 > 收集代理
  3. 下载提取身份验证文件

获取 Google SecOps 客户 ID

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

安装 BindPlane Agent

  1. 对于 Windows 安装,请运行以下脚本:
    msiexec /i "https://github.com/observIQ/bindplane-agent/releases/latest/download/observiq-otel-collector.msi" /quiet
  2. 对于 Linux 安装,请运行以下脚本:
    sudo sh -c "$(curl -fsSlL https://github.com/observiq/bindplane-agent/releases/latest/download/install_unix.sh)" install_unix.sh
  3. 如需了解其他安装选项,请参阅此安装指南

配置 BindPlane Agent 以提取 Syslog 并将其发送到 Google SecOps

  1. 访问安装了 BindPlane 的机器。
  2. 按如下方式修改 config.yaml 文件:

    receivers:
      tcplog:
        # Replace the below port <54525> and IP <0.0.0.0> with your specific values
        listen_address: "0.0.0.0:54525" 
    
    exporters:
        chronicle/chronicle_w_labels:
            compression: gzip
            # Adjust the creds location below according the placement of the credentials file you downloaded
            creds: '{ json file for creds }'
            # Replace <customer_id> below with your actual ID that you copied
            customer_id: <customer_id>
            endpoint: malachiteingestion-pa.googleapis.com
            # You can apply ingestion labels below as preferred
            ingestion_labels:
            log_type: SYSLOG
            namespace: auditd
            raw_log_field: body
    service:
        pipelines:
            logs/source0__chronicle_w_labels-0:
                receivers:
                    - tcplog
                exporters:
                    - chronicle/chronicle_w_labels
    
  3. 使用以下命令重启 BindPlane Agent 以应用更改:sudo systemctl bindplane restart

从 macOS 导出 Syslog

  1. 使用 Homebrew 安装 syslog-ng

    brew install syslog-ng
    
  2. 配置 syslog-ng:

    • 修改 syslog-ng.conf 文件(通常位于 /usr/local/etc/syslog-ng/syslog-ng.conf):
    sudo vi /usr/local/etc/syslog-ng/syslog-ng.conf
    
    • 添加以下配置块。
      • 根据 BindPlane 配置,您可以将传送方法更改为 tcp,也可以将其保留为 udp
      • <BindPlaneAgent_IP><BindPlaneAgent_Port> 替换为 BindPlane Agent 的实际 IP 地址和端口:
    source s_local { system(); internal(); };
    destination d_secops { tcp("<BindPlaneAgent_IP>:<BindPlaneAgent_Port>"); };
    log { source(s_local); destination(d_secops); };
    
  3. 重启 syslog-ng 服务:

    brew services restart syslog-ng
    
  4. 检查 syslog-ng 的状态(您应该会看到 syslog-ng 列为已启动):

    brew services list
    

UDM 映射表

日志字段 UDM 映射 逻辑
数据 read_only_udm.metadata.description 系统使用 Grok 模式从原始日志中的 data 字段中提取 description 字段的值。
数据 read_only_udm.principal.hostname 系统会使用 Grok 模式从 data 字段中提取主机名。
数据 read_only_udm.intermediary.hostname 系统会使用 Grok 模式从 data 字段中提取中继主机名。
数据 read_only_udm.principal.process.command_line 系统会使用 Grok 模式从 data 字段中提取进程命令行。
数据 read_only_udm.principal.process.pid 系统会使用 Grok 模式从 data 字段中提取进程 ID。
数据 read_only_udm.metadata.event_timestamp 系统会使用 Grok 模式从 data 字段中提取事件时间戳,并将其转换为时间戳对象。在解析器中硬编码为“MacOS”。在解析器中硬编码为“Apple”。如果从日志中提取主机名,则设置为“STATUS_UPDATE”;否则,设置为“GENERIC_EVENT”。
log_type read_only_udm.metadata.log_type 直接从原始日志的 log_type 字段映射。

更改

2022-05-04

  • 新创建的解析器。