收集 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 注入身份验证文件
- 登录 Google SecOps 控制台。
- 依次前往 SIEM 设置 > 收集代理。
下载数据注入身份验证文件。将该文件安全地保存在将要安装 Bindplane 的系统上。
获取 Google SecOps 客户 ID
- 登录 Google SecOps 控制台。
- 依次前往 SIEM 设置 > 配置文件。
复制并保存组织详细信息部分中的客户 ID。
安装 Bindplane 代理
按照以下说明在 Windows 操作系统上安装 Bindplane 代理。
Windows 安装
- 以管理员身份打开命令提示符或 PowerShell。
运行以下命令:
msiexec /i "https://github.com/observIQ/bindplane-agent/releases/latest/download/observiq-otel-collector.msi" /quiet等待安装完成。
运行以下命令,验证安装是否成功:
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:提取身份验证文件的完整路径:- Windows:
C:\Program Files\observIQ OpenTelemetry Collector\ingestion-auth.json
- Windows:
<customer_id>:上一步中的客户 IDendpoint:区域端点网址:- 美国:
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服务控制台:
- 按
Win+R,输入services.msc,然后按 Enter 键。 - 找到 observIQ OpenTelemetry 收集器。
- 右键点击并选择重新启动。
验证服务是否正在运行:
sc query observiq-otel-collector检查日志是否存在错误:
type "C:\Program Files\observIQ OpenTelemetry Collector\log\collector.log"
- 按
配置 WinSCP 日志导出
WinSCP 会将会话日志写入用户配置的位置。您需要在 WinSCP 中启用日志记录,并将 Bindplane 代理指向日志目录。
- 在 Windows 机器上打开 WinSCP。
- 依次前往选项 > 偏好设置 > 日志记录。
- 启用会话日志记录:
- 选中启用会话级日志记录。
- 选择正常或调试 1 日志记录级别。
- 将日志文件名设置为集中式路径(例如
C:\Logs\WinSCP\winscp.log)。
- 点击确定以保存设置。
如果日志目录不存在,请创建:
mkdir C:\Logs\WinSCP验证 WinSCP 在执行文件传输会话后是否将日志文件写入配置的目录。
确保
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 | 商品的供应商名称 |