共用方式為


使用安裝程式腳本式部署,在 Linux 上部署 適用於端點的 Microsoft Defender

簡介

你可以透過各種工具和方法在 Linux 上部署 Defender for Endpoint 。 本文說明如何透過安裝程式腳本自動化部署 Defender for Endpoint 在 Linux 上。 這個腳本會識別發行版和版本,選擇正確的儲存庫,設定裝置拉取最新的代理版本,並利用啟動套件將裝置導入 Defender for Endpoint。 此方法強烈推薦以簡化部署流程。

如需使用其他方法,請參考 相關內容章節

重要事項

如果你想並行運行多個安全解決方案,請參閱 效能、設定與支援的考量

你可能已經為適用於端點的 Microsoft Defender 裝置設定了相互安全排除。 如果你仍需設定相互排除以避免衝突,請參閱「新增 適用於端點的 Microsoft Defender」到你現有解決方案的排除清單中。

前置條件與系統需求

在開始之前,請參考 Linux 上 Defender for Endpoint 的前置條件 說明與系統需求。

提示

在執行安裝程式腳本部署 Defender 之前,建議先執行腳本並選擇 --pre-req 在部署前檢查最低系統需求 (記憶體、CPU、磁碟空間、支援作業系統) 。

部署程序

  1. 請依照以下步驟從 Microsoft Defender 入口網站下載入職套件:

    1. Microsoft Defender 入口網站中,展開「系統」區塊,選擇「設定>端點>管理>裝置啟動」。

    2. 在第一個下拉選單中,選擇 Linux Server 作為作業系統。

    3. 在第二個下拉選單中,選擇「 本地腳本 」作為部署方法。

    4. 選取 [下載上線套件]。 將檔案儲存為 WindowsDefenderATPOnboardingPackage.zip

      截圖顯示下載入職套件的選項。

    5. 從命令提示字元擷取壓縮檔內容:

      unzip WindowsDefenderATPOnboardingPackage.zip
      
      Archive:  WindowsDefenderATPOnboardingPackage.zip
      inflating: MicrosoftDefenderATPOnboardingLinuxServer.py
      

      警告

      重新打包 Defender for Endpoint 安裝套件並非支援的情境。 這樣做可能會對產品的完整性產生負面影響,導致不良後果,包括但不限於觸發竄改警示及更新未生效。

      重要事項

      若漏接此步驟,執行的任何指令都會顯示警告訊息,表示該產品未授權。 另外,mdatp health 指令回傳的值是 false。

  2. 下載我們公開 GitHub 倉庫提供的安裝程式 bash 腳本

  3. 授予安裝程式腳本執行檔權限:

    chmod +x mde_installer.sh
    
  4. 執行安裝程式腳本,並提供導入套件作為參數,安裝代理程式並將裝置接入至 Defender 入口網站。

    sudo ./mde_installer.sh --install --onboard ./MicrosoftDefenderATPOnboardingLinuxServer.py --channel prod --pre-req
    

    此指令會將最新的代理程式版本部署至生產通道,檢查最低系統需求 (記憶體、CPU、磁碟空間、支援的作業系統) ,並將裝置導入 Defender Portal。

    此外,你還可以根據需求通過更多參數來修改安裝。 查看幫助以了解所有可用選項:

     ❯ ./mde_installer.sh --help
    mde_installer.sh v0.7.0
    usage: basename ./mde_installer.sh [OPTIONS]
    Options:
    -c|--channel              specify the channel (insiders-fast / insiders-slow / prod) from which to install. Default: prod
    -i|--install              install the product
    -r|--remove               uninstall the product
    -u|--upgrade              upgrade the existing product to a newer version if available
    -l|--downgrade            downgrade the existing product to an older version if available
    -o|--onboard <script>     onboard MDE with the specified onboarding script
    -f|--offboard <script>    offboard MDE with the specified offboarding script
    -p|--passive-mode         set real-time protection to passive mode
    -a|--rtp-mode             set real-time protection to active mode. Passive-mode and rtp-mode are mutually exclusive
    -t|--tag                  set a tag by declaring <name> and <value>, e.g.: -t GROUP Coders
    -q|--pre-req              check minimum system requirements for MDE (memory, CPU, disk space, supported OS) without installing
    -x|--skip_conflict        skip conflicting application verification
    -w|--clean                remove MDE repository from the package manager for the specified channel
    -y|--yes                  assume yes for all mid-process prompts (default, deprecated)
    -n|--no                   disable the default assume-yes behavior for prompts
    -s|--verbose              enable verbose output
    -v|--version              print the script version
    -d|--debug                enable debug mode
    --log-path <PATH>         also log output to PATH
    --http-proxy <URL>        set http proxy
    --https-proxy <URL>       set https proxy
    --ftp-proxy <URL>         set ftp proxy
    --mdatp <version>         install a specific version of MDE; uses the latest if not provided
    --use-local-repo          skip MDE repository setup and use the locally configured repository
    -b|--install-path <PATH>  specify the installation and configuration path for MDE. Default: /
    -h|--help                 display help
    
