收集 WordPress CMS 日志
支持的语言:
Google SecOps
SIEM
概览
此解析器可从 JSON 或纯文本格式的消息中提取 WordPress CMS 日志。它可处理 JSON 和非 JSON 格式的日志,解析相关字段并将其映射到 UDM,包括用户详细信息、网络信息、资源属性和安全结果详细信息。解析器还会执行多项数据转换,例如转换数据类型、合并字段以及处理 Kubernetes 和其他资源的特定日志模式。
准备工作
确保您满足以下前提条件:
- Google SecOps 实例。
- 对 WordPress 网站的特权访问权限。
- 启用 webhook 功能的插件(例如 WP Webhooks)。
设置 Feed
如需配置 Feed,请按以下步骤操作:
- 依次前往 SIEM 设置 > Feed。
- 点击添加新 Feed。
- 在下一页上,点击配置单个 Feed。
- 在 Feed name 字段中,输入 Feed 的名称,例如 Wordpress CMS Logs。
- 选择 Webhook 作为来源类型。
- 选择 WordPress 作为日志类型。
- 点击下一步。
- 可选:为以下输入参数指定值:
- 拆分分隔符:用于分隔日志行的分隔符,例如
\n
。
- 拆分分隔符:用于分隔日志行的分隔符,例如
- 点击下一步。
- 在最终确定界面中检查 Feed 配置,然后点击提交。
- 点击生成密钥,生成用于对此 Feed 进行身份验证的密钥。
- 复制并存储密钥。您将无法再次查看此密钥。如有需要,您可以重新生成新的 Secret 密钥,但此操作会使之前的 Secret 密钥失效。
- 在详情标签页中,从端点信息字段复制 Feed 端点网址。您需要在客户端应用中指定此端点网址。
- 点击完成。
为 webhook Feed 创建 API 密钥
前往 Google Cloud 控制台 > 凭据。
点击创建凭据,然后选择 API 密钥。
将 API 密钥访问权限限制为 Google Security Operations API。
指定端点网址
- 在客户端应用中,指定 webhook Feed 中提供的 HTTPS 端点网址。
通过在自定义标头中指定 API 密钥和密钥来启用身份验证,格式如下:
X-goog-api-key = API_KEY X-Webhook-Access-Key = SECRET
建议:将 API 密钥指定为标头,而不是在网址中指定。如果您的 Webhook 客户端不支持自定义标头,您可以使用以下格式的查询参数指定 API 密钥和密钥:
ENDPOINT_URL?key=API_KEY&secret=SECRET
替换以下内容:
ENDPOINT_URL
:Feed 端点网址。API_KEY
:用于向 Google Security Operations 进行身份验证的 API 密钥。SECRET
:您生成的用于对 Feed 进行身份验证的密钥。
配置 WordPress Webhook
- 通过 WordPress 插件目录安装并激活 WP Webhooks 插件(或您选择的 webhook 插件)。
- 前往 WordPress 管理员菜单中的 WP Webhooks 子菜单,该子菜单通常位于“设置”下方。
- 点击顶部栏菜单中的发送数据。
- 选择将触发 webhook 的 WordPress 操作。常见示例包括 publish_post(发布新帖子时)、user_register(新用户注册时)或 comment_post(发布新评论时)。这取决于您选择并发送给 Google SecOps 的数据。
- 点击添加 Webhook 网址。
- 配置 Webhook:
- 名称:为您的 Webhook 指定一个描述性名称(例如 Google SecOps Feed)。
- Webhook 网址:粘贴您的 Google SecOps 端点网址。
- 点击 Save Webhook。
UDM 映射表
日志字段 | UDM 映射 | 逻辑 |
---|---|---|
ClientIP |
principal.ip |
客户端的 IP 地址是从原始日志的 ClientIP 字段中提取的。 |
Code |
target.resource.attribute.labels.key |
值“Code”被分配为 target.resource.attribute.labels 对象中的键。 |
Code |
target.resource.attribute.labels.value |
原始日志中 Code 字段的值会分配为 target.resource.attribute.labels 对象中的值。 |
CurrentUserID |
target.user.userid |
原始日志中的 CurrentUserID 会转换为字符串并映射到 target.user.userid 字段。 |
EditUserLink |
target.url |
原始日志中的 EditUserLink 会映射到 target.url 字段。 |
EventType |
metadata.product_event_type |
原始日志中的 EventType 会映射到 metadata.product_event_type 字段。 |
FirstName |
target.user.first_name |
原始日志中的 FirstName 会映射到 target.user.first_name 字段。 |
insertId |
metadata.product_log_id |
原始日志中的 insertId 会映射到 metadata.product_log_id 字段。 |
labels.compute.googleapis.com/resource_name |
additional.fields.key |
值“资源名称”被分配为 additional.fields 对象中的键。 |
labels.compute.googleapis.com/resource_name |
additional.fields.value.string_value |
原始日志中的 labels.compute.googleapis.com/resource_name 值将作为字符串值分配给 additional.fields 对象。 |
labels.k8s-pod/app_kubernetes_io/instance |
target.resource.attribute.labels.key |
值“Kubernetes IO Instance”被分配为 target.resource.attribute.labels 对象中的键。 |
labels.k8s-pod/app_kubernetes_io/instance |
target.resource.attribute.labels.value |
原始日志中的 labels.k8s-pod/app_kubernetes_io/instance 值会作为 target.resource.attribute.labels 对象中的值进行分配。 |
labels.k8s-pod/app_kubernetes_io/managed-by |
target.resource.attribute.labels.key |
值“Kubernetes IO Instance Manager”被分配为 target.resource.attribute.labels 对象中的键。 |
labels.k8s-pod/app_kubernetes_io/managed-by |
target.resource.attribute.labels.value |
原始日志中的 labels.k8s-pod/app_kubernetes_io/managed-by 值会作为 target.resource.attribute.labels 对象中的值进行分配。 |
labels.k8s-pod/app_kubernetes_io/name |
target.resource.attribute.labels.key |
值“Kubernetes IO Instance Name”被分配为 target.resource.attribute.labels 对象中的键。 |
labels.k8s-pod/app_kubernetes_io/name |
target.resource.attribute.labels.value |
原始日志中的 labels.k8s-pod/app_kubernetes_io/name 值会作为 target.resource.attribute.labels 对象中的值进行分配。 |
labels.k8s-pod/controller-revision-hash |
target.resource.attribute.labels.key |
“控制器修订版本哈希”值会作为 target.resource.attribute.labels 对象中的键进行分配。 |
labels.k8s-pod/controller-revision-hash |
target.resource.attribute.labels.value |
原始日志中的 labels.k8s-pod/controller-revision-hash 值会作为 target.resource.attribute.labels 对象中的值进行分配。 |
labels.k8s-pod/helm_sh/chart |
target.resource.attribute.labels.key |
值“Kubernetes IO Instance Manager SH”被分配为 target.resource.attribute.labels 对象中的键。 |
labels.k8s-pod/helm_sh/chart |
target.resource.attribute.labels.value |
原始日志中的 labels.k8s-pod/helm_sh/chart 值会作为 target.resource.attribute.labels 对象中的值进行分配。 |
labels.k8s-pod/k8s-app |
target.resource.attribute.labels.key |
值“Application”被分配为 target.resource.attribute.labels 对象中的键。 |
labels.k8s-pod/k8s-app |
target.resource.attribute.labels.value |
原始日志中的 labels.k8s-pod/k8s-app 值会作为 target.resource.attribute.labels 对象中的值进行分配。 |
labels.k8s-pod/pod-template-generation |
target.resource.attribute.labels.key |
值“Pod Template Generation”被分配为 target.resource.attribute.labels 对象中的键。 |
labels.k8s-pod/pod-template-generation |
target.resource.attribute.labels.value |
原始日志中的 labels.k8s-pod/pod-template-generation 值会作为 target.resource.attribute.labels 对象中的值进行分配。 |
labels.k8s-pod/pod-template-hash |
target.resource.attribute.labels.key |
值“Pod Template Hash”被分配为 target.resource.attribute.labels 对象中的键。 |
labels.k8s-pod/pod-template-hash |
target.resource.attribute.labels.value |
原始日志中的 labels.k8s-pod/pod-template-hash 值会作为 target.resource.attribute.labels 对象中的值进行分配。 |
LastName |
target.user.last_name |
原始日志中的 LastName 会映射到 target.user.last_name 字段。 |
logName |
target.resource.attribute.labels.key |
值“Log Name”被分配为 target.resource.attribute.labels 对象中的键。 |
logName |
target.resource.attribute.labels.value |
原始日志中 logName 字段的值会分配为 target.resource.attribute.labels 对象中的值。 |
receiveTimestamp |
metadata.event_timestamp |
系统会解析原始日志中的 receiveTimestamp ,并将其映射到 metadata.event_timestamp 字段。 |
resource.labels.cluster_name |
additional.fields.key |
值“Cluster Name”被分配为 additional.fields 对象中的键。 |
resource.labels.cluster_name |
additional.fields.value.string_value |
原始日志中的 resource.labels.cluster_name 值将作为字符串值分配给 additional.fields 对象。 |
resource.labels.cluster_name |
target.resource.resource_type |
如果存在 resource.labels.cluster_name ,则将值“CLUSTER”分配给 target.resource.resource_type 。 |
resource.labels.container_name |
metadata.product_event_type |
如果 resource.type 为“k8s_container”,则使用 resource.labels.container_name 的值以及 resource.labels.namespace_name 来构建 metadata.product_event_type 。 |
resource.labels.container_name |
target.resource.name |
原始日志中的 resource.labels.container_name 值会分配给 target.resource.name 字段。 |
resource.labels.location |
target.location.country_or_region |
原始日志中的 resource.labels.location 值会分配给 target.location.country_or_region 字段。 |
resource.labels.namespace_name |
additional.fields.key |
值“命名空间名称”被分配为 additional.fields 对象中的键。 |
resource.labels.namespace_name |
additional.fields.value.string_value |
原始日志中的 resource.labels.namespace_name 值将作为字符串值分配给 additional.fields 对象。 |
resource.labels.namespace_name |
metadata.product_event_type |
如果 resource.type 为“k8s_container”,则使用 resource.labels.namespace_name 的值以及 resource.labels.container_name 来构建 metadata.product_event_type 。 |
resource.labels.node_name |
metadata.product_event_type |
如果 resource.type 为“k8s_node”,则使用 resource.labels.node_name 的值来构建 metadata.product_event_type 。 |
resource.labels.pod_name |
additional.fields.key |
值“Pod Name”被分配为 additional.fields 对象中的键。 |
resource.labels.pod_name |
additional.fields.value.string_value |
原始日志中的 resource.labels.pod_name 值将作为字符串值分配给 additional.fields 对象。 |
resource.labels.project_id |
additional.fields.key |
值“Project Id”被分配为 additional.fields 对象中的键。 |
resource.labels.project_id |
additional.fields.value.string_value |
原始日志中的 resource.labels.project_id 值将作为字符串值分配给 additional.fields 对象。 |
resource.type |
target.resource.resource_subtype |
原始日志中的 resource.type 值会分配给 target.resource.resource_subtype 字段。 |
Roles |
target.user.user_role |
原始日志中的 Roles 字段会转换为大写,并映射到 target.user.user_role 字段。 |
SessionID |
network.session_id |
原始日志中的 SessionID 会映射到 network.session_id 字段。 |
sev |
security_result.severity |
sev 字段的值决定了 security_result.severity 的值。“INFO”或“NOTICE”映射到“INFORMATIONAL”,“WARN”映射到“MEDIUM”,“ERR”映射到“ERROR”。 |
TargetUsername |
target.user.user_display_name |
原始日志中的 TargetUsername 会映射到 target.user.user_display_name 字段。 |
textPayload |
metadata.description |
如果 resource.type 为“k8s_node”,则 textPayload 的值会映射到 metadata.description 字段。 |
textPayload |
network.application_protocol |
协议(例如 HTTP)是从 textPayload 字段中提取的,提取方式是使用 grok 模式。 |
textPayload |
network.http.method |
HTTP 方法(例如 GET、POST)使用 grok 模式从 textPayload 字段中提取。 |
textPayload |
network.http.referral_url |
网址是从 textPayload 字段中提取的,提取方式是使用 Grok 模式。 |
textPayload |
network.http.response_code |
使用 grok 模式从 textPayload 字段中提取 HTTP 响应代码,并将其转换为整数。 |
textPayload |
network.received_bytes |
使用 Grok 模式从 textPayload 字段中提取接收到的字节,并将其转换为无符号整数。 |
textPayload |
principal.ip |
来源 IP 地址使用 Grok 模式从 textPayload 字段中提取。 |
textPayload |
security_result.description |
说明是从 textPayload 字段中提取的,提取方式是使用 grok 模式。 |
textPayload |
target.file.full_path |
使用 Grok 模式从 textPayload 字段中提取路径。 |
UserAgent |
network.http.user_agent |
原始日志中的 UserAgent 会映射到 network.http.user_agent 字段。将值“USER_RESOURCE_ACCESS”分配给 metadata.event_type 。 |
需要更多帮助?从社区成员和 Google SecOps 专业人士那里获得解答。