Microsoft Defender for Endpoint – Red Hat Linux Manual Deployment

Note: This blog is in support of Microsoft for Endpoint (MDE, formerly MDATP) on Red Hat Enterprise (RHEL).

Disclaimer:  This may not work on all versions of is a third party entity with its own potential licensing restrictions. This content is provided to assist our customers to better navigate integration with a 3rd party component or operating system, and as such, no guarantees are implied.

System requirements: 

  • Linux server distributions and versions: Red Hat Enterprise Linux 7.2 or higher. 
  • The fanotify kernel option must be enabled. 

Instructions to Prepare for MDE/MDATP Installation: 

1. Connect to the RedHat server using Putty. 

2. Install yum-utils if it isn't already installed:  

sudo yum install yum-utils
[azureuser@redhat ~]$ sudo yum install yum-utils

3. Install the RedHat MDATP Channel.  

From a web browser go to https://packages.microsoft.com/config/ to select your OS, version, and channel. 

pbracher_0-1615303062604.png

4. I have RedHat Version 7.9 and chose the production channel 7.4 which is the highest version without going to the next major version. Copy the link with prod.repo to be included in the next step.  For example:  https://packages.microsoft.com/config/rhel/7.4/prod.repo

5. Install the Package.

[azureuser@redhat ~]$ sudo yum-config-manager --add- repo=https://packages.microsoft.com/config/rhel/7.4/prod.repo 

Loaded plugins: langpacks, product-id 

adding repo from: https://packages.microsoft.com/config/rhel/7.4/prod.repo 

grabbing file https://packages.microsoft.com/config/rhel/7.4/prod.repo to /etc/yum.repos.d/prod.repo 

repo saved to /etc/yum.repos.d/prod.repo 

[azureuser@redhat ~]$ 

 6. Install the Microsoft GPG public key:

[azureuser@redhat ~]$ sudo rpm --import http://packages.microsoft.com/keys/microsoft.asc

 7. Make all the metadata usable for the currently enabled yum repositories:  

[azureuser@redhat ~]$ yum makecacheLoaded plugins: langpacks, product-id, search-disabled-repos
(1/5): packages-microsoft-com-prod/primary_db        118 kB  00:00:00
(2/5): packages-microsoft-com-prod/other_db         7.2 kB  00:00:00
(3/5): packages-microsoft-com-prod/filelists_db       341 kB  00:00:00
(4/5): rhui-microsoft-azure-rhel7/filelists                    372 B  00:00:00
(5/5): rhui-microsoft-azure-rhel7/other                      254 B  00:00:00
rhui-microsoft-azure-rhel7      1/1 
rhui-microsoft-azure-rhel7      1/1 
rhui-microsoft-azure-rhel7      1/1 
Metadata Cache Created 
  1. Run install command 
[azureuser@redhat ~]$ sudo yum install mdatp 
Loaded plugins: langpacks, product-id, search-disabled-repos 
packages-microsoft-com-prod     | 3.0 kB  00:00:00 
packages-microsoft-com-prod/primary_db       118 kB  00:00:00 
Resolving Dependencies 
--> Running transaction check 
---> Package mdatp.x86_64 0:101.18.53-1 will be installed 
--> Processing Dependency: libatomic for package: mdatp-101.18.53-1.x86_64 
--> Running transaction check 
---> Package libatomic.x86_64 0:4.8.5-44.el7 will be installed 
--> Finished Dependency Resolution
Dependencies Resolved 
======================================================================== 
Package  Repository                            Arch                    Size                                Version         
Installing: 
 mdatp                                               x86_64                     42 M                    101.18.53-1                             packages-microsoft-com-prod                                          
Installing for dependencies: 
libatomic                                           x86_64                      51 k                     4.8.5-44.el7                            rhui-rhel-7-server-rhui-rpms                                             
Transaction Summary 
Install  1 Package (+1 Dependent package) 
Total download size: 42 M 
Installed size: 145 M 
Is this ok [y/d/N]: y 
Downloading packages: 
(1/2): libatomic-4.8.5-44.el7.x86_64.rpm    |  51 kB  00:00:00 
(2/2): mdatp_101.18.53.x86_64.rpm            |  42 MB  00:00:01 
------------------------------------------------------------------------------------------------------------------------------------------ 
Total                                                                                                                                                                                                        32 MB/s |  42 MB  00:00:01 
Running transaction check 
Running transaction test 
Transaction test succeeded 
Running transaction 
  Installing : libatomic-4.8.5-44.el7.x86_64    1/2 
  Installing : mdatp-101.18.53-1.x86_64         2/2 
  Verifying  : libatomic-4.8.5-44.el7.x86_64     1/2 
  Verifying  : mdatp-101.18.53-1.x86_64          2/2 