案例 命令
安裝到自訂路徑位置 sudo ./mde_installer.sh --install --onboard ./MicrosoftDefenderATPOnboardingLinuxServer.py --channel prod --pre-req --install-path /custom/path/location
安裝特定的代理版本 sudo ./mde_installer.sh --install --channel prod --onboard ./MicrosoftDefenderATPOnboardingLinuxServer.py --pre-req –-mdatp 101.24082.0004
升級至最新代理版本 sudo ./mde_installer.sh --upgrade
升級到特定代理版本 sudo ./mde_installer.sh --upgrade –-mdatp 101.24082.0004
降級至特定代理版本 sudo ./mde_installer.sh --downgrade –-mdatp 101.24082.0004
卸載代理 sudo ./mde_installer.sh --remove
只執行前置檢查 (不安裝) sudo ./mde_installer.sh --pre-req

關於如何安裝自訂路徑的細節,請參考: 在 Linux 上安裝 Defender for Endpoint 以自訂路徑為例。

注意事項

  • 在安裝產品後升級作業系統到新的主要版本時,必須重新安裝產品。 你需要先在 Linux 上卸載現有的 Defender for Endpoint,升級作業系統,然後在 Linux 上重新設定 Defender for Endpoint。
  • 安裝 Defender for Endpoint 後,安裝路徑無法更改。 若要使用不同路徑,請先在新位置卸載並重新安裝產品。

確認部署狀態

  1. Microsoft Defender 入口網站中,打開裝置清單。 裝置可能要等 5 到 20 分鐘才會出現在傳送門裡。

  2. 執行防毒軟體偵測測試,確認裝置已正確上線並回報給服務單位。 對新上線的裝置執行以下步驟:

    1. 確保啟用即時保護 (true 以執行以下指令) 表示:

      mdatp health --field real_time_protection_enabled
      

      如果沒有啟用,請執行以下指令:

      mdatp config real-time-protection --value enabled
      
    2. 打開終端機視窗並執行以下指令以執行偵測測試:

      curl -o /tmp/eicar.com.txt https://secure.eicar.org/eicar.com.txt
      
    3. 你可以使用以下任一指令對壓縮檔執行更多偵測測試:

      curl -o /tmp/eicar_com.zip https://secure.eicar.org/eicar_com.zip
      curl -o /tmp/eicarcom2.zip https://secure.eicar.org/eicarcom2.zip
      
    4. 這些檔案應該會被 Linux 上的 Defender for Endpoint 隔離。 請使用以下指令列出所有偵測到的威脅:

      mdatp threat list
      
  3. 執行 EDR 偵測測試並模擬偵測,以確認裝置已正確上線並向服務單位報告。 對新上線的裝置執行以下步驟:

    1. 下載並解壓腳 本檔 到內建的 Linux 伺服器。

    2. 授予腳本執行檔權限:

      chmod +x mde_linux_edr_diy.sh
      
    3. 執行下列命令:

      ./mde_linux_edr_diy.sh
      
    4. 幾分鐘後,Microsoft Defender 全面偵測回應應會升起偵測。

    5. 檢查警示細節、機器時間軸,並執行你平常的調查步驟。

