使用基于安装程序脚本的部署在 Linux 上部署Microsoft Defender for Endpoint

适用于:

  • 服务器的Microsoft Defender for Endpoint
  • 服务器计划 1 或计划 2 的Microsoft Defender

简介

使用安装程序脚本在 Linux 上自动部署 Microsoft Defender for Endpoint。 此脚本标识分发和版本,选择正确的存储库,设置设备以拉取最新的代理版本,并使用载入包将设备载入到 Defender for Endpoint。 强烈建议使用此方法来简化部署过程。

先决条件和系统要求

在开始之前,请参阅 Linux 上的Microsoft Defender for Endpoint,了解先决条件和系统要求的说明。

部署过程

  1. 按照以下步骤从 Microsoft Defender 门户下载载入包:

    1. Microsoft Defender门户中,转到“设置>终结点”“>设备管理>”“载入”。

    2. 在第一个下拉菜单中,选择“ Linux 服务器 ”作为作系统。

    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 --min_req
    
    

    此命令将最新代理版本部署到生产通道,检查最低系统要求,并将设备载入 Defender 门户。

    此外,可以根据要求传递更多参数来修改安装。 查看所有可用选项的帮助:

    
    ❯ ./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 you want 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 a older version if available
    -o|--onboard         onboard the product with <onboarding_script>
    -f|--offboard        offboard the product with <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
    -m|--min_req         enforce minimum requirements
    -x|--skip_conflict   skip conflicting application verification
    -w|--clean           remove repo from package manager for a specific channel
    -y|--yes             assume yes for all mid-process prompts (default, deprecated)
    -n|--no              remove assume yes sign
    -s|--verbose         verbose output
    -v|--version         print out script version
    -d|--debug           set 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              specific version of mde to be installed. will use the latest if not provided
    -h|--help            display help
    
    
    应用场景 命令
    安装特定代理版本 sudo ./mde_installer.sh --install --channel prod --onboard ./MicrosoftDefenderATPOnboardingLinuxServer.py --min_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

    注意

    在产品安装后,将作系统升级到新的主版本需要重新安装产品。 需要卸载 Linux 上现有的 Defender for Endpoint,升级作系统,然后在 Linux 上重新配置 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. 可以使用以下命令之一对 zip 文件运行更多检测测试:

      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 XDR中引发检测。

    5. 检查警报详细信息、计算机时间线,并执行典型的调查步骤。

Microsoft Defender for Endpoint包外部包依赖项

如果Microsoft Defender for Endpoint安装因缺少依赖项错误而失败,可以手动下载所需的依赖项。

包存在 mdatp 以下外部包依赖项:

  • mdatp RPM 需要 - glibc >= 2.17policycoreutilsselinux-policy-targetedmde-netfilter
  • 对于 DEBIAN,包 mdatp 需要 libc6 >= 2.23uuid-runtimemde-netfilter
  • 对于 Mariner,包mdatp需要 attrdiffutils、、libacllibattrlibselinux-utilsselinux-policypolicycoreutilsmde-netfilter

注意

从版本 101.24082.0004开始,Linux 上的 Defender for Endpoint 不再支持 Auditd 事件提供程序。 我们正在完全过渡到更高效的 eBPF 技术。 如果 eBPF 计算机上不支持 ,或者存在保留 的特定要求 Auditd,并且计算机使用 Linux 版本或更低版本的 101.24072.0001 Defender for Endpoint,则审核包存在 mdatp以下附加依赖项:

mdatp 包依赖项

  • mdatp RPM 需要 auditsemanage
  • 对于 DEBIAN, mdatp 包需要 auditd
  • 对于 Mariner, mdatp 包需要 audit

mde-netfilter 依赖

mde-netfilter 还具有以下包依赖项:

  • 对于 DEBIAN,包 mde-netfilter 需要 libnetfilter-queue1libglib2.0-0
  • 对于 RPM,包mde-netfilter需要 、、libnfnetlinklibnetfilter_queueglib2libmnl
  • 对于 Mariner,包 mde-netfilter 需要 libnfnetlinklibnetfilter_queue

解决安装问题

如果遇到任何安装问题,请执行以下步骤进行自我故障排除:

  1. 有关如何查找发生安装错误时自动生成的日志的信息,请参阅 日志安装问题

  2. 有关常见安装问题的信息,请参阅 安装问题

  3. 如果设备的运行状况为 false,请参阅 Defender for Endpoint 代理运行状况问题

  4. 有关产品性能问题,请参阅 排查性能问题

  5. 有关代理和连接问题,请参阅 排查云连接问题

若要从Microsoft获取支持,请打开支持票证,并使用 客户端分析器提供创建的日志文件。

如何在通道之间切换

例如,若要将通道从 Insiders-Fast 更改为生产,请执行以下作:

  1. Insiders-Fast channel卸载 Linux 上的 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 for Endpoint。

可以从以下通道之一部署 Linux 上的 Defender for Endpoint, (表示为 [channel]) :

  • insiders-fast
  • insiders-slow
  • prod

其中每个通道都对应于 Linux 软件存储库。 本文中的说明介绍如何将设备配置为使用这些存储库之一。

通道的选择决定了提供给设备的更新的类型和频率。 预览体验成员中的设备是第一个接收更新和新功能的设备,然后是预览体验成员慢,最后是 prod。

为了预览新功能并提供早期反馈,建议将企业中的某些设备配置为使用 insiders-fastinsiders-slow

警告

在初始安装后切换通道需要重新安装产品。 若要切换产品通道:卸载现有包,将设备重新配置为使用新通道,然后按照本文档中的步骤从新位置安装包。

如何在 Linux 上为Microsoft Defender配置策略

可以在终结点上配置防病毒和 EDR 设置。 有关详细信息,请参阅以下文章:

提示

想要了解更多信息? Engage技术社区中的Microsoft安全社区:Microsoft Defender for Endpoint技术社区