Share via


適用於端點的 Microsoft Defender 運行時間保護服務的簡介

適用於端點的 Microsoft Defender (MDE) 執行時間保護服務提供工具來設定和管理 Nexus 叢集的運行時間保護。

Azure CLI 可讓您設定運行時間保護強制等級,以及在所有節點上觸發 MDE 掃描的能力。 本檔提供執行這些工作的步驟。

注意

MDE 執行時間保護服務與 適用於端點的 Microsoft Defender 整合,可提供完整的端點偵測和回應 (EDR) 功能。 透過 適用於端點的 Microsoft Defender 整合,您可以找出異常狀況並偵測弱點。

開始之前

設定變數

為了協助設定和觸發 MDE 掃描,請定義本指南中各種命令所使用的這些環境變數。

注意

這些環境變數值不會反映實際的部署,而且用戶必須變更它們以符合其環境。

# SUBSCRIPTION_ID: Subscription of your cluster
export SUBSCRIPTION_ID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
# RESOURCE_GROUP: Resource group of your cluster
export RESOURCE_GROUP="contoso-cluster-rg"
# MANAGED_RESOURCE_GROUP: Managed resource group managed by your cluster
export MANAGED_RESOURCE_GROUP="contoso-cluster-managed-rg"
# CLUSTER_NAME: Name of your cluster
export CLUSTER_NAME="contoso-cluster"

MDE 執行時間保護的預設值

當您部署叢集時,運行時間保護會設定為下列預設值

  • 強制層級: Disabled 如果在建立叢集時未指定,則為
  • MDE 服務: Disabled

注意

自變數 --runtime-protection enforcement-level="<enforcement level>" 有兩個用途:啟用/停用 MDE 服務和更新強制層級。

如果您要在叢集上停用 MDE 服務,請使用 <enforcement level>Disabled

設定強制層級

az networkcloud cluster update命令可讓您使用 自變數--runtime-protection enforcement-level="<enforcement level>"來更新叢集運行時間保護強制層級的設定。

下列命令會 enforcement level 設定叢集的 。

az networkcloud cluster update \
--subscription ${SUBSCRIPTION_ID} \
--resource-group ${RESOURCE_GROUP} \
--cluster-name ${CLUSTER_NAME} \
--runtime-protection enforcement-level="<enforcement level>"

允許的值<enforcement level>Disabled、、RealTimeOnDemandPassive

  • Disabled:實時保護已關閉,且不會執行掃描。
  • RealTime:實時保護(掃描檔案修改時)已啟用。
  • OnDemand:僅視需要掃描檔案。 在這裡:
    • 即時保護已關閉。
  • Passive:以被動模式執行防毒引擎。 在這裡:
    • 實時保護已關閉:Microsoft Defender 防毒軟體 不會補救威脅。
    • 開啟隨選掃描:仍會在端點上使用掃描功能。
    • 自動威脅補救已關閉:不會移動任何檔案,且安全性系統管理員應該採取必要的動作。
    • 安全性智慧更新已開啟:安全性系統管理員租使用者將會提供警示。

您可以檢查下列 json 代碼段的輸出,確認強制層級已更新:

  "runtimeProtectionConfiguration": {
    "enforcementLevel": "<enforcement level>"
  }

在所有節點上觸發 MDE 掃描

若要在叢集的所有節點上觸發 MDE 掃描,請使用下列命令:

az networkcloud cluster scan-runtime \
--subscription ${SUBSCRIPTION_ID} \
--resource-group ${RESOURCE_GROUP} \
--cluster-name ${CLUSTER_NAME} \
--scan-activity Scan

注意:MDE 掃描動作需要啟用 MDE 服務。 萬一未啟用,命令就會失敗。 在此情況下, Enforcement Level 請將 設定為不同於 Disabled 的值,以啟用 MDE 服務。

從每個節點擷取 MDE 掃描資訊

本節提供擷取 MDE 掃描資訊的步驟。 首先,您需要擷取叢集的節點名稱清單。 下列命令會將節點名稱清單指派給環境變數。

nodes=$(az networkcloud baremetalmachine list \
--subscription ${SUBSCRIPTION_ID} \
--resource-group ${MANAGED_RESOURCE_GROUP} \
| jq -r '.[].machineName')

透過節點名稱清單,我們可以啟動程式,以擷取叢集每個節點的 MDE 代理程式資訊。 下列命令會從每個節點準備 MDE 代理程式資訊。

for node in $nodes
do
    echo "Extracting MDE agent information for node ${node}"
    az networkcloud baremetalmachine run-data-extract \
    --subscription ${SUBSCRIPTION_ID} \
    --resource-group ${MANAGED_RESOURCE_GROUP} \
    --name ${node} \
    --commands '[{"command":"mde-agent-information"}]' \
    --limit-time-seconds 600
done

命令的結果會包含 URL,您可以在其中下載 MDE 掃描的詳細報告。 如需 MDE 代理程式資訊的結果,請參閱下列範例。

Extracting MDE agent information for node rack1control01
====Action Command Output====
Executing mde-agent-information command
MDE agent is running, proceeding with data extract
Getting MDE agent information for rack1control01
Writing to /hostfs/tmp/runcommand

================================
Script execution result can be found in storage account: 
 <url to download mde scan results>
 ...

擷取 MDE 掃描結果

擷取 MDE 掃描需要幾個手動步驟:若要下載 MDE 掃描報告並擷取掃描執行資訊,以及掃描詳細的結果報告。 本節將引導您進行這些步驟。

下載掃描報告

如先前所述,MDE 代理程式信息回應會提供儲存詳細報表數據的 URL。

從傳回的 URL <url to download mde scan results>下載報表,然後開啟 檔案 mde-agent-information.json

mde-agent-information.json 檔案包含許多有關掃描的資訊,而且分析這麼長的詳細報告可能非常困難。 本指南提供一些擷取一些重要資訊的範例,可協助您判斷是否需要徹底分析報表。

擷取 MDE 掃描清單

檔案 mde-agent-information.json 包含詳細的掃描報告,但您可能想要先將焦點放在一些詳細數據上。 本節詳細說明擷取掃描清單的步驟,提供每個掃描的開始和結束時間、找到的威脅、狀態(成功或失敗)等資訊。

下列命令會擷取這個簡化的報告。

cat <path to>/mde-agent-information.json| jq .scanList

下列範例顯示 從 mde-agent-information.json擷取的掃描報告。

[
  {
    "endTime": "1697204632487",
    "filesScanned": "1750",
    "startTime": "1697204573732",
    "state": "succeeded",
    "threats": [],
    "type": "quick"
  },
  {
    "endTime": "1697217162904",
    "filesScanned": "1750",
    "startTime": "1697217113457",
    "state": "succeeded",
    "threats": [],
    "type": "quick"
  }
]

您可以使用 Unix date 命令,以更容易閱讀的格式轉換時間。 為了方便起見,請參閱將 Unix 時間戳(以毫秒為單位)轉換為年月和小時:min:secs 的範例。

例如:

date -d @$(echo "1697204573732/1000" | bc) "+%Y-%m-%dT%H:%M:%S"

2023-10-13T13:42:53

擷取 MDE 掃描結果

本節詳述擷取有關 MDE 掃描期間所識別威脅清單的步驟。 若要從 mde-agent-information.json 檔案擷取掃描結果報告,請執行下列命令。

cat <path to>/mde-agent-information.json| jq .threatInformation

下列範例顯示從 mde-agent-information.json 檔案擷取的掃描所識別的威脅報告。

{
  "list": {
    "threats": {
      "scans": [
        {
          "type": "quick",
          "start_time": 1697204573732,
          "end_time": 1697204632487,
          "files_scanned": 1750,
          "threats": [],
          "state": "succeeded"
        },
        {
          "type": "quick",
          "start_time": 1697217113457,
          "end_time": 1697217162904,
          "files_scanned": 1750,
          "threats": [],
          "state": "succeeded"
        }
      ]
    }
  },
  "quarantineList": {
    "type": "quarantined",
    "threats": []
  }
}