收集 ntopng 記錄

支援以下發布途徑:

總覽

這個剖析器會以 SYSLOG 或 JSON 格式擷取 ntopng 網路監控記錄。它會剖析記錄訊息、將相關欄位轉換為 UDM 格式,並透過產品和供應商名稱等中繼資料豐富事件。剖析器也會處理巢狀 JSON 結構,並將特定 ntopng 欄位對應至 UDM 網路事件,包括流程快訊和使用者資源存取。

事前準備

請確認您已完成下列事前準備:

  • Google SecOps 執行個體。
  • 對 ntopng 的特殊存取權。

設定動態饋給

在 Google SecOps 平台中,有兩個不同的入口可用來設定動態消息:

  • SIEM 設定 > 動態饋給
  • 內容中心 > 內容包

依序前往「SIEM 設定」>「動態饋給」,設定動態饋給

如要設定動態饋給,請按照下列步驟操作:

  1. 依序前往「SIEM 設定」>「動態」
  2. 按一下「新增動態消息」
  3. 在下一頁中,按一下「設定單一動態饋給」
  4. 在「動態饋給名稱」欄位中輸入動態饋給的名稱,例如「Ntopng Logs」
  5. 將「來源類型」設為「Webhook」
  6. 選取「Ntopng」做為「記錄類型」
  7. 點選「下一步」
  8. 選用:指定下列輸入參數的值:
    • 分隔符號:用於分隔記錄行 (例如 \n) 的分隔符號。
  9. 點選「下一步」
  10. 在「Finalize」畫面中查看動態饋給設定,然後按一下「Submit」
  11. 按一下「產生密鑰」,即可產生密鑰來驗證這項動態饋給。
  12. 複製並儲存密鑰。您無法再次查看這個密鑰。如有需要,您可以重新產生新的密鑰,但這項操作會使先前的密鑰失效。
  13. 在「Details」分頁中,從「Endpoint Information」欄位複製動態饋給端點網址。您必須在用戶端應用程式中指定這個端點網址。
  14. 按一下 [完成]

透過內容中心設定動態饋給

指定下列欄位的值:

  • 分隔符號:用於分隔記錄行 (例如 \n) 的分隔符號。

進階選項

  • 動態饋給名稱:系統會預先填入用於識別動態饋給的值。
  • 來源類型:用於收集記錄並匯入 Google SecOps 的方法。
  • 資產命名空間:與動態饋給相關聯的命名空間。
  • 攝入標籤:套用至這個動態饋給中所有事件的標籤。

  • 按一下「產生密鑰」,即可產生密鑰來驗證這項動態饋給。

  • 複製並儲存密鑰。您無法再次查看這個密鑰。如有需要,您可以重新產生新的密鑰,但這項操作會使先前的密鑰失效。

  • 在「Details」分頁中,從「Endpoint Information」欄位複製動態饋給端點網址。您必須在用戶端應用程式中指定這個端點網址。

為 webhook 動態饋給建立 API 金鑰

  1. 依序前往 Google Cloud 主控台 >「憑證」

    前往「憑證」

  2. 按一下 [Create credentials] (建立憑證),然後選取 [API key] (API 金鑰)

  3. 將 API 金鑰的存取權限制在 Google Security Operations API

指定端點網址

  1. 在用戶端應用程式中,指定 webhook 動態饋給中提供的 HTTPS 端點網址。
  2. 請按照下列格式,將 API 金鑰和密鑰指定為自訂標頭的一部分,啟用驗證機制:

    X-goog-api-key = API_KEY
    X-Webhook-Access-Key = SECRET
    

    建議:請以標頭的形式指定 API 金鑰,不要在網址中指定。

  3. 如果 webhook 用戶端不支援自訂標頭,您可以使用查詢參數指定 API 金鑰和密鑰,格式如下:

    ENDPOINT_URL?key=API_KEY&secret=SECRET
    

    更改下列內容:

    • ENDPOINT_URL:動態饋給端點網址。
    • API_KEY:用於向 Google Security Operations 驗證的 API 金鑰。
    • SECRET:您用來驗證動態饋給而產生的密鑰。

