Skip to content

Commit b013851

Browse files
committed
Learn Editor: Update linux-install-with-puppet.md
1 parent 9654cf1 commit b013851

File tree

1 file changed

+93
-74
lines changed

1 file changed

+93
-74
lines changed

defender-endpoint/linux-install-with-puppet.md

Lines changed: 93 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ms.date: 10/11/2024
2525
**Applies to**:
2626

2727
- Microsoft Defender for Endpoint Server
28-
- [Microsoft Defender for Servers](/azure/defender-for-cloud/integration-defender-for-endpoint)
28+
- [Microsoft Defender for Servers](/azure/defender-for-cloud/integration-defender-for-endpoint)
2929

3030
> Want to experience Defender for Endpoint? [Sign up for a free trial.](https://signup.microsoft.com/create-account/signup?products=7f379fee-c4f9-4278-b0a1-e4c8c2fcdf7e&ru=https://aka.ms/MDEp2OpenTrial?ocid=docs-wdatp-investigateip-abovefoldlink)
3131
@@ -113,7 +113,7 @@ You need to create a Puppet manifest for deploying Defender for Endpoint on Linu
113113

114114
### Create manifest file
115115

116-
There are two ways to create manifest:
116+
There are two ways to create manifest file:
117117

118118
1. create manifest using installer script
119119

@@ -190,65 +190,96 @@ Add below contents to the `install_mdatp/manifests/init.pp` file
190190
```puppet
191191
# Puppet manifest to install Microsoft Defender for Endpoint on Linux.
192192
# @param channel The release channel based on your environment, insider-fast or prod.
193-
# @param distro The Linux distribution in lowercase. In case of RedHat, Oracle Linux, Amazon Linux 2, and CentOS 8, the distro variable should be 'rhel'.
194-
# @param version The Linux distribution release number, e.g. 7.4.
195193
196-
class install_mdatp (
197-
$channel = 'insiders-fast',
198-
$distro = undef,
199-
$version = undef
200-
) {
201-
case $facts['os']['family'] {
202-
'Debian' : {
203-
$release = $channel ? {
204-
'prod' => $facts['os']['distro']['codename'],
205-
default => $channel
206-
}
207-
apt::source { 'microsoftpackages' :
208-
location => "https://packages.microsoft.com/${distro}/${version}/prod",
209-
release => $release,
210-
repos => 'main',
211-
key => {
212-
'id' => 'BC528686B50D79E339D3721CEB3E94ADBE1229CF',
213-
'server' => 'keyserver.ubuntu.com',
214-
},
215-
}
216-
}
217-
'RedHat' : {
218-
yumrepo { 'microsoftpackages' :
219-
baseurl => "https://packages.microsoft.com/${distro}/${version}/${channel}",
220-
descr => "packages-microsoft-com-prod-${channel}",
221-
enabled => 1,
222-
gpgcheck => 1,
223-
gpgkey => 'https://packages.microsoft.com/keys/microsoft.asc',
224-
}
194+
class install_mdatp::configure_debian_repo (
195+
String $channel,
196+
String $distro,
197+
String $version ) {
198+
# Configure the APT repository for Debian-based systems
199+
200+
$release = $channel ? {
201+
'prod' => $facts['os']['distro']['codename'],
202+
default => $channel
225203
}
226-
default : { fail("${facts['os']['family']} is currently not supported.") }
204+
205+
apt::source { 'microsoftpackages':
206+
location => "https://packages.microsoft.com/${distro}/${version}/prod",
207+
release => $release,
208+
repos => 'main',
209+
key => {
210+
'id' => 'BC528686B50D79E339D3721CEB3E94ADBE1229CF',
211+
'server' => 'keyserver.ubuntu.com',
212+
},
213+
}
214+
}
215+
216+
class install_mdatp::configure_redhat_repo (
217+
String $channel,
218+
String $distro,
219+
String $version) {
220+
# Configure the Yum repository for RedHat-based systems
221+
222+
yumrepo { 'microsoftpackages':
223+
baseurl => "https://packages.microsoft.com/rhel/${version}/prod",
224+
descr => 'packages-microsoft-com-prod',
225+
enabled => 1,
226+
gpgcheck => 1,
227+
gpgkey => 'https://packages.microsoft.com/keys/microsoft.asc',
227228
}
229+
}
230+
231+
class install_mdatp::install {
232+
# Common configurations for both Debian and RedHat
233+
234+
file { ['/etc/opt', '/etc/opt/microsoft', '/etc/opt/microsoft/mdatp']:
235+
ensure => directory,
236+
owner => 'root',
237+
group => 'root',
238+
mode => '0755',
239+
}
240+
241+
file { '/etc/opt/microsoft/mdatp/mdatp_onboard.json':
242+
source => 'puppet:///modules/install_mdatp/mdatp_onboard.json',
243+
owner => 'root',
244+
group => 'root',
245+
mode => '0600',
246+
require => File['/etc/opt/microsoft/mdatp'],
247+
}
248+
249+
# Install mdatp package
250+
package { 'mdatp':
251+
ensure => installed,
252+
require => [
253+
File['/etc/opt/microsoft/mdatp/mdatp_onboard.json'],
254+
],
255+
}
256+
}
228257
258+
259+
class install_mdatp (
260+
$channel = 'prod'
261+
) {
262+
# Include the appropriate class based on the OS family
263+
264+
$distro = downcase($facts['os']['name'])
265+
$version = $facts['os']['release']['major']
266+
229267
case $facts['os']['family'] {
230-
/(Debian|RedHat)/: {
231-
file { ['/etc/opt', '/etc/opt/microsoft', '/etc/opt/microsoft/mdatp']:
232-
ensure => directory,
233-
owner => root,
234-
group => root,
235-
mode => '0755',
236-
}
237-
238-
file { '/etc/opt/microsoft/mdatp/mdatp_onboard.json':
239-
source => 'puppet:///modules/install_mdatp/mdatp_onboard.json',
240-
owner => root,
241-
group => root,
242-
mode => '0600',
243-
require => File['/etc/opt/microsoft/mdatp'],
244-
}
245-
246-
package { 'mdatp':
247-
ensure => 'installed',
248-
require => File['/etc/opt/microsoft/mdatp/mdatp_onboard.json'],
249-
}
268+
'Debian': {
269+
class { 'install_mdatp::configure_debian_repo':
270+
channel => 'prod',
271+
distro => $distro,
272+
version => $version
273+
} -> class { 'install_mdatp::install': }
274+
}
275+
'RedHat': {
276+
class { 'install_mdatp::configure_redhat_repo':
277+
channel => 'prod',
278+
distro => $distro,
279+
version => $version,
280+
} -> class { 'install_mdatp::install': }
250281
}
251-
default : { fail("${facts['os']['family']} is currently not supported.") }
282+
default: { fail("${facts['os']['family']} is currently not supported.")}
252283
}
253284
}
254285
@@ -272,40 +303,28 @@ Enrolled agent devices periodically poll the Puppet Server and install new confi
272303
273304
## Monitor Puppet deployment
274305
275-
On the agent device, you can also check the onboarding status by running:
306+
On the agent device, you can also check the deployment status by running:
276307
277308
```bash
278309
mdatp health
279310
```
280311
281312
```console
282313
...
314+
healthy : true
315+
health_issues : []
283316
licensed : true
284317
org_id : "[your organization identifier]"
285318
...
286319
```
287320
288-
- **licensed**: This confirms that the device is tied to your organization.
289-
290-
- **orgId**: This is your Defender for Endpoint organization identifier.
291-
292-
## Check onboarding status
321+
- **healthy:** This confirm that Defender for Endpoint is successfully deployed and operational
293322
294-
You can check that devices have been correctly onboarded by creating a script. For example, the following script checks enrolled devices for onboarding status:
323+
- **health_issues**: This states the issues which caused the healthy status to become false.
295324
296-
```bash
297-
mdatp health --field healthy
298-
```
299-
300-
The above command prints `1` if the product is onboarded and functioning as expected.
301-
302-
> [!IMPORTANT]
303-
> When the product starts for the first time, it downloads the latest antimalware definitions. Depending on your Internet connection, this can take up to a few minutes. During this time the above command returns a value of `0`.
304-
305-
If the product is not healthy, the exit code (which can be checked through `echo $?`) indicates the problem:
325+
- **licensed**: This confirms that the device is tied to your organization.
306326
307-
- `1` if the device isn't onboarded yet.
308-
- `3` if the connection to the daemon cannot be established.
327+
- **orgId**: This is your Defender for Endpoint organization identifier.
309328
310329
## Troubleshoot installation issues
311330

0 commit comments

Comments
 (0)