收集 Wordpress CMS 日志
支持:
Google SecOps
SIEM
此解析器可从 JSON 或纯文本格式的消息中提取 WordPress CMS 日志。它可处理 JSON 和非 JSON 格式的日志,解析相关字段并将其映射到 UDM,包括用户详细信息、网络信息、资源属性和安全结果详细信息。解析器还会执行多项数据转换,例如转换数据类型、合并字段以及处理 Kubernetes 和其他资源的特定日志模式。
准备工作
请确保满足以下前提条件:
- Google SecOps 实例。
- 对 WordPress 网站的特权访问权限。
- 启用 Webhook 功能的插件(例如 WP Webhooks )。
设置 Feed
如需配置 Feed,请按以下步骤操作:
- 依次前往 SIEM 设置 > Feed。
- 点击 Add New Feed (添加新 Feed)。
- 在下一页上,点击 Configure a single feed (配置单个 Feed)。
- 在 Feed name (Feed 名称)字段中,输入 Feed 的名称;例如,Wordpress CMS Logs (Wordpress CMS 日志)。
- 选择 Webhook 作为来源类型 。
- 选择 Wordpress 作为日志类型 。
- 点击下一步 。
- 可选:为以下输入参数指定值:
- 拆分定界符:用于分隔日志行的定界符,例如
\n。
- 拆分定界符:用于分隔日志行的定界符,例如
- 点击下一步 。
- 在 Finalize (最终确定)界面中检查 Feed 配置,然后点击提交 。
- 点击 Generate Secret Key (生成密钥)以生成用于对该 Feed 进行身份验证的密钥。
- 复制并存储密钥。您无法再次查看此密钥。如有需要,您可以重新生成新密钥,但此操作会使之前的密钥失效。
- 在 Details (详细信息)标签页上,从 Endpoint Information (端点信息)字段中复制 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 子菜单(通常位于设置下方)。
- 点击顶部栏菜单中的 Send Data (发送数据)。
- 选择将触发 Webhook 的 WordPress 操作。常见示例包括 publish_post (发布新帖子时)、user_register (注册新用户时)或 comment_post (发布新评论时)。这取决于您选择并发送给 Google SecOps 的数据。
- 点击 Add Webhook 网址 (添加网络钩子网址)。
- 配置 Webhook:
- Name(名称):为 Webhook 提供描述性名称(例如 Google SecOps Feed )。
- Webhook 网址(网络钩子网址):粘贴您的 Google SecOps 端点网址。
- 点击 Save Webhook (保存 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 |
值“Resource Name”被分配为 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 |
值“Controller Revision Hash”被分配为 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 |
值“Namespace Name”被分配为 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)是从 textPayload 字段中使用 grok 模式提取的。 |
textPayload |
network.http.referral_url |
网址是从 textPayload 字段中使用 grok 模式提取的。 |
textPayload |
network.http.response_code |
HTTP 响应代码是从 textPayload 字段中使用 grok 模式提取的,并转换为整数。 |
textPayload |
network.received_bytes |
接收的字节是从 textPayload 字段中使用 grok 模式提取的,并转换为无符号整数。 |
textPayload |
principal.ip |
源 IP 地址是从 textPayload 字段中使用 grok 模式提取的。 |
textPayload |
security_result.description |
说明是从 textPayload 字段中使用 grok 模式提取的。 |
textPayload |
target.file.full_path |
路径是从 textPayload 字段中使用 grok 模式提取的。 |
UserAgent |
network.http.user_agent |
原始日志中的 UserAgent 会映射到 network.http.user_agent 字段。值“USER_RESOURCE_ACCESS”会被分配给 metadata.event_type。 |
更新日志
需要更多帮助?获得社区成员和 Google SecOps 专业人士的解答。