在 ntopng 上為 Google SecOps 設定 Webhook

  1. 登入 ntopng 網頁介面。
  2. 在下拉式選單中選取「系統」選單。
  3. 依序前往「通知」>「端點」
  4. 按一下「新增」
  5. 指定下列輸入參數的值:
    • 端點名稱:提供不重複且具描述性的名稱 (例如「Google SecOps」)。
    • 端點類型:從清單中選取「Webhook」
    • Webhook 網址:輸入 Google SecOps 的 ENDPOINT_URL,並附上 API_KEYSECRET
  6. 按一下「新增」。
  7. 依序前往「通知」>「收件者」
  8. 按一下「新增」
  9. 指定下列輸入參數的值:
    • 收件者名稱:提供不重複且具描述性的名稱 (例如「Google SecOps」)。
    • 選取端點:選取先前建立的端點。
    • 嚴重程度:選取要傳送至 Google SecOps 的嚴重程度 (例如「資訊」、「警告」和「錯誤」)。
    • 類別篩選器:選取要傳送至 Google SecOps 的內容。
  10. 按一下「測試收件者」,驗證連線。
  11. 按一下「新增」即可儲存 webhook。

設定 ntopng Webhook 資源訂閱者

  1. 前往「集區」
  2. 選取要分享事件的資源

  3. 按一下「動作」欄中的「鉛筆」圖示

  4. 按一下「收件者」下拉式選單。

  5. 選取 Google SecOps Webhook 收件者。

  6. 按一下「編輯」即可儲存設定。

  7. 針對其他資源重複執行這項程序。

UDM 對應表