適用於端點的 Microsoft Defender 套件外部套件依賴關係

如果 適用於端點的 Microsoft Defender 安裝因缺少相依關係錯誤而失敗,您可以手動下載所需的相依。

以下為該 mdatp 套件提供外部套件相依關係:

  • mdatp RPM 套件需要—— glibc >= 2.17
  • 對於 DEBIAN 來說,該 mdatp 套件需要 libc6 >= 2.23
  • 對於 Mariner,該mdatp套件需要 attrdiffutilslibacllibattrlibselinux-utils,,。 selinux-policypolicycoreutils

注意事項

從版本 101.24082.0004開始,Linux 上的 Defender for Endpoint 不再支援事件 Auditd 提供者。 我們正全面轉向更有效率的 eBPF 技術。 如果你 eBPF 的機器不支援,或有特定需求必須維持在 Auditd,且你的機器使用 Linux 版本 101.24072.0001 或更早版本的 Defender for Endpoint,則對審核套件存在 mdatp其他依賴。 對於比 101.25032.0000之前的版本:

  • RPM 套件需求: mde-netfilterpcre
  • DEBIAN 套件需求: mde-netfilterlibpcre3
  • mde-netfilter 套件還有以下套件相依關係:- 對於 DEBIAN,mde-netfilter 套件需要 libnetfilter-queue1libglib2.0-0 - 對於 RPM,mde-netfilter 套件需要 libmnllibnfnetlinklibnetfilter_queue,且 glib2 從版本 101.25042.0003開始,uuid-runtime 不再需要作為外部依賴。

安裝問題的疑難排解

如果你遇到安裝問題,為了自我排查,請遵循以下步驟:

  1. 關於安裝錯誤發生時自動產生的日誌,請參見 「安裝日誌問題」。

  2. 有關常見安裝問題的資訊,請參見 安裝問題

  3. 若裝置健康狀況為 false,請參見 Defender for Endpoint 代理健康問題

  4. 關於產品效能問題,請參見 故障排除效能問題

  5. 關於代理與連線問題,請參見 「排除雲端連線問題」。

要獲得 Microsoft 的支援,請開啟支援單,並提供使用 用戶端分析器建立的日誌檔案。

如何切換頻道

例如,要將頻道從 Insiders-Fast 切換到製作頻道,請執行以下操作:

  1. 在 Linux 上卸載 Insiders-Fast channel Defender for Endpoint 版本。

    sudo yum remove mdatp
    
  2. 在 Linux Insiders-Fast 倉庫中停用 Defender for Endpoint。

    sudo yum repolist
    

    注意事項

    輸出應該會顯示 packages-microsoft-com-fast-prod

    sudo yum-config-manager --disable packages-microsoft-com-fast-prod
    
  3. 使用 Linux 的生產通道重新部署 適用於端點的 Microsoft Defender。

Linux 上的 Defender for Endpoint 可從以下其中一個通道部署 (標記為 [channel]) :

  • insiders-fast
  • insiders-slow
  • prod

這些頻道各自對應一個 Linux 軟體倉庫。 本文的說明說明如何設定您的裝置以使用這些儲存庫之一。

頻道的選擇決定了你裝置所提供的更新類型與頻率。 內部人快速裝置是最早獲得更新和新功能的,接著是內部人慢速,最後是生產環境。

為了預覽新功能並提供早期回饋,建議您在企業中設定部分裝置使用 insiders-fastinsiders-slow

警告

初始安裝後切換通道需重新安裝產品。 切換產品通道:解除安裝現有套件,重新設定裝置使用新通道,並依照本文件步驟從新位置安裝套件。

如何在 Linux 上設定 Microsoft Defender 的政策

要設定防毒軟體與EDR設定,請參閱以下文章: