Skip to content

Commit

Permalink
test adding sysmon on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
nate st. germain committed Oct 21, 2019
1 parent c29b691 commit 5d0f7fe
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 2 deletions.
3 changes: 2 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# type: string
#
# [*enable_sysmon*]
# Windows: optionally enable sysmon (not used yet)
# Windows: optionally enable sysmon
# type: bool
#
# [*extra_args*]
Expand Down Expand Up @@ -128,6 +128,7 @@
$disable_auditd_cmd = $::threatstack::params::disable_auditd_cmd,
$binpath = $::threatstack::params::binpath,
$setup_unless = $::threatstack::params::setup_unless,
$enable_sysmon = $::threatstack::params::enable_sysmon,
$windows_download_url = $::threatstack::params::download_url,
$windows_tmp_path = $::threatstack::params::tmp_path,
$windows_install_options = concat(["TSDEPLOYKEY=${deploy_key}"],$::threatstack::params::windows_install_options)
Expand Down
6 changes: 5 additions & 1 deletion manifests/package.pp
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,15 @@
source => $::threatstack::windows_download_url
}

if $::threatstack::enable_sysmon {
include threatstack::sysmon
}

package { $::threatstack::ts_package:
ensure => installed,
source => $::threatstack::windows_tmp_path,
install_options => $::threatstack::windows_install_options,
require => Remote_file['agent msi download']
require => Remote_file['agent msi download']
}
}
default: {
Expand Down
5 changes: 5 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@
default => '/opt/threatstack/etc'
}

$enable_sysmon = $facts['os']['family'] ? {
'Windows' => true
default => false
}

$rulesets = $facts['os']['family'] ? {
'Windows' => ['Windows Rule Set'],
default => ['Base Rule Set']
Expand Down
37 changes: 37 additions & 0 deletions manifests/sysmon.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# == Class: threatstack::sysmon
#
# Install Sysmon for Windows
#
# === Authors
#
# Nate St. Germain <[email protected]>
#
# === Copyright
#
# Copyright 2019 Threat Stack, Inc.
#
class threatstack::sysmon {

archive { "C:\\Windows\\Temp\\sysmon.zip":
ensure => present,
extract => true,
cleanup => true,
extract_path => "C:\\Windows\\Temp\\",
source => 'https://download.sysinternals.com/files/Sysmon.zip'
}

file { 'C:\Windows\Temp\sysmonconfig-export.xml':
ensure => present,
source => 'https://raw.githubusercontent.com/SwiftOnSecurity/sysmon-config/master/sysmonconfig-export.xml'
}

exec { 'Install sysmon':
command => "C:\\Windows\\Temp\\Sysmon64.exe –accepteula –i sysmonconfig-export.xml",
subscribe => File['C:\Windows\Temp\sysmonconfig-export.xml'],
refreshonly => true,
require => [
Archive["C:\\Windows\\Temp\\sysmon.zip"],
File['C:\Windows\Temp\sysmonconfig-export.xml']
]
}
}

0 comments on commit 5d0f7fe

Please sign in to comment.