收集 Imperva WAF 日志

支持的平台:

本文档介绍了如何通过使用第三方 API 或 Amazon S3 设置 Google Security Operations Feed 来收集 Imperva WAF 日志。

Imperva WAF 是一款基于云的 Web 应用防火墙,可保护网站和应用免受基于 Web 的攻击,包括 SQL 注入、跨站脚本攻击 (XSS) 和 DDoS 攻击威胁。Imperva WAF 会实时分析传入的 HTTP/HTTPS 网络流量,应用安全规则和机器人缓解措施来阻止恶意请求,以免其到达源服务器。

收集方法差异

Imperva WAF 与 Google SecOps 的集成支持以下日志提取方法:

  • API 收集:Google SecOps 直接从 Imperva API 拉取日志。这是直接连接,仅支持 IMPERVA_WAF 日志类型,并且仅收集审核日志,如 Imperva 审核轨迹中所述。Google SecOps 每 24 小时查询一次 Imperva 审核跟踪 API。
  • Amazon S3 V2 存储桶收集:Imperva WAF 将日志推送到指定的 Amazon S3 存储桶,然后 Google SecOps 从该存储桶中提取日志。此方法会收集 Cloud WAF 生成的安全事件访问日志,如 Imperva 日志集成中所述。由于该存储桶可以接收来自多个来源的日志,因此该方法还支持其他 Imperva 日志类型,前提是您明确配置这些日志以推送到该存储桶。

准备工作

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

  • Google SecOps 实例
  • 对 Imperva Cloud Security Console (my.imperva.com) 的特权访问权限
  • Imperva 账号管理员,为其他用户创建 API 密钥。没有管理员权限的用户只能为其自己的账号创建 API 密钥。
  • 对于 Amazon S3 方法:对 AWS (S3、IAM) 的特权访问权限

配置 Imperva WAF API 访问权限

API 收集方法使用 Imperva API IDAPI 密钥针对 api.imperva.com 进行身份验证。在 Imperva Cloud Security Console 中生成这些凭据。

生成 API 凭据

  1. 前往 my.imperva.com,登录 Imperva Cloud Security Console
  2. 在顶部菜单栏中,依次点击账号 > 账号管理
  3. 在边栏中,依次点击用户管理 > 用户
  4. 找到 Feed 所使用的用户,点击操作列中的省略号,然后点击修改
  5. 点击 API 密钥标签页。
  6. 点击添加 API 密钥。添加名称和说明,以指明密钥的用途。
  7. 从弹出式窗口中复制并保存以下值:
    • API ID:您的唯一 API 标识符(例如 12345)。
    • API 密钥:您的 API 密钥(例如 abcdef-123456-ghijkl-789012)。
  • 或者,没有管理员权限的用户可以为其自己的账号生成密钥。在顶部菜单栏中,依次点击账号 > 我的个人资料,然后点击 API 密钥下方的添加 API 密钥

在 Google SecOps 中配置 Feed 以注入 Imperva WAF 日志

  1. 依次前往 SIEM 设置 > Feed
  2. 点击添加新 Feed
  3. 在下一页上,点击配置单个 Feed
  4. Feed 名称字段中,输入 Feed 的名称(例如 Imperva WAF Logs)。
  5. 选择第三方 API 作为来源类型
  6. 选择 Imperva 作为日志类型
  7. 点击下一步
  8. 为以下输入参数指定值:

    • 身份验证 HTTP 标头:以以下格式输入身份验证凭据:

      x-API-Id:your-api-id-value
      x-API-Key:your-api-key-value
      

      每项凭据都必须以 key:value 格式单独列为一行。

      输入与显示内容完全一致的标题名称。Imperva 审核跟踪 API 仅接受 API ID 和 API 密钥作为 x-API-Idx-API-Key HTTP 标头。

    • 资产命名空间资产命名空间

    • 注入标签:要应用于此 Feed 中事件的标签。

  9. 点击下一步

  10. 最终确定界面中查看新的 Feed 配置,然后点击提交