記錄欄位 UDM 對應 邏輯
action security_result.detection_fields.key=actionsecurity_result.detection_fields.value=%{action} 原始記錄檔中的 action 值會對應至鍵為「action」的 security_result.detection_fields 物件。
alert_generation.host_info.broadcast_domain_host security_result.detection_fields.key=host_info broadcast_domain_hostsecurity_result.detection_fields.value=%{alert_generation.host_info.broadcast_domain_host} 來自巢狀 JSON 的 alert_generation.host_info.broadcast_domain_host 值會對應至鍵為「host_info broadcast_domain_host」的 security_result.detection_fields 物件。
alert_generation.host_info.dhcpHost security_result.detection_fields.key=host_info dhcpHostsecurity_result.detection_fields.value=%{alert_generation.host_info.dhcpHost} 來自巢狀 JSON 的 alert_generation.host_info.dhcpHost 值會對應至鍵為「host_info dhcpHost」的 security_result.detection_fields 物件。
alert_generation.host_info.is_blacklisted security_result.detection_fields.key=host_info is_blacklistedsecurity_result.detection_fields.value=%{alert_generation.host_info.is_blacklisted} 來自巢狀 JSON 的 alert_generation.host_info.is_blacklisted 值會對應至 security_result.detection_fields 物件,鍵為「host_info is_blacklisted」。
alert_generation.host_info.is_broadcast security_result.detection_fields.key=host_info is_broadcastsecurity_result.detection_fields.value=%{alert_generation.host_info.is_broadcast} 來自巢狀 JSON 的 alert_generation.host_info.is_broadcast 值會對應至鍵為「host_info is_broadcast」的 security_result.detection_fields 物件。
alert_generation.host_info.is_multicast security_result.detection_fields.key=host_info is_multicastsecurity_result.detection_fields.value=%{alert_generation.host_info.is_multicast} 來自巢狀 JSON 的 alert_generation.host_info.is_multicast 值會對應至鍵為「host_info is_multicast」的 security_result.detection_fields 物件。
alert_generation.host_info.localhost security_result.detection_fields.key=host_info localhostsecurity_result.detection_fields.value=%{alert_generation.host_info.localhost} 來自巢狀 JSON 的 alert_generation.host_info.localhost 值會對應至鍵為「host_info localhost」的 security_result.detection_fields 物件。
alert_generation.host_info.privatehost security_result.detection_fields.key=host_info privatehostsecurity_result.detection_fields.value=%{alert_generation.host_info.privatehost} 來自巢狀 JSON 的 alert_generation.host_info.privatehost 值會對應至鍵為「host_info privatehost」的 security_result.detection_fields 物件。
alert_generation.host_info.systemhost security_result.detection_fields.key=host_info systemhostsecurity_result.detection_fields.value=%{alert_generation.host_info.systemhost} 來自巢狀 JSON 的 alert_generation.host_info.systemhost 值會對應至鍵為「host_info systemhost」的 security_result.detection_fields 物件。
alert_generation.script_key security_result.category_details=%{alert_generation.script_key} 來自巢狀 JSON 的 alert_generation.script_key 值會對應至 security_result.category_details
alert_generation.subdir security_result.detection_fields.key=alert_generation_subdirsecurity_result.detection_fields.value=%{alert_generation.subdir} 來自巢狀 JSON 的 alert_generation.subdir 值會對應至鍵為「alert_generation_subdir」的 security_result.detection_fields 物件。
alert_id security_result.detection_fields.key=alert_idsecurity_result.detection_fields.value=%{alert_id} 原始記錄的 alert_id 值會對應至鍵為「alert_id」的 security_result.detection_fields 物件。
alerts_map security_result.detection_fields.key=alerts_mapsecurity_result.detection_fields.value=%{alerts_map} 原始記錄中的 alerts_map 值會對應至鍵為「alerts_map」的 security_result.detection_fields 物件。
cli2srv_bytes network.sent_bytes 原始記錄檔中的 cli2srv_bytes 值會轉換為無正負號整數,並對應至 network.sent_bytes
cli_asn principal.resource.attribute.labels.key=cli_asnprincipal.resource.attribute.labels.value=%{cli_asn} 原始記錄的 cli_asn 值會轉換為字串,並對應至鍵為「cli_asn」的 principal.resource.attribute.labels 物件。
cli_blacklisted principal.resource.attribute.labels.key=cli_blacklistedprincipal.resource.attribute.labels.value=%{cli_blacklisted} 原始記錄中的 cli_blacklisted 值會轉換為字串,並對應至鍵為「cli_blacklisted」的 principal.resource.attribute.labels 物件。
cli_city_name principal.location.city 原始記錄檔中的 cli_city_name 值會對應至 principal.location.city
cli_continent_name principal.resource.attribute.labels.key=cli_continent_nameprincipal.resource.attribute.labels.value=%{cli_continent_name} 原始記錄檔中的 cli_continent_name 值會對應至鍵為「cli_continent_name」的 principal.resource.attribute.labels 物件。
cli_country_name principal.location.country_or_region 原始記錄檔中的 cli_country_name 值會對應至 principal.location.country_or_region
cli_host_pool_id principal.resource.attribute.labels.key=cli_host_pool_idprincipal.resource.attribute.labels.value=%{cli_host_pool_id} 原始記錄中的 cli_host_pool_id 值會轉換為字串,並對應至鍵為「cli_host_pool_id」的 principal.resource.attribute.labels 物件。
cli_ip principal.ipprincipal.asset.ip 原始記錄檔中的 cli_ip 值會對應至 principal.ipprincipal.asset.ip
cli_localhost principal.resource.attribute.labels.key=cli_localhostprincipal.resource.attribute.labels.value=%{cli_localhost} 原始記錄檔中的 cli_localhost 值會轉換為字串,並對應至鍵為「cli_localhost」的 principal.resource.attribute.labels 物件。
cli_location principal.location.name 原始記錄檔中的 cli_location 值會轉換為字串。如果不是「0」,則會對應至 principal.location.name
cli_name principal.hostnameprincipal.asset.hostname 原始記錄檔中的 cli_name 值會對應至 principal.hostnameprincipal.asset.hostname
cli_network principal.resource.attribute.labels.key=cli_networkprincipal.resource.attribute.labels.value=%{cli_network} 原始記錄檔中的 cli_network 值會轉換為字串,並對應至鍵為「cli_network」的 principal.resource.attribute.labels 物件。
cli_port principal.port 原始記錄檔中的 cli_port 值會轉換為整數,並對應至 principal.port
entity_id principal.resource.attribute.labels.key=entity_idprincipal.resource.attribute.labels.value=%{entity_id} 原始記錄檔中的 entity_id 值會轉換為字串,並對應至鍵為「entity_id」的 principal.resource.attribute.labels 物件。
entity_val principal.resource.attribute.labels.key=entity_valprincipal.resource.attribute.labels.value=%{entity_val} 原始記錄檔中的 entity_val 值會對應至鍵為「entity_val」的 principal.resource.attribute.labels 物件,除非該值等於 ip 的值。
event.type metadata.event_type 取決於剖析器邏輯,根據 principaltargetnetwork 欄位的存在情形而定。可能的值:NETWORK_FLOWNETWORK_UNCATEGORIZEDUSER_RESOURCE_ACCESSGENERIC_EVENT
first_seen principal.asset.first_seen_time 原始記錄檔中的 first_seen 值會轉換為字串,並以 Epoch 紀元時間起算的毫秒數解析,然後對應至 principal.asset.first_seen_time
flow_risk_bitmap security_result.detection_fields.key=flow_risk_bitmapsecurity_result.detection_fields.value=%{flow_risk_bitmap} 原始記錄檔中的 flow_risk_bitmap 值會轉換為字串,並對應至鍵為「flow_risk_bitmap」的 security_result.detection_fields 物件。
granularity security_result.detection_fields.key=granularitysecurity_result.detection_fields.value=%{granularity} 原始記錄的 granularity 值會轉換為字串,並對應至鍵為「granularity」的 security_result.detection_fields 物件。
hash_entry_id security_result.detection_fields.key=hash_entry_idsecurity_result.detection_fields.value=%{hash_entry_id} 來自巢狀 JSON 的 hash_entry_id 值會對應至鍵為「hash_entry_id」的 security_result.detection_fields 物件。
host_ip principal.ipprincipal.asset.ip 從訊息的 <INT>Oct 20 15:34:53 1.1.1.1 部分擷取的 IP 位址會對應至 principal.ipprincipal.asset.ip
ifid principal.asset_id 原始記錄檔中的 ifid 值會轉換為字串,並透過前置字串「ifid:」對應至 principal.asset_id
ip principal.ipprincipal.asset.iptarget.iptarget.asset.ip 如果 is_client 為 true,原始記錄檔中的 ip 值會對應至 principal.ipprincipal.asset.ip。如果 is_server 為 true,則會對應至 target.iptarget.asset.ip
is_cli_attacker security_result.detection_fields.key=is_cli_attackersecurity_result.detection_fields.value=%{is_cli_attacker} 原始記錄的 is_cli_attacker 值會轉換為字串,並對應至鍵為「is_cli_attacker」的 security_result.detection_fields 物件。
is_cli_victim security_result.detection_fields.key=is_cli_victimsecurity_result.detection_fields.value=%{is_cli_victim} 原始記錄中的 is_cli_victim 值會轉換為字串,並對應至鍵為「is_cli_victim」的 security_result.detection_fields 物件。
is_flow_alert security_result.detection_fields.key=is_flow_alertsecurity_result.detection_fields.value=%{is_flow_alert}security_result.detection_fields.key=alert typesecurity_result.detection_fields.value=flow 原始記錄檔中的 is_flow_alert 值會轉換為字串,並對應至鍵為「is_flow_alert」的 security_result.detection_fields 物件。如果 is_flow_alert 為 true,系統也會建立 security_result.detection_fields 物件,其中鍵為「alert type」,值為「flow」。
is_srv_attacker security_result.detection_fields.key=is_srv_attackersecurity_result.detection_fields.value=%{is_srv_attacker} 原始記錄中的 is_srv_attacker 值會轉換為字串,並對應至鍵為「is_srv_attacker」的 security_result.detection_fields 物件。
is_srv_victim security_result.detection_fields.key=is_srv_victimsecurity_result.detection_fields.value=%{is_srv_victim} 原始記錄檔中的 is_srv_victim 值會轉換為字串,並對應至鍵為「is_srv_victim」的 security_result.detection_fields 物件。
metadata.product_name metadata.product_name=NTOPNG 已硬式編碼為「NTOPNG」。
metadata.vendor_name metadata.vendor_name=%{vendor_name} 訊息中的 vendor_name 值會對應至 metadata.vendor_name
name principal.hostnameprincipal.asset.hostnametarget.hostnametarget.asset.hostname 如果 is_client 為 true,原始記錄檔中的 name 值會對應至 principal.hostnameprincipal.asset.hostname。如果 is_server 為 true,則會對應至 target.hostnametarget.asset.hostname
ntopng_key security_result.detection_fields.key=ntopng_keysecurity_result.detection_fields.value=%{ntopng_key} 來自巢狀 JSON 的 ntopng.key 值 (已重新命名為 ntopng_key) 會對應至鍵為「ntopng_key」的 security_result.detection_fields 物件。
observation_point_id observer.asset_id 原始記錄檔中的 observation_point_id 值會轉換為字串。如果不是「0」,則會以「id:」前置字串對應至 observer.asset_id
pool_id principal.resource.attribute.labels.key=pool_idprincipal.resource.attribute.labels.value=%{pool_id} 原始記錄的 pool_id 值會轉換為字串,並對應至鍵為「pool_id」的 principal.resource.attribute.labels 物件。
probe_ip intermediary.ip 原始記錄檔中的 probe_ip 值會對應至 intermediary.ip
proto.confidence security_result.confidence_details 原始記錄中的 proto.confidence 值會轉換為字串,並對應至 security_result.confidence_details
proto.http.last_method network.http.method 原始記錄檔中的 proto.http.last_method 值會對應至 network.http.method
proto.http.last_return_code network.http.response_code 原始記錄檔中的 proto.http.last_return_code 值會轉換為整數,並對應至 network.http.response_code
proto.http.last_server_name network.tls.client.server_name 原始記錄檔中的 proto.http.server_name 值會對應至 network.tls.client.server_name
proto.http.last_url network.http.referral_url 原始記錄檔中的 proto.http.last_url 值會對應至 network.http.referral_url
proto.http.last_user_agent network.http.user_agent 原始記錄檔中的 proto.http.last_user_agent 值會對應至 network.http.user_agent
proto.http.server_name network.tls.client.server_name 原始記錄檔中的 proto.http.server_name 值會對應至 network.tls.client.server_name
proto.l4 network.ip_protocol 原始記錄檔中的 proto.l4 值會對應至 network.ip_protocol
proto_ndpi additional.fields.key=proto ndpiadditional.fields.value.string_value=%{proto_ndpi}network.application_protocol 原始記錄檔中的 proto.ndpi 值 (已重新命名為 proto_ndpi) 會對應至鍵為「proto ndpi」的 additional.fields 物件。也用於根據「NTP」和「HTTP」等關鍵字判斷 network.application_protocol 的值。
proto_ndpi_app principal.application 原始記錄檔中的 proto_ndpi_app 值會對應至 principal.application
proto_ndpi_breed security_result.detection_fields.key=proto_ndpi_breedsecurity_result.detection_fields.value=%{proto_ndpi_breed} 原始記錄檔中的 proto_ndpi_breed 值會轉換為字串,並對應至鍵為「proto_ndpi_breed」的 security_result.detection_fields 物件。
proto_ndpi_cat security_result.category_details 原始記錄檔中的 proto_ndpi_cat 值會對應至 security_result.category_details
proto_ndpi_cat_id security_result.detection_fields.key=proto_ndpi_cat_idsecurity_result.detection_fields.value=%{proto_ndpi_cat_id} 原始記錄中的 proto_ndpi_cat_id 值會轉換為字串,並對應至鍵為「proto_ndpi_cat_id」的 security_result.detection_fields 物件。
score security_result.detection_fields.key=scoresecurity_result.detection_fields.value=%{score} 原始記錄的 score 值會轉換為字串,並對應至鍵為「score」的 security_result.detection_fields 物件。
srv2cli_bytes network.received_bytes 原始記錄檔中的 srv2cli_bytes 值會轉換為無正負號整數,並對應至 network.received_bytes
srv_asn target.resource.attribute.labels.key=srv_asntarget.resource.attribute.labels.value=%{srv_asn} 原始記錄中的 srv_asn 值會轉換為字串,並對應至鍵為「srv_asn」的 target.resource.attribute.labels 物件。
srv_blacklisted target.resource.attribute.labels.key=srv_blacklistedtarget.resource.attribute.labels.value=%{srv_blacklisted} 原始記錄中的 srv_blacklisted 值會轉換為字串,並對應至鍵為「srv_blacklisted」的 target.resource.attribute.labels 物件。
srv_city_name target.location.city 原始記錄檔中的 srv_city_name 值會對應至 target.location.city
srv_continent_name target.resource.attribute.labels.key=srv_continent_nametarget.resource.attribute.labels.value=%{srv_continent_name} 原始記錄檔中的 srv_continent_name 值會對應至鍵為「srv_continent_name」的 target.resource.attribute.labels 物件。
srv_country_name target.location.country_or_region 原始記錄檔中的 srv_country_name 值會對應至 target.location.country_or_region
srv_host_pool_id target.resource.attribute.labels.key=srv_host_pool_idtarget.resource.attribute.labels.value=%{srv_host_pool_id} 原始記錄中的 srv_host_pool_id 值會轉換為字串,並對應至鍵為「srv_host_pool_id」的 target.resource.attribute.labels 物件。
srv_ip target.iptarget.asset.ip 原始記錄檔中的 srv_ip 值會對應至 target.iptarget.asset.ip
srv_localhost target.resource.attribute.labels.key=srv_localhosttarget.resource.attribute.labels.value=%{srv_localhost} 原始記錄檔中的 srv_localhost 值會轉換為字串,並對應至鍵為「srv_localhost」的 target.resource.attribute.labels 物件。
srv_location target.location.name 原始記錄檔中的 srv_location 值會轉換為字串。如果不是「0」,則會對應至 target.location.name
srv_location_lat target.location.region_coordinates.latitude 原始記錄檔中的 srv_location_lat 值會對應至 target.location.region_coordinates.latitude
srv_location_lon target.location.region_coordinates.longitude 原始記錄檔中的 srv_location_lon 值會對應至 target.location.region_coordinates.longitude
srv_name target.hostnametarget.asset.hostname 原始記錄檔中的 srv_name 值會對應至 target.hostnametarget.asset.hostname
srv_network target.resource.attribute.labels.key=srv_networktarget.resource.attribute.labels.value=%{srv_network} 原始記錄中的 srv_network 值會轉換為字串,並對應至鍵為「srv_network」的 target.resource.attribute.labels 物件。
srv_port target.port 原始記錄檔中的 srv_port 值會轉換為整數,並對應至 target.port
tstamp additional.fields.key=tstampadditional.fields.value.string_value=%{tstamp} 原始記錄的 tstamp 值會轉換為字串,並對應至鍵為「tstamp」的 additional.fields 物件。
vlan_id principal.resource.attribute.labels.key=vlan_idprincipal.resource.attribute.labels.value=%{vlan_id} 原始記錄的 vlan_id 值會轉換為字串,並對應至鍵為「vlan_id」的 principal.resource.attribute.labels 物件。
when metadata.event_timestamp 原始記錄檔中的 when 值會解析為時間戳記,並對應至 metadata.event_timestamp

異動

2024-02-01

  • 修正錯誤:
  • 在 conf 檔案的標頭註解中,將「=>" 變更為「:"。

2023-11-16

  • 新建的剖析器。

還有其他問題嗎?向社群成員和 Google SecOps 專家尋求解答。