在 macOS 或 Linux 上运行客户端分析器

适用于:

XMDEClientAnalyzer 用于诊断运行 Linux 或 macOS 的载入设备上的 Microsoft Defender for Endpoint 运行状况或可靠性问题。

有两种方法可以运行客户端分析器工具:

  1. 使用二进制版本 (无 Python 依赖项)
  2. 使用基于 Python 的解决方案

运行客户端分析器的二进制版本

  1. XMDE 客户端分析器二进制 工具下载到需要调查的 macOS 或 Linux 计算机。
    如果使用的是终端,请通过输入以下命令下载该工具:

    wget --quiet -O XMDEClientAnalyzerBinary.zip https://aka.ms/XMDEClientAnalyzerBinary
    
  2. 验证下载。

    注意

    从此链接下载的“XMDEClientAnalyzerBinary.zip”的当前 SHA256 哈希为:“51EC534507729D3A5056D596644FE5768BF1CCED266C8AC514CFCF11A6F12B97”

    • Linux
    echo '51EC534507729D3A5056D596644FE5768BF1CCED266C8AC514CFCF11A6F12B97 XMDEClientAnalyzerBinary.zip' | sha256sum -c
    
    • macOS
    echo '51EC534507729D3A5056D596644FE5768BF1CCED266C8AC514CFCF11A6F12B97  XMDEClientAnalyzerBinary.zip' | shasum -a 256 -c
    
  3. 提取计算机上 XMDEClientAnalyzerBinary.zip 的内容。

    如果使用的是终端,请通过输入以下命令提取文件:

    unzip -q XMDEClientAnalyzerBinary.zip -d XMDEClientAnalyzerBinary
    
  4. 通过输入以下命令来更改工具的目录:

    cd XMDEClientAnalyzerBinary
    
  5. 将生成三个新的 zip 文件:

    • SupportToolLinuxBinary.zip :适用于所有 Linux 设备
    • SupportToolMacOSBinary.zip :适用于 Mac 设备
  6. 根据需要调查的计算机解压缩上述 2 个 zip 文件之一。
    使用终端时,请根据 OS 类型输入以下命令之一来解压缩文件:

    • Linux

      unzip -q SupportToolLinuxBinary.zip
      
    • Mac

      unzip -q SupportToolMacOSBinary.zip
      
  7. root 身份运行该工具以生成诊断包:

    sudo ./MDESupportTool -d
    

运行基于 Python 的客户端分析器

注意

  • 分析器依赖于几个额外的 PIP 包, (sh、发行版、lxml、pandas) 这些包在根目录时安装在 OS 中,以生成结果输出。 如果未安装,分析器将尝试从 Python 包的官方存储库中提取它。

    警告

    运行基于 Python 的客户端分析器需要安装 PIP 包,这可能会导致环境中的一些问题。 为了避免出现问题,建议将包安装到用户 PIP 环境中。

  • 此外,该工具当前需要安装 Python 版本 3 或更高版本。

  • 如果设备位于代理后面,则只需将代理服务器作为环境变量传递给mde_support_tool.sh脚本即可。 例如:。 https_proxy=https://myproxy.contoso.com:8080 ./mde_support_tool.sh"

  1. XMDE 客户端分析器 工具下载到需要调查的 macOS 或 Linux 计算机。

    如果使用终端,请运行以下命令下载该工具:

    wget --quiet -O XMDEClientAnalyzer.zip https://aka.ms/XMDEClientAnalyzer
    
  2. 验证下载

    • Linux
    echo '2B8EBB39857BA24E84E332366B42E041B46AB130F8C8FD4E6D68B195022FD61E XMDEClientAnalyzer.zip' | sha256sum -c
    
    • macOS
    echo '2B8EBB39857BA24E84E332366B42E041B46AB130F8C8FD4E6D68B195022FD61E  XMDEClientAnalyzer.zip' | shasum -a 256 -c
    
  3. 提取计算机上 XMDEClientAnalyzer.zip 的内容。 如果使用的是终端,请使用以下命令提取文件:

    unzip -q XMDEClientAnalyzer.zip -d XMDEClientAnalyzer
    
  4. 将目录更改为提取的位置。

    cd XMDEClientAnalyzer
    
  5. 为工具授予可执行权限:

    chmod a+x mde_support_tool.sh
    
  6. 以非 root 用户身份运行以安装所需的依赖项:

    ./mde_support_tool.sh
    
  7. 若要收集实际诊断包并生成结果存档文件,请再次以 root 身份运行:

    sudo ./mde_support_tool.sh -d
    

命令行选项

主命令行

使用以下命令获取计算机诊断。

-h, --help            show this help message and exit
--output OUTPUT, -o OUTPUT
                      Output path to export report