设置完成后,该 Feed 会检索 Imperva 审核轨迹事件,这些事件会记录账号用户、系统进程和 Imperva 管理员在您的账号中执行的操作。如需收集 Cloud WAF 安全事件和访问日志,请使用下一部分中介绍的 Amazon S3 方法。

使用 Amazon S3 收集 Imperva WAF 日志

配置 AWS IAM 和 S3

  1. 按照以下用户指南创建 Amazon S3 存储桶:创建存储桶
  2. 保存存储桶名称区域以备后用。
  3. 按照以下用户指南创建用户创建 IAM 用户
  4. 选择创建的用户
  5. 选择安全凭据标签页。
  6. 访问密钥部分中,点击创建访问密钥
  7. 选择第三方服务作为使用情形
  8. 点击下一步
  9. 可选:添加说明标记。
  10. 点击创建访问密钥
  11. 点击下载 .csv 文件,然后保存访问密钥密钥以供日后使用。
  12. 点击完成
  13. 选择权限标签页。
  14. 权限政策部分中,点击添加权限
  15. 选择添加权限
  16. 选择直接附加政策
  17. 搜索并选择 AmazonS3FullAccess 政策。
  18. 点击下一步
  19. 点击添加权限

配置 Imperva WAF Amazon S3 连接

  1. 使用具有管理员权限的账号登录 my.imperva.com 中的 Imperva Cloud Security Console
  2. 在顶部菜单栏中,依次点击账号 > 账号管理
  3. 在边栏中,依次点击 SIEM 日志 > 日志配置
  4. 连接表格中,点击添加连接
  5. 可选:选择 SIEM 供应商。Google SecOps 不作为 SIEM 供应商提供,因此请跳过此步骤,改为选择交付方式。

  6. 选择 Amazon S3 作为交付方式。

  7. 提供以下配置详细信息:

    • 访问密钥:您创建的 IAM 用户的访问密钥。
    • 密钥:您创建的 IAM 用户的私有访问密钥。
    • 路径:存储桶路径,采用 <bucket-name>/<folder> 格式(例如 imperva-waf-logs/logs)。
  8. 点击测试连接,运行完整的测试周期,将测试文件传输到您指定的文件夹。

  9. 点击添加日志类型,然后选择 Cloud WAF 服务。

  10. 提供以下配置详细信息:

    • 配置名称:输入在您的账号中唯一的名称。
    • 选择日志类型:Imperva 同时提供 Cloud WAF 安全日志和访问日志。
    • 格式:选择 CEF。解析器还可以读取 LEEF,但无法读取 W3C
    • 压缩日志:清除此选项。Imperva 默认会压缩日志文件,而解析器无法解压缩这些文件。
    • 加密:保持加密功能处于停用状态。解析器无法解密加密的日志文件。
    • 状态:设置为已启用
  11. 保存日志类型配置。

在 Google SecOps 中配置 Feed 以从 Amazon S3 V2 注入 Imperva WAF 日志

  1. 依次前往 SIEM 设置 > Feed
  2. 点击添加新 Feed
  3. Feed 名称字段中,输入 Feed 的名称(例如 Imperva WAF Logs)。
  4. 选择 Amazon S3 V2 作为来源类型
  5. 选择 Imperva 作为日志类型
  6. 点击下一步
  7. 为以下输入参数指定值:

    • S3 URI:存储桶 URI。

      s3://your-log-bucket-name/
      

      your-log-bucket-name 替换为存储桶的实际名称。

    • 源删除选项:根据您的偏好选择删除选项。

    • 文件存在时间上限:包含在过去指定天数内修改过的文件。默认值为 180 天。

    • 访问密钥 ID:有权访问 S3 存储桶的用户访问密钥。

    • 私有访问密钥:有权访问 S3 存储桶的用户私有密钥。

    • 资产命名空间资产命名空间

    • 注入标签:要应用于此 Feed 中事件的标签。

  8. 点击下一步

  9. 最终确定界面中查看新的 Feed 配置,然后点击提交

