收集 WinSCP 日志

支持的平台:

本文档介绍了如何使用 Bindplane 代理将 WinSCP 日志注入到 Google Security Operations。

WinSCP 是一款适用于 Windows 的开源 SFTP、SCP 和 FTP 客户端,可生成文件传输、身份验证和会话活动日志。Bindplane 代理直接从本地文件系统收集 WinSCP 会话日志文件。

准备工作

请确保满足以下前提条件:

  • Google SecOps 实例
  • Windows Server 2016 或更高版本,支持 observiq-otel-collector 服务
  • 如果在代理后面运行,请确保防火墙端口已根据 Bindplane 代理要求打开
  • 一台运行 WinSCP 且已启用日志记录的 Windows 机器

获取 Google SecOps 注入身份验证文件

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

获取 Google SecOps 客户 ID

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

安装 Bindplane 代理

按照以下说明在 Windows 操作系统上安装 Bindplane 代理。

Windows 安装

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

    msiexec /i "https://github.com/observIQ/bindplane-agent/releases/latest/download/observiq-otel-collector.msi" /quiet
    
  3. 等待安装完成。

  4. 运行以下命令,验证安装是否成功:

    sc query observiq-otel-collector
    

    该服务应显示为 正在运行

其他安装资源

如需了解其他安装选项和问题排查信息,请参阅 Bindplane 代理安装指南

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

找到配置文件

  • Windows

    notepad "C:\Program Files\observIQ OpenTelemetry Collector\config.yaml"
    

修改配置文件

  • config.yaml 的全部内容替换为以下配置:

    receivers:
        filelog:
            include:
                - C:\Logs\WinSCP\*.log
            start_at: beginning
    
    exporters:
        chronicle/winscp:
            compression: gzip
            creds_file_path: 'C:\Program Files\observIQ OpenTelemetry Collector\ingestion-auth.json'
            customer_id: '<customer_id>'
            endpoint: malachiteingestion-pa.googleapis.com
            log_type: WINSCP
            raw_log_field: body
            ingestion_labels:
                env: production
    
    service:
        pipelines:
            logs/winscp_to_chronicle:
                receivers:
                    - filelog
                exporters:
                    - chronicle/winscp
    

配置参数

替换以下占位符:

  • 接收器配置

    • filelog:用于从磁盘收集日志文件的接收器类型
    • include:要监控的文件路径列表。将此设置为 WinSCP 写入会话日志的位置(例如 C:\Logs\WinSCP\*.log
    • start_at:设置为 beginning 可读取现有日志,设置为 end 可仅读取新条目
  • 导出器配置

    • winscp:导出器的描述性名称
    • creds_file_path:提取身份验证文件的完整路径:
      • WindowsC:\Program Files\observIQ OpenTelemetry Collector\ingestion-auth.json
    • <customer_id>:上一步中的客户 ID
    • endpoint:区域端点网址:
      • 美国malachiteingestion-pa.googleapis.com
      • 欧洲europe-malachiteingestion-pa.googleapis.com
      • 亚洲asia-southeast1-malachiteingestion-pa.googleapis.com
      • 如需查看完整列表,请参阅区域级端点
    • WINSCP:日志类型,与在 Chronicle 中显示的完全一致
    • ingestion_labels:YAML 格式的可选标签(例如 env: production
  • 流水线配置

    • winscp_to_chronicle:流水线的描述性名称

保存配置文件

  • 修改后,保存文件:
    • Windows:依次点击文件 > 保存

重启 Bindplane 代理以应用更改

如需在 Windows 中重启 Bindplane 代理,请选择以下选项之一:

  • 以管理员身份运行命令提示符或 PowerShell:

    net stop observiq-otel-collector && net start observiq-otel-collector
    
  • 服务控制台:

    1. Win+R,输入 services.msc,然后按 Enter 键。
    2. 找到 observIQ OpenTelemetry 收集器
    3. 右键点击并选择重新启动
    4. 验证服务是否正在运行:

      sc query observiq-otel-collector
      
    5. 检查日志是否存在错误:

      type "C:\Program Files\observIQ OpenTelemetry Collector\log\collector.log"
      

配置 WinSCP 日志导出

WinSCP 会将会话日志写入用户配置的位置。您需要在 WinSCP 中启用日志记录,并将 Bindplane 代理指向日志目录。

  1. 在 Windows 机器上打开 WinSCP
  2. 依次前往选项 > 偏好设置 > 日志记录
  3. 启用会话日志记录:
    • 选中启用会话级日志记录
    • 选择正常调试 1 日志记录级别。
    • 日志文件名设置为集中式路径(例如 C:\Logs\WinSCP\winscp.log)。
  4. 点击确定以保存设置。
  5. 如果日志目录不存在,请创建:

    mkdir C:\Logs\WinSCP
    
  6. 验证 WinSCP 在执行文件传输会话后是否将日志文件写入配置的目录。

  7. 确保 config.yaml 中的 Bindplane 代理 include 路径与日志目录一致。

UDM 映射表

日志字段 UDM 映射 逻辑
directory,console,consoleinstance,public_key,script,hostkey,total_size additional.fields 事件的其他自定义字段
说明 metadata.description 事件的说明
时间戳 metadata.event_timestamp 事件发生时的时间戳
metadata.event_type 事件的类型
src_ip principal.asset.ip 与正文相关联的资产的 IP 地址
local_file principal.file.full_path 与正文关联的文件的完整路径
src_ip principal.ip 主账号的 IP 地址
command_line principal.process.command_line 用于启动进程的命令行
用户名 principal.user.userid 主账号的用户 ID
transfer_speed、result security_result.detection_fields 安全结果中与检测相关的字段
file,target_file target.file.full_path 目标文件的完整路径
file_type target.file.mime_type 目标文件的 MIME 类型
file_size target.file.size 目标文件的大小(以字节为单位)
metadata.product_name 生成相应事件的产品的名称
metadata.vendor_name 商品的供应商名称

更新日志

查看相应解析器的更改日志

需要更多帮助?获得社区成员和 Google SecOps 专业人士的解答。