0
(0)

This article describes how to deploy Microsoft Defender for Endpoint on Linux manually. A successful deployment requires the completion of all of the following tasks:

Prerequisites and system requirements

Before you get started, see Microsoft Defender for Endpoint on Linux for a description of prerequisites and system requirements for the current software version.

 Warning

Upgrading your operating system to a new major version after the product installation requires the product to be reinstalled. You need to Uninstall the existing Defender for Endpoint on Linux, upgrade the operating system, and then reconfigure Defender for Endpoint on Linux following the below steps.

Configure the Linux software repository

Defender for Endpoint on Linux can be deployed from one of the following channels (denoted below as [channel]): insiders-fastinsiders-slow, or prod. Each of these channels corresponds to a Linux software repository. Instructions for configuring your device to use one of these repositories are provided below.

The choice of the channel determines the type and frequency of updates that are offered to your device. Devices in insiders-fast are the first ones to receive updates and new features, followed later by insiders-slow and lastly by prod.

In order to preview new features and provide early feedback, it is recommended that you configure some devices in your enterprise to use either insiders-fast or insiders-slow.

 Warning

Switching the channel after the initial installation requires the product to be reinstalled. To switch the product channel: uninstall the existing package, re-configure your device to use the new channel, and follow the steps in this document to install the package from the new location.

RHEL and variants (CentOS, Fedora, Oracle Linux and Amazon Linux 2)

  • Install yum-utils if it isn’t installed yet:
    Bash

    sudo yum install yum-utils
    

     Note

    Your distribution and version, and identify the closest entry (by major, then minor) for it under https://packages.microsoft.com/config/rhel/.

    Use the following table to help guide you in locating the package:


    In the following commands, replace [version] and [channel] with the information you’ve identified:

    Bash

    sudo yum-config-manager --add-repo=https://packages.microsoft.com/config/rhel/[version]/[channel].repo
    

     Tip

    Use hostnamectl command to identify system related information including release [version].

    For example, if you are running CentOS 7 and want to deploy Defender for Endpoint on Linux from the prod channel:

    Bash

    sudo yum-config-manager --add-repo=https://packages.microsoft.com/config/rhel/7/prod.repo
    

    Or if you wish to explore new features on selected devices, you might want to deploy Microsoft Defender for Endpoint on Linux to insiders-fast channel:

    Bash

    sudo yum-config-manager --add-repo=https://packages.microsoft.com/config/rhel/7/insiders-fast.repo
    
  • Install the Microsoft GPG public key:
    Bash

    sudo rpm --import http://packages.microsoft.com/keys/microsoft.asc
    
  • Download and make usable all the metadata for the currently enabled yum repositories:
    Bash

    yum makecache
    

SLES and variants

 Note

Your distribution and version, and identify the closest entry (by major, then minor) for it under https://packages.microsoft.com/config/sles/.

In the following commands, replace [distro] and [version] with the information you’ve identified:

Bash

sudo zypper addrepo -c -f -n microsoft-[channel] https://packages.microsoft.com/config/[distro]/[version]/[channel].repo

 Tip

Use SPident command to identify system related information including release [version].

For example, if you are running SLES 12 and wish to deploy Microsoft Defender for Endpoint on Linux from the prod channel:

Bash

sudo zypper addrepo -c -f -n microsoft-prod https://packages.microsoft.com/config/sles/12/prod.repo
  • Install the Microsoft GPG public key:
    Bash

    sudo rpm --import http://packages.microsoft.com/keys/microsoft.asc
    

Ubuntu and Debian systems

  • Install curl if it isn’t installed yet:
    Bash

    sudo apt-get install curl
    
  • Install libplist-utils if it isn’t installed yet:
    Bash

    sudo apt-get install libplist-utils
    

 Note

Your distribution and version, and identify the closest entry (by major, then minor) for it under https://packages.microsoft.com/config/[distro]/.

In the below command, replace [distro] and [version] with the information you’ve identified:

Bash

 curl -o microsoft.list https://packages.microsoft.com/config/[distro]/[version]/[channel].list

 Tip

Use hostnamectl command to identify system related information including release [version].

For example, if you are running Ubuntu 18.04 and wish to deploy Microsoft Defender for Endpoint on Linux from the prod channel:

Bash