--outdir OUTDIR       Directory where diagnostics file will be generated
--no-zip, -nz         If set a directory will be created instead of an archive file
--force, -f           Will overwrite if output directory exists
--diagnostic, -d      Collect extensive machine diagnostic information
--bypass-disclaimer   Do not display disclaimer banner
--interactive, -i     Interactive diagnostic
--delay DELAY, -dd DELAY
                      Set MDATP log level. If you use interactive or delay mode, the log level will set to debug automatically, and reset after 48h.
--mdatp-log {info,debug,verbose,error,trace,warning}
                      Set MDATP log level
--max-log-size MAX_LOG_SIZE
                      Maximum log file size in MB before rotating(Will restart mdatp)

用法示例: sudo ./MDESupportTool -d

注意:日志级别自动重置功能仅在 2405 或更高版本的客户端版本中可用。

位置参数

收集性能信息

收集广泛的计算机性能跟踪,以便分析可按需重现的性能方案。

-h, --help            show this help message and exit
--frequency FREQUENCY
                      profile at this frequency
--length LENGTH       length of time to collect (in seconds)

用法示例: sudo ./MDESupportTool performance --frequency 2

仅将 OS 跟踪 (用于 macOS)

使用 OS 跟踪设施记录 Defender for Endpoint 性能跟踪。

注意

此功能仅存在于 Python 解决方案中。

-h, --help       show this help message and exit
--length LENGTH  Length of time to record the trace (in seconds).
--mask MASK      Mask to select with event to trace. Defaults to all

首次运行此命令时,它会安装配置文件配置。

按照以下说明批准配置文件安装: Apple 支持指南

用法示例 ./mde_support_tool.sh trace --length 5

排除模式

添加用于审核 d 监视的排除项。

注意

此功能仅适用于 Linux。

  -h, --help            show this help message and exit
  -e <executable>, --exe <executable>
                        exclude by executable name, i.e: bash
  -p <process id>, --pid <process id>
                        exclude by process id, i.e: 911
  -d <directory>, --dir <directory>
                        exclude by target path, i.e: /var/foo/bar
  -x <executable> <directory>, --exe_dir <executable> <directory>
                        exclude by executable path and target path, i.e: /bin/bash /var/foo/bar
  -q <q_size>, --queue <q_size>
                        set dispatcher q_depth size
  -r, --remove          remove exclusion file
  -s, --stat            get statistics about common executables
  -l, --list            list auditd rules
  -o, --override        Override the existing auditd exclusion rules file for mdatp
  -c <syscall number>, --syscall <syscall number>
                        exclude all process of the given syscall

用法示例: sudo ./MDESupportTool exclude -d /var/foo/bar

AuditD Rate Limiter

可用于限制 auditD 插件报告的事件数的语法。 此选项全局设置 AuditD 的速率限制,导致所有审核事件下降。 启用限制器后,审核的事件数限制为 2500 个事件/秒。在从 AuditD 端看到 CPU 使用率过高的情况下,可以使用此选项。

注意

此功能仅适用于 Linux。

-h, --help                                  show this help message and exit
-e <true/false>, --enable <true/false>      enable/disable the rate limit with default values

用法示例: sudo ./mde_support_tool.sh ratelimit -e true

注意

应谨慎使用此功能,因为会限制整个已审核子系统报告的事件数。 这也可以减少其他订阅者的事件数。

AuditD 跳过错误规则

使用此选项,可以在加载时跳过在审核规则文件中添加的错误规则。 此选项允许已审核的子系统继续加载规则,即使存在错误规则也是如此。 此选项汇总了加载规则的结果。 在后台,此选项使用 -c 选项运行 auditctl。

注意

此功能仅在 Linux 上可用。

-h, --help                                  show this help message and exit
-e <true/false>, --enable <true/false>      enable/disable the option to skip the faulty rules. In case no argumanet is passed, the option will be true by default.

用法示例: sudo ./mde_support_tool.sh skipfaultyrules -e true

注意

此功能将跳过错误规则。 然后需要进一步识别和修复错误规则。

macOS 和 Linux 上的结果包内容

  • report.html

    说明:主 HTML 输出文件,其中包含在计算机上运行的分析器脚本可以生成的发现结果和指导。

  • mde_diagnostic.zip

    说明:在 macOSLinux 上运行 mdatp 诊断创建时生成的相同诊断输出。

  • mde.xml

    说明:运行时生成的 XML 输出,用于生成 html 报表文件。

  • Processes_information.txt

    说明:包含系统上运行Microsoft Defender for Endpoint 相关进程的详细信息。

  • Log.txt

    说明:包含数据收集期间在屏幕上写入的相同日志消息。

  • Health.txt

    说明:运行 mdatp health 命令时显示的相同基本运行状况输出。

  • Events.xml

    说明:生成 HTML 报表时分析器使用的其他 XML 文件。

  • Audited_info.txt

    说明:有关 Linux OS 的审核服务和相关组件的详细信息。

  • perf_benchmark.tar.gz

    说明:性能测试报告。 仅当使用性能参数时,才会看到此参数。

提示

想要了解更多信息? 在技术社区中与 Microsoft 安全社区互动: Microsoft Defender for Endpoint 技术社区