UDM 映射表

日志字段 UDM 映射 逻辑
csv_message about 已映射:CEF:about
csv_message about.asset.ip 已映射:CEF:kv.dvc
kv.dvc about.asset.ip 已合并
csv_message about.ip 已映射:CEF:kv.dvc
kv.dvc about.ip 已合并
additional_devicedata additional.fields 已合并
additional_factors_label additional.fields 已合并
additional_severity additional.fields 已合并
cn1_value_label additional.fields 已合并
csv_message additional.fields 已映射:CEF:additional_severityCEF:cn1_value_label
random_id_label additional.fields 已合并
site_id_label additional.fields 已合并
site_name_label additional.fields 已合并
zuid_labels additional.fields 已合并
csv_message extensions.vulns.vulnerabilities 已映射:CEF:vuln
message extensions.vulns.vulnerabilities 已映射:LEEF:vuln
vuln extensions.vulns.vulnerabilities 已合并
message intermediary 已映射:LEEF:intermediary
forwardedIp intermediary.asset.hostname 直接映射
forwardedIp intermediary.asset.ip 已合并
xff intermediary.asset.ip 已合并
forwardedIp intermediary.hostname 直接映射
forwardedIp intermediary.ip 已合并
log.mx-ip intermediary.ip 已合并
xff intermediary.ip 已合并
popName intermediary.location.country_or_region 已重命名/已映射
csv.description metadata.description csv_message =~ CEF: 时映射
log.message metadata.description json_array != `` 时进行映射
deviceReceiptTime metadata.event_timestamp 解析为 MMM dd HH:mm:ss
log.@timestamp metadata.event_timestamp 解析为 UNIX_MS
log.time metadata.event_timestamp 解析为 UNIX
log_timestamp metadata.event_timestamp 解析为 UNIX_MS
start metadata.event_timestamp 解析为 UNIX_MS
timestamp metadata.event_timestamp 解析为 MMM dd yyyy HH:mm:ss
csv_message metadata.event_type 映射值(总共 6 个,例如 CEF:NETWORK_HTTPCEF:SCAN_UNCATEGORIZEDCEF:
has_principal metadata.event_type 已映射:trueNETWORK_CONNECTION
message metadata.event_type 已映射:LEEF:NETWORK_HTTP
principal_present metadata.event_type 已映射:trueNETWORK_HTTPtrueNETWORK_CONNECTIONtrueSTATUS_UPDATE
csv.event_id metadata.product_event_type 直接映射
log.type_key metadata.product_event_type json_array != `` 时进行映射
log.imperva.ids.account_id metadata.product_log_id json_array != `` 时进行映射
log.header.product-version metadata.product_version json_array != `` 时进行映射
product_version metadata.product_version csv_message =~ CEF: 时映射
csv_message network.application_protocol 已映射:CEF:HTTPSCEF:HTTP
proto network.application_protocol 已重命名/已映射
deviceExternalId network.community_id 已重命名/已映射
message network.direction 已映射:LEEF:INBOUND
kv.cs8 network.http.method csv_message =~ CEF: 时映射
kv.requestMethod network.http.method 已重命名/已映射
log.http.request.method network.http.method json_array != `` 时进行映射
requestMethod network.http.method 已重命名/已映射
http_user_agent network.http.parsed_user_agent 已重命名/已映射
log.http.request.user-agent network.http.parsed_user_agent 已重命名/已映射
log.imperva.abp.headers_referer network.http.referral_url json_array != `` 时进行映射
log.imperva.referrer network.http.referral_url json_array != `` 时进行映射
ref network.http.referral_url 已重命名/已映射
cn1 network.http.response_code 已重命名/已映射
cn1_value network.http.response_code 已重命名/已映射
kv.flexString1 network.http.response_code 已重命名/已映射
kv.flexString2 network.http.response_code 已重命名/已映射
log.http.response.code network.http.response_code 已重命名/已映射
kv.requestClientApplication network.http.user_agent csv_message =~ CEF: 时映射
log.http.request.user-agent network.http.user_agent json_array != `` 时进行映射
requestClientApplication network.http.user_agent 已重命名/已映射
user_agent network.http.user_agent 已重命名/已映射
kv.proto network.ip_protocol 已重命名/已映射
log.protocol network.ip_protocol json_array != `` 时进行映射
message network.ip_protocol 已映射:LEEF:TCP
kv.Customer network.organization_name csv_message =~ CEF: 时映射
csv_message network.received_bytes 已映射:CEF:uinteger
in network.received_bytes 已重命名/已映射
kv.in network.received_bytes csv_message =~ CEF: 时映射
message network.received_bytes 已映射:LEEF:uinteger
log.http.request.body.bytes network.sent_bytes 已重命名/已映射
fileId network.session_id 已重命名/已映射
log.http.session-id network.session_id json_array != `` 时进行映射
log.imperva.abp.customer_request_id network.session_id json_array != `` 时进行映射
log.imperva.request_session_id network.session_id json_array != `` 时进行映射
tls_cipher network.tls.cipher 已重命名/已映射
tls_version network.tls.version 已重命名/已映射
cs6 principal.application 已重命名/已映射
log.client.domain principal.asset.hostname json_array != `` 时进行映射
csv_message principal.asset.ip 已映射:CEF:kvsrc
kvsrc principal.asset.ip 已合并
log.client.ip principal.asset.ip 已合并
log.source-ip principal.asset.ip 已合并
message principal.asset.ip 已映射:LEEF:src
src principal.asset.ip 已合并
log.client.domain principal.hostname json_array != `` 时进行映射
csv_message principal.ip 已映射:CEF:kvsrc
kvsrc principal.ip 已合并
log.client.ip principal.ip 已合并
log.source-ip principal.ip 已合并
message principal.ip 已映射:LEEF:src
src principal.ip 已合并
request_type_label principal.labels 已合并
cicode principal.location.city 已重命名/已映射
kv.cicode principal.location.city csv_message =~ CEF: 时映射
calCountryOrRegion principal.location.country_or_region 已重命名/已映射
kv.ccode principal.location.country_or_region csv_message =~ CEF: 时映射
log.client.geo.country_iso_code principal.location.country_or_region json_array != `` 时进行映射
log.imperva.country principal.location.country_or_region json_array != `` 时进行映射
cs7 principal.location.region_latitude 已重命名/已映射
csv_message principal.location.region_latitude 已映射:CEF:float
kv.cs7 principal.location.region_latitude 已重命名/已映射
message principal.location.region_latitude 已映射:LEEF:float
cs8 principal.location.region_longitude 已重命名/已映射
csv_message principal.location.region_longitude 已映射:CEF:float
kv.cs8 principal.location.region_longitude 已重命名/已映射
message principal.location.region_longitude 已映射:LEEF:float
log.source-port principal.port 已重命名/已映射
port principal.port csv_message =~ CEF: 时映射
srcPort principal.port 已重命名/已映射
log.imperva.path principal.process.file.full_path json_array != `` 时进行映射
log.imperva.abp.pid principal.process.pid json_array != `` 时进行映射
header_map_label principal.resource.attribute.labels 已合并
log.user.email principal.user.email_addresses 已合并
log.user_details principal.user.email_addresses 已合并
log.event.provider principal.user.user_display_name json_array != `` 时进行映射
log.http.user-name principal.user.userid json_array != `` 时进行映射
log.user_id principal.user.userid json_array != `` 时进行映射
user_name principal.user.userid json_array != `` 时进行映射
csv_message security_result 已映射:CEF:security_result
message security_result 已映射:LEEF:security_result
_action security_result.action 已合并
action security_result.action 已合并
csv_message security_result.action 已映射:CEF:action
message security_result.action 已映射:LEEF:_action
security_action security_result.action 已合并
cat security_result.action_details 直接映射
kv.act security_result.action_details 直接映射
kv.cat security_result.action_details 直接映射
log.action security_result.action_details 直接映射
csv_message security_result.category_details 已映射:CEF:kv.cat
dproc security_result.category_details 已合并
kv.cat security_result.category_details 已合并
message security_result.category_details 已映射:LEEF:dproc
log.description security_result.description 直接映射
log.imperva.abp.tls_fingerprint security_result.description 直接映射
log.imperva.risk_reason security_result.description 直接映射
accept_encoding_label security_result.detection_fields 已合并
accept_language_label security_result.detection_fields 已合并
apollo_rule security_result.detection_fields 已合并
behavior security_result.detection_fields 已合并
class_label security_result.detection_fields 已合并
cn1_field security_result.detection_fields 已合并
cn2_field security_result.detection_fields 已合并
condition_id security_result.detection_fields 已合并
condition_name security_result.detection_fields 已合并
cs10Label_field security_result.detection_fields 已合并
cs11_field security_result.detection_fields 已合并
cs12Label_field security_result.detection_fields 已合并
cs1_field security_result.detection_fields 已合并
cs2_field security_result.detection_fields 已合并
cs3_field security_result.detection_fields 已合并
cs4_field security_result.detection_fields 已合并
cs5Label_field security_result.detection_fields 已合并
cs5_field security_result.detection_fields 已合并
cs6_field security_result.detection_fields 已合并
cs8_label security_result.detection_fields 已合并
cs97Label_field security_result.detection_fields 已合并
cs98_field security_result.detection_fields 已合并
cs99_field security_result.detection_fields 已合并
cs9_field security_result.detection_fields 已合并
cs9_label security_result.detection_fields 已合并
csv_message security_result.detection_fields 映射的值(总共 30 个,例如 CEF:flexString1_fieldCEF:cs1_fieldCEF: → `…
detection_fields_domain_risk security_result.detection_fields 已合并
detection_fields_event_action security_result.detection_fields 已合并
detection_fields_event_context security_result.detection_fields 已合并
detection_fields_significant_domain_name security_result.detection_fields 已合并
detection_fields_violated_directive security_result.detection_fields 已合并
deviceExternalId_label security_result.detection_fields 已合并
deviceFacility_field security_result.detection_fields 已合并
dproc_label security_result.detection_fields 已合并
end_label security_result.detection_fields 已合并
filePermission_field security_result.detection_fields 已合并
fileType_field security_result.detection_fields 已合并
flexNumber1_field security_result.detection_fields 已合并
flexString1_field security_result.detection_fields 已合并
flexString2_field security_result.detection_fields 已合并
fname_field security_result.detection_fields 已合并
gateway_name_label security_result.detection_fields 已合并
headers_connection_label security_result.detection_fields 已合并
hsig security_result.detection_fields 已合并
log_imperva_classified_client_field security_result.detection_fields 已合并
log_imperva_credentials_leaked_field security_result.detection_fields 已合并
log_imperva_declared_client_field security_result.detection_fields 已合并
log_imperva_failed_logins_last_24h_field security_result.detection_fields 已合并
log_imperva_fingerprint_field security_result.detection_fields 已合并
log_imperva_successful_logins_last_24h_field security_result.detection_fields 已合并
message security_result.detection_fields 映射值(总共 11 个,例如 LEEF:siteid_labelLEEF:start_labelLEEF: → `…
policy_id security_result.detection_fields 已合并
policy_label security_result.detection_fields 已合并
policy_name security_result.detection_fields 已合并
postbody_field security_result.detection_fields 已合并
postbody_label security_result.detection_fields 已合并
request_user_label security_result.detection_fields 已合并
selector security_result.detection_fields 已合并
selector_derived_id security_result.detection_fields 已合并
siteTag_field security_result.detection_fields 已合并
siteid_label security_result.detection_fields 已合并
start_label security_result.detection_fields 已合并
tag_label security_result.detection_fields 已合并
triggered_condition_id security_result.detection_fields 已合并
triggered_condition_name security_result.detection_fields 已合并
violation security_result.detection_fields 已合并
violation_id_label security_result.detection_fields 已合并
violation_type_label security_result.detection_fields 已合并
cs9 security_result.rule_name 直接映射
kv.cs9 security_result.rule_name 直接映射
fileType security_result.rule_type message =~ LEEF: 时映射
kv.fileType security_result.rule_type 直接映射
csv_message security_result.severity 已映射:CEF:HIGHCEF:MEDIUMCEF:LOWCEF:UNKNOWN_SEVERITY
log.severity security_result.severity 直接映射
severity security_result.severity 映射:HighHIGHMediumMEDIUMLowLOWUnknownUNKNOWN_SEVERITY
sevs security_result.severity 映射:"error", "warning"HIGHcriticalCRITICAL"medium","notice" → `MED…
log.imperva.risk_level security_result.severity_details 直接映射
severity security_result.threat_id 直接映射
description security_result.threat_name 直接映射
log.application-name target.application json_array != `` 时进行映射
kv.dhost target.asset.hostname csv_message =~ CEF: 时映射
kv.sourceServiceName target.asset.hostname csv_message =~ CEF: 时映射
log.server.domain target.asset.hostname json_array != `` 时进行映射
csv_message target.asset.ip 已映射:CEF:kv.dstCEF:kv.sip
dst target.asset.ip 已合并
kv.dst target.asset.ip 已合并
kv.sip target.asset.ip 已合并
log.dest-ip target.asset.ip 已合并
message target.asset.ip 已映射:LEEF:dst
kv.dhost target.hostname csv_message =~ CEF: 时映射
kv.sourceServiceName target.hostname csv_message =~ CEF: 时映射
log.server.domain target.hostname json_array != `` 时进行映射
sourceServiceName target.hostname 已重命名/已映射
csv_message target.ip 已映射:CEF:kv.dstCEF:kv.sip
dst target.ip 已合并
kv.dst target.ip 已合并
kv.sip target.ip 已合并
log.dest-ip target.ip 已合并
message target.ip 已映射:LEEF:dst
log.server.geo.name target.location.name json_array != `` 时进行映射
dstPort target.port 已重命名/已映射
kv.cpt target.port 已重命名/已映射
kv.dpt target.port 已重命名/已映射
log.dest-port target.port 已重命名/已映射
kv.deviceProcessName target.process.file.full_path csv_message =~ CEF: 时映射
log.url.path target.process.file.full_path json_array != `` 时进行映射
header_map_label target.resource.attribute.labels 已合并
server_group_label target.resource.attribute.labels 已合并
server_group_simulation_mode_label target.resource.attribute.labels 已合并
service_label target.resource.attribute.labels 已合并
log.resource_id target.resource.id json_array != `` 时进行映射
log.context_key target.resource.name json_array != `` 时进行映射
log.imperva.audit_trail.resource_name target.resource.name json_array != `` 时进行映射
kv.fileId target.resource.product_object_id csv_message =~ CEF: 时映射
log.imperva.abp.token_id target.resource.product_object_id json_array != `` 时进行映射
log.resource_type_key target.resource.type json_array != `` 时进行映射
kv.request target.url 已重命名/已映射
url target.url 已重命名/已映射
Customer target.user.user_display_name 已重命名/已映射
log.imperva.ids.account_name target.user.user_display_name json_array != `` 时进行映射
kv.duser target.user.userid 已重命名/已映射
kv.suid target.user.userid csv_message =~ CEF: 时映射
log.account_id target.user.userid json_array != `` 时进行映射
suid target.user.userid 已重命名/已映射
不适用 metadata.event_type 常量:NETWORK_HTTP
不适用 network.direction 常量:INBOUND
不适用 network.ip_protocol 常量:TCP
不适用 security_result.severity 常量:HIGH

更新日志

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

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