curl -o microsoft.list https://packages.microsoft.com/config/ubuntu/18.04/prod.list
  • Install the repository configuration:
    Bash

    sudo mv ./microsoft.list /etc/apt/sources.list.d/microsoft-[channel].list
    

    For example, if you chose prod channel:

    Bash

    sudo mv ./microsoft.list /etc/apt/sources.list.d/microsoft-prod.list
    
  • Install the gpg package if not already installed:
    Bash

    sudo apt-get install gpg
    

    If gpg is not available, then install gnupg.

    Bash

    sudo apt-get install gnupg
    
  • Install the Microsoft GPG public key:
    Bash

    curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
    
  • Install the https driver if it’s not already present:
    Bash

    sudo apt-get install apt-transport-https
    
  • Update the repository metadata:
    Bash

    sudo apt-get update
    

Application installation

  • RHEL and variants (CentOS and Oracle Linux):
    Bash

    sudo yum install mdatp
    

     Note

    If you have multiple Microsoft repositories configured on your device, you can be specific about which repository to install the package from. The following example shows how to install the package from the production channel if you also have the insiders-fast repository channel configured on this device. This situation can happen if you are using multiple Microsoft products on your device. Depending on the distribution and the version of your server, the repository alias might be different than the one in the following example.

    Bash

    # list all repositories
    yum repolist
    
    Output

    ...
    packages-microsoft-com-prod               packages-microsoft-com-prod        316
    packages-microsoft-com-prod-insiders-fast packages-microsoft-com-prod-ins      2
    ...
    
    Bash

    # install the package from the production repository
    sudo yum --enablerepo=packages-microsoft-com-prod install mdatp
    
  • SLES and variants:
    Bash

    sudo zypper install mdatp
    

     Note

    If you have multiple Microsoft repositories configured on your device, you can be specific about which repository to install the package from. The following example shows how to install the package from the production channel if you also have the insiders-fast repository channel configured on this device. This situation can happen if you are using multiple Microsoft products on your device.

    Bash

    zypper repos
    
    Output

    ...
    #  | Alias | Name | ...
    XX | packages-microsoft-com-insiders-fast | microsoft-insiders-fast | ...
    XX | packages-microsoft-com-prod | microsoft-prod | ...
    ...
    
    
    Bash

    sudo zypper install packages-microsoft-com-prod:mdatp
    
  • Ubuntu and Debian system:
    Bash

    sudo apt-get install mdatp
    

     Note

    If you have multiple Microsoft repositories configured on your device, you can be specific about which repository to install the package from. The following example shows how to install the package from the production channel if you also have the insiders-fast repository channel configured on this device. This situation can happen if you are using multiple Microsoft products on your device.

    Bash

    cat /etc/apt/sources.list.d/*
    
    Output

    deb [arch=arm64,armhf,amd64] https://packages.microsoft.com/config/ubuntu/18.04/prod insiders-fast main
    deb [arch=amd64] https://packages.microsoft.com/config/ubuntu/18.04/prod bionic main
    
    Bash

    sudo apt -t bionic install mdatp
    

Download the onboarding package

Download the onboarding package from Microsoft 365 Defender portal.

 Important

If you miss this step, any command executed will show a warning message indicating that the product is unlicensed. Also the mdatp health command returns a value of false.

  1. In the Microsoft 365 Defender portal, go to Settings > Endpoints > Device management > Onboarding.
  2. In the first drop-down menu, select Linux Server as the operating system. In the second drop-down menu, select Local Script as the deployment method.
  3. Select Download onboarding package. Save the file as WindowsDefenderATPOnboardingPackage.zip.

    Microsoft 365 Defender portal screenshot.

  4. From a command prompt, verify that you have the file, and extract the contents of the archive:
    Bash

    ls -l
    
    Output

    total 8
    -rw-r--r-- 1 test  staff  5752 Feb 18 11:22 WindowsDefenderATPOnboardingPackage.zip
    
    Bash

    unzip WindowsDefenderATPOnboardingPackage.zip
    
    Output

    Archive:  WindowsDefenderATPOnboardingPackage.zip
    inflating: MicrosoftDefenderATPOnboardingLinuxServer.py
    

Client configuration

  1. Copy MicrosoftDefenderATPOnboardingLinuxServer.py to the target device.

     Note

    Initially the client device is not associated with an organization and the orgId attribute is blank.

    Bash

    mdatp health --field org_id
    
  2. Run MicrosoftDefenderATPOnboardingLinuxServer.py.

     Note

    To run this command, you must have python or python3 installed on the device depending on the disto and version. If needed, see Step-by-step Instruction for Installing Python on Linux.

    If you’re running RHEL 8.x or Ubuntu 20.04 or higher, you will need to use python3.

    Bash

    sudo python3 MicrosoftDefenderATPOnboardingLinuxServer.py
    

    For the rest of distros and versions, you will need to use python.

    Bash

    sudo python MicrosoftDefenderATPOnboardingLinuxServer.py
    
  3. Verify that the device is now associated with your organization and reports a valid organization identifier:
    Bash

    mdatp health --field org_id
    
  4. Check the health status of the product by running the following command. A return value of 1 denotes that the product is functioning as expected:
    Bash

    mdatp health --field healthy
    

     Important

    When the product starts for the first time, it downloads the latest antimalware definitions. This may take up to a few minutes depending on the network connectivity. During this time the above command returns a value of false. You can check the status of the definition update using the following command:

    Bash

    mdatp health --field definitions_status
    

    Please note that you may also need to configure a proxy after completing the initial installation. See Configure Defender for Endpoint on Linux for static proxy discovery: Post-installation configuration.

  5. Run an AV detection test to verify that the device is properly onboarded and reporting to the service. Perform the following steps on the newly onboarded device:
    • Ensure that real-time protection is enabled (denoted by a result of 1 from running the following command):
      Bash

      mdatp health --field real_time_protection_enabled
      
    • Open a Terminal window and execute the following command:
      Bash

      curl -o /tmp/eicar.com.txt https://www.eicar.org/download/eicar.com.txt
      
    • The file should have been quarantined by Defender for Endpoint on Linux. Use the following command to list all the detected threats:
      Bash

      mdatp threat list
      
  6. Run an EDR detection test and simulate a detection to verify that the device is properly onboarded and reporting to the service. Perform the following steps on the newly onboarded device:
    • Verify that the onboarded Linux server appears in Microsoft 365 Defender. If this is the first onboarding of the machine, it can take up to 20 minutes until it appears.
    • Download and extract the script file to an onboarded Linux server and run the following command: ./mde_linux_edr_diy.sh
    • After a few minutes, a detection should be raised in Microsoft 365 Defender.
    • Look at the alert details, machine timeline, and perform your typical investigation steps.

Installer script

Alternatively, you can use an automated installer bash script provided in our public GitHub repository. The script identifies the distribution and version, simplifies the selection of the right repository, sets up the device to pull the latest package, and combines the product installation and onboarding steps.

Bash

❯ ./mde_installer.sh --help
usage: basename ./mde_installer.sh [OPTIONS]
Options:
-c|--channel      specify the channel from which you want to install. Default: insiders-fast
-i|--install      install the product
-r|--remove       remove the product
-u|--upgrade      upgrade the existing product
-o|--onboard      onboard/offboard the product with <onboarding_script>
-p|--passive-mode set EPP to passive mode
-t|--tag          set a tag by declaring <name> and <value>. ex: -t GROUP Coders
-m|--min_req      enforce minimum requirements
-w|--clean        remove repo from package manager for a specific channel
-v|--version      print out script version
-h|--help         display help

Read more here.

Log installation issues

See Log installation issues for more information on how to find the automatically generated log that is created by the installer when an error occurs.

How to migrate from Insiders-Fast to Production channel

  1. Uninstall the “Insiders-Fast channel” version of Defender for Endpoint on Linux.
    Bash

    sudo yum remove mdatp
    
  2. Disable the Defender for Endpoint on Linux Insiders-Fast repo
    Bash

    sudo yum repolist
    

     Note

    The output should show “packages-microsoft-com-fast-prod”.

    Bash

    sudo yum-config-manager --disable packages-microsoft-com-fast-prod
    
  3. Redeploy Microsoft Defender for Endpoint on Linux using the “Production channel”.

Uninstallation

See Uninstall for details on how to remove Defender for Endpoint on Linux from client devices.

Source : Official Microsoft Brand
Editor by : BEST Antivirus KBS Team

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

(Visited 34 times, 1 visits today)