rhui-rhel-7-server-dotnet-rhui-rpms/x86_64/productid  | 2.1 kB  00:00:00 
rhui-rhel-7-server-rhui-extras-rpms/x86_64/productid    | 2.1 kB  00:00:00 
rhui-rhel-7-server-rhui-rpms/7Server/x86_64/productid | 2.1 kB  00:00:00 
rhui-rhel-7-server-rhui-supplementary-rpms/7Server/x86_64/productid   | 2.1 kB  00:00:00 
rhui-rhel-server-rhui-rhscl-7-rpms/7Server/x86_64/productid        | 2.1 kB  00:00:00 
Installed: 
  mdatp.x86_64 0:101.18.53-1 
Dependency Installed: 
  libatomic.x86_64 0:4.8.5-44.el7 
Complete!
[azureuser@redhat ~]$ 

 2. List all repositories.  Make sure the ones in red are in the repository if you chose prod.repo  (production).  

yum repolist[azureuser@redhat ~]$ yum repolist
Loaded plugins: langpacks, product-id, search-disabled-repos
repo name                                                                                       status 
packages-microsoft-com-prod                                       packages-microsoft-com-prod                                   89 
[azureuser@redhat ~]$

 3. Install the package from the production repository: 

sudo yum --enablerepo=packages-microsoft-com-prod install mdatp 
[azureuser@redhat ~]$ sudo yum --enablerepo=packages-microsoft-com-prod install mdatp 
Loaded plugins: langpacks, product-id, search-disabled-repos 
Package mdatp-101.18.53-1.x86_64 already installed and latest version 
Nothing to do 
[azureuser@redhat ~]$

Download the onboarding package & onboard

Download the onboarding package from Microsoft Security Center from your Workstation: 

  1. In Microsoft Security Center, go to Settings > 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 (for up to 10 devices) as the deployment method. 
  3. Select Download onboarding package. Save the file as WindowsDefenderATPOnboardingPackage.zip to your workstation. 

From the workstation copy WindowsDefenderATPOnboardingPackage.zip from the workstation to RHEL. Putty must be installed. Here we are using a key to log in and copy the file. 

C:>pscp.exe -P 22 -i C:UsersazureuserDownloadsredhat_key.ppk C:usersAzureuserWindowsDefenderATPOnboardingPackage.zip azureuser@ipaddressoflinuxserver:/home/azureuser
WindowsDefenderATPOnboard | 5 kB |   5.6 kB/s | ETA: 00:00:00 | 100% 

Connect back to Linux (putty) 

[azureuser@redhat ~]$ cd .. 
[azureuser@redhat home]$ cd azureuser/ 
[azureuser@redhat ~]$ ls

WindowsDefenderATPOnboardingPackage.zip 

   4. Unzip WindowsDefenderATPOnboardingPackage.zip 

[azureuser@redhat ~]$ unzip WindowsDefenderATPOnboardingPackage.zip
Archive:  WindowsDefenderATPOnboardingPackage.zip 
inflating: MicrosoftDefenderATPOnboardingLinuxServer.py 

   5. Check the health of MDATP which should say no license found:    

mdatp health --field org_id
[azureuser@redhat ~]$ mdatp health --field org_id 
ATTENTION: No license found. Contact your administrator for help. 
unavailable 

  6. Run Onboarding script: 

     MicrosoftDefenderATPOnboardingLinuxServer.py 

[azureuser@redhat ~]$ sudo python MicrosoftDefenderATPOnboardingLinuxServer.py
Generating /etc/opt/microsoft/mdatp/mdatp_onboard.json ... 

   7. Check the health of MDATP:  mdatp health –field org_id 

[azureuser@redhat ~]$ mdatp health --field org_id
"5447sdf90-2220-4161-82f7-0dgs2f39h8329-125fd412"

   8. Check the MDATP Azure console: 

pbracher_1-1615303062613.png

Disclaimer
The sample are not supported under any Microsoft standard support program or service. The sample are provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.

 

This article was originally published by Microsoft's Azure Security Blog. You can find the original article here.