收集 Windows AppLocker 日志
本文档介绍了如何使用 Bindplane 代理将 Windows AppLocker 日志注入到 Google Security Operations。
Windows AppLocker 是 Windows 内置的应用控制功能,可生成政策执行、审核和应用执行事件。AppLocker 会将这些事件写入应用程序和服务日志 > Microsoft > Windows > AppLocker 下的四个 Windows 事件日志通道:EXE and DLL、MSI and Script、Packaged app-Deployment 和 Packaged app-Execution。
您可以使用以下两种受支持的方法之一来配置提取:
- 方法 1:NXLog 转发到 Bindplane 代理(推荐)。NXLog 会读取每个端点上的 AppLocker 渠道,并将事件作为带有 JSON 载荷的 syslog 转发到 Bindplane 代理,后者会以
WINDOWS_APPLOCKER日志类型将这些事件发送到 Google SecOps。这是WINDOWS_APPLOCKER解析器要求的格式,它会保留 AppLocker 规则和文件字段。 方法 2:Bindplane 代理直接通道读取。每个端点上的 Bindplane 代理都会原生读取 AppLocker 渠道,并将原始 Windows 事件 XML 发送到 Google SecOps(日志类型为
WINEVTLOG)。无需导出文件或使用其他代理,但事件会由通用 Windows 事件日志解析器进行解析。
准备工作
请确保满足以下前提条件:
- Google SecOps 实例
- Windows Server 2016 或更高版本,或者 Windows 10 或更高版本,且配置了 AppLocker 政策
- 对 Windows 端点的管理员访问权限
- 如果在代理后面运行,请确保按照 Bindplane 代理要求打开防火墙端口
- 对于方法 1:一个 Windows 或 Linux 主机,用于运行 Bindplane 代理,端点可以通过 TCP 端口 514 访问该主机
获取 Bindplane 代理的 Google SecOps 凭证
如需向 Google SecOps 验证 Bindplane 代理,请选择以下方法之一:
- 新部署:使用 Chronicle API(选项 1)。
- 旧版部署:继续使用数据注入身份验证文件(方法 2),直到 Ingestion API 于 2027 年 7 月 20 日停用。
方法 1:为 Chronicle API 创建服务账号(推荐)
- 登录 Google Cloud 控制台,然后选择与您的 Google SecOps 实例关联的 Google Cloud 项目。
- 依次前往 IAM 和管理 > 服务账号。
- 点击创建服务账号。
- 提供以下配置详细信息:
- 服务账号名称:输入账号的名称(例如
bindplane-ingest)。 - 服务账号说明:输入说明(例如
Bindplane agent log ingestion)。
- 服务账号名称:输入账号的名称(例如
- 点击创建并继续。
- 在向此服务账号授予对项目的访问权限部分,点击选择角色,然后选择 Chronicle Editor。
- 点击继续,然后点击完成。
- 点击您创建的服务账号,然后前往密钥标签页。
- 依次点击添加密钥 > 创建新密钥。
- 选择 JSON,然后点击创建。密钥文件会下载到您的计算机上。
- 将密钥文件另存为 Bindplane 收集器目录(Linux 上的
/opt/observiq-otel-collector/ingestion-auth.json或 Windows 上的C:\Program Files\observIQ OpenTelemetry Collector\ingestion-auth.json)中的ingestion-auth.json,或更新config.yaml中的creds_file_path以匹配您保存它的路径。 - 前往 IAM 和管理 > 设置,然后复制项目编号。您在配置导出器时需要用到该名称。
方法 2:下载数据注入身份验证文件(旧版)
- 登录 Google SecOps 控制台。
- 依次前往设置 > 数据管理 > 收集代理。如果您使用的是仅限 SIEM 的平台,请依次前往设置 > 收集代理。
- 下载数据注入身份验证文件。
- 将该文件安全地保存在将要安装 Bindplane 代理的系统上。
获取 Google SecOps 客户 ID
- 登录 Google SecOps 控制台。
- 依次前往设置 > 管理 > 个人资料。如果您使用的是仅限 SIEM 的平台,请依次前往设置 > 个人资料。
复制并保存组织详细信息部分中的客户 ID。
安装 Bindplane 代理
按照以下说明安装 Bindplane 代理。对于方法 1,请将其安装在从 NXLog 接收 syslog 的主机上。对于方法 2,请将其安装在您要收集其 AppLocker 事件的每个端点上。
Windows 安装
- 以管理员身份打开命令提示符或 PowerShell。
运行以下命令:
msiexec /i "https://github.com/observIQ/bindplane-agent/releases/latest/download/observiq-otel-collector.msi" /quiet等待安装完成。
运行以下命令,验证安装是否成功:
sc query observiq-otel-collector该服务应显示为正在运行。
Linux 安装
- 打开具有 root 或 sudo 权限的终端。
运行以下命令:
sudo sh -c "$(curl -fsSlL https://github.com/observiq/bindplane-agent/releases/latest/download/install_unix.sh)" install_unix.sh
其他安装资源
如需了解其他安装选项和问题排查,请参阅 Bindplane 代理安装指南。
方法 1:NXLog 转发到 Bindplane 代理
配置 Bindplane 代理以接收 syslog 并发送到 Google SecOps
在 Bindplane 代理主机上打开配置文件:
Windows:
notepad "C:\Program Files\observIQ OpenTelemetry Collector\config.yaml"Linux:
sudo nano /opt/observiq-otel-collector/config.yaml将
config.yaml的全部内容替换为以下配置:receivers: tcplog/applocker: listen_address: "0.0.0.0:514" exporters: chronicle/windows_applocker: protocol: https # Region of your instance, for example us, europe, asia-southeast1 location: <LOCATION> # Project number of the Google Cloud project linked to the instance project: '<PROJECT_NUMBER>' compression: gzip creds_file_path: '/path/to/ingestion-auth.json' customer_id: '<customer_id>' endpoint: chronicle.googleapis.com log_type: WINDOWS_APPLOCKER raw_log_field: body ingestion_labels: env: production service: pipelines: logs/applocker_to_chronicle: receivers: - tcplog/applocker exporters: - chronicle/windows_applocker替换以下占位符:
listen_address:代理监听的 IP 地址和端口。0.0.0.0:514在 TCP 端口 514 上的每个接口上接受 syslog。如果代理不以 root 身份运行,请在 Linux 上使用大于 1024 的端口,并在主机防火墙中打开该端口。creds_file_path:服务账号 JSON 密钥文件的完整路径(选项 1):- Windows:
C:\Program Files\observIQ OpenTelemetry Collector\ingestion-auth.json - Linux:
/opt/observiq-otel-collector/ingestion-auth.json
- Windows:
<customer_id>:来自“获取 Google SecOps 客户 ID”部分的客户 IDlocation:将<LOCATION>替换为 Google SecOps 实例所在的区域(例如us、europe或asia-southeast1)。导出工具会在此值前面加上chronicle.googleapis.com。如需查看完整列表,请参阅区域级端点。project:将<PROJECT_NUMBER>替换为 IAM 和管理 > 设置中的项目编号。endpoint:保持设置为chronicle.googleapis.com。ingestion_labels:YAML 格式的可选标签(例如env: production)
保存文件。
重启 Bindplane 代理:
Windows:
net stop observiq-otel-collector && net start observiq-otel-collectorLinux:
sudo systemctl restart observiq-otel-collector
旧版提取 API 导出工具
如果您使用选项 2 中的数据注入身份验证文件,请将
exporters代码块替换为以下内容。将creds_file_path设置为数据注入身份验证文件的路径,如果您的实例位于美国境外,请将malachiteingestion-pa.googleapis.com替换为您的区域端点(例如europe-malachiteingestion-pa.googleapis.com)。exporters: chronicle/windows_applocker: compression: gzip creds_file_path: '/path/to/ingestion-auth.json' customer_id: '<customer_id>' endpoint: malachiteingestion-pa.googleapis.com log_type: WINDOWS_APPLOCKER raw_log_field: body ingestion_labels: env: production
在 Windows 端点上安装 NXLog
- 从 NXLog 网站下载适用于 Windows 的 NXLog Agent(原 NXLog Enterprise Edition)。
在要收集其 AppLocker 事件的每个端点上运行安装程序,并接受默认安装目录 (
C:\Program Files\nxlog)。
将 NXLog 配置为转发 AppLocker 事件
- 打开文件资源管理器,然后前往
C:\Program Files\nxlog\conf。 - 在记事本或文本编辑器中以管理员权限打开
nxlog.conf文件。 将全部内容替换为以下配置:
define ROOT C:\Program Files\nxlog define LOGDIR %ROOT%\data define LOGFILE %LOGDIR%\nxlog.log Moduledir %ROOT%\modules CacheDir %ROOT%\data Pidfile %ROOT%\data\nxlog.pid SpoolDir %ROOT%\data LogFile %LOGFILE% <Extension json> Module xm_json </Extension> <Extension xml> Module xm_xml </Extension> <Extension syslog> Module xm_syslog </Extension> <Input applocker_events> Module im_msvistalog <QueryXML> <QueryList> <Query Id="0"> <Select Path="Microsoft-Windows-AppLocker/EXE and DLL">*</Select> <Select Path="Microsoft-Windows-AppLocker/MSI and Script">*</Select> <Select Path="Microsoft-Windows-AppLocker/Packaged app-Deployment">*</Select> <Select Path="Microsoft-Windows-AppLocker/Packaged app-Execution">*</Select> </Query> </QueryList> </QueryXML> <Exec> # AppLocker keeps the rule and file details in the UserData part of the # event. parse_xml() turns them into RuleAndFileData.* fields, which # the parser expects. if $UserData parse_xml($UserData); $Message = to_json(); to_syslog_bsd(); </Exec> </Input> <Output bindplane_syslog> Module om_tcp Host <BINDPLANE_AGENT_IP> Port 514 </Output> <Route applocker_to_bindplane> Path applocker_events => bindplane_syslog </Route>将
<BINDPLANE_AGENT_IP>替换为 Bindplane 代理主机的 IP 地址,并将514替换为listen_address中的端口(如果您更改了该端口)。保存
nxlog.conf文件。
重启 NXLog 服务
- 按
Win+R,输入services.msc,然后按 Enter 键,打开服务。 - 在服务列表中找到 nxlog。
- 右键点击 nxlog,然后选择重启。
- 验证服务状态是否显示为正在运行。
或者,您也可以以管理员身份从命令提示符重启 NXLog:
net stop nxlog && net start nxlog
验证 AppLocker 事件是否正在转发
- 在 Windows 端点上打开事件查看器。
- 依次前往应用程序和服务日志 > Microsoft > Windows > AppLocker > EXE 和 DLL。
- 验证是否存在 AppLocker 事件(例如事件 ID 8002、8003 或 8004)。如果日志为空,请确认已应用 AppLocker 政策,并且应用身份服务正在运行。
- 检查
C:\Program Files\nxlog\data\nxlog.log处的 NXLog 日志文件,看看是否有错误或警告。 在 Bindplane 代理主机上,检查代理日志中是否存在错误:
Windows:
type "C:\Program Files\observIQ OpenTelemetry Collector\log\collector.log"Linux:
sudo tail -f /opt/observiq-otel-collector/log/collector.log
方法 2:Bindplane 代理直接通道读取
如果您不想部署 NXLog,请使用此方法。安装在每个端点上的 Bindplane 代理会直接从 Windows 事件日志中读取 AppLocker 渠道,并以 WINEVTLOG 日志类型将原始事件 XML 发送到 Google SecOps。
配置 Bindplane 代理以读取 AppLocker 渠道
在 Windows 端点上,打开配置文件:
notepad "C:\Program Files\observIQ OpenTelemetry Collector\config.yaml"将
config.yaml的全部内容替换为以下配置:receivers: windowseventlog/applocker_exe_dll: channel: Microsoft-Windows-AppLocker/EXE and DLL raw: true max_reads: 100 poll_interval: 5s start_at: end windowseventlog/applocker_msi_script: channel: Microsoft-Windows-AppLocker/MSI and Script raw: true max_reads: 100 poll_interval: 5s start_at: end windowseventlog/applocker_packaged_deployment: channel: Microsoft-Windows-AppLocker/Packaged app-Deployment raw: true max_reads: 100 poll_interval: 5s start_at: end windowseventlog/applocker_packaged_execution: channel: Microsoft-Windows-AppLocker/Packaged app-Execution raw: true max_reads: 100 poll_interval: 5s start_at: end exporters: chronicle/winevtlog: protocol: https # Region of your instance, for example us, europe, asia-southeast1 location: <LOCATION> # Project number of the Google Cloud project linked to the instance project: '<PROJECT_NUMBER>' compression: gzip creds_file_path: 'C:\Program Files\observIQ OpenTelemetry Collector\ingestion-auth.json' customer_id: '<customer_id>' endpoint: chronicle.googleapis.com log_type: WINEVTLOG raw_log_field: body ingestion_labels: env: production service: pipelines: logs/applocker_to_chronicle: receivers: - windowseventlog/applocker_exe_dll - windowseventlog/applocker_msi_script - windowseventlog/applocker_packaged_deployment - windowseventlog/applocker_packaged_execution exporters: - chronicle/winevtlog替换以下占位符:
<customer_id>:来自“获取 Google SecOps 客户 ID”部分的客户 IDendpoint:区域端点网址,如方法 1 中所列ingestion_labels:YAML 格式的可选标签(例如env: production)start_at:设置为end,表示仅收集新事件;设置为beginning,表示同时收集渠道中已有的事件
保存文件。
重启 Bindplane 代理:
net stop observiq-otel-collector && net start observiq-otel-collector验证服务是否正在运行,并检查代理日志中是否存在错误:
sc query observiq-otel-collector type "C:\Program Files\observIQ OpenTelemetry Collector\log\collector.log"
旧版提取 API 导出工具
如果您使用选项 2 中的数据注入身份验证文件,请将
exporters代码块替换为以下内容。将creds_file_path设置为数据注入身份验证文件的路径,如果您的实例位于美国境外,请将malachiteingestion-pa.googleapis.com替换为您的区域端点(例如europe-malachiteingestion-pa.googleapis.com)。exporters: chronicle/winevtlog: 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: WINEVTLOG raw_log_field: body ingestion_labels: env: production
UDM 映射表
| 日志字段 | UDM 映射 | 逻辑 |
|---|---|---|
syslog_ts |
metadata.event_timestamp |
已解析为 yyyy-MM-ddTHH:mm:ss Z |
event_type |
metadata.event_type |
直接映射 |
EventID |
metadata.product_event_type |
直接映射 |
sourceName |
metadata.product_name |
直接映射 |
SourceModuleType |
observer.application |
已重命名/映射 |
Domain |
principal.administrative_domain |
已重命名/映射 |
Hostname |
principal.hostname |
已重命名/映射 |
principal_ip1 |
principal.ip |
已合并 |
roles |
principal.user.attribute.roles |
已合并 |
AccountName |
principal.user.userid |
已重命名/映射 |
EventID |
security_result.about.labels |
已映射:8002,8005, 8006, 8020 → ssdl |
ssdl |
security_result.about.labels |
已合并 |
message1 |
security_result.action |
已映射:allowed to run → security_action |
security_action |
security_result.action |
已合并 |
message1 |
security_result.description |
直接映射 |
RuleAndFileData.RuleId |
security_result.rule_id |
已重命名/映射 |
EventID |
security_result.rule_name |
直接映射 |
RuleAndFileData.RuleName |
security_result.rule_name |
已重命名/映射 |
EventType |
security_result.severity |
已映射:INFO → INFORMATIONAL,WARNING → LOW |
RuleAndFileData.PolicyName |
security_result.summary |
已重命名/映射 |
ThreadID |
security_result.threat_id |
已重命名/映射 |
RuleAndFileData.FullFilePath |
target.process.file.full_path |
已重命名/映射 |
filePath |
target.process.file.full_path |
已重命名/映射 |
ProcessID |
target.process.pid |
直接映射 |
RuleAndFileData.TargetProcessId |
target.process.pid |
已重命名/映射 |
ProviderGuid |
target.resource.product_object_id |
已重命名/映射 |
UserID |
target.user.userid |
已重命名/映射 |
| 不适用 | metadata.vendor_name |
常量:Microsoft |
| 不适用 | security_result.severity |
常量:INFORMATIONAL |