Skip to content

Commit

Permalink
add bin paths for windows
Browse files Browse the repository at this point in the history
see if config works
  • Loading branch information
nate st. germain committed Oct 17, 2019
1 parent f12b3aa commit 47e5d9c
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 53 deletions.
94 changes: 43 additions & 51 deletions manifests/configure.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,62 +18,54 @@
# Copyright 2019 Threat Stack, Inc.
#
class threatstack::configure {

case $facts['os']['family'] {
'Windows': {
notice("We are working on support for configuring the agent on ${::operatingsystem}")
}
default: {
$rulesets = $::threatstack::rulesets
$ruleset_args = $rulesets.map | $rule | {
"--ruleset='${rule}'"
}
if $::threatstack::extra_args {
$extra_args = $::threatstack::extra_args.map | $arg | {
"--${arg.keys[0]}=${arg.values[0]}"
}
$full_setup_args = "${join($ruleset_args, ' ')} ${join($extra_args, ' ')}"
} else {
$full_setup_args = "${join($ruleset_args, ' ')}"
$rulesets = $::threatstack::rulesets
$ruleset_args = $rulesets.map | $rule | {
"--ruleset='${rule}'"
}
if $::threatstack::extra_args {
$extra_args = $::threatstack::extra_args.map | $arg | {
"--${arg.keys[0]}=${arg.values[0]}"
}
$full_setup_args = "${join($ruleset_args, ' ')} ${join($extra_args, ' ')}"
} else {
$full_setup_args = "${join($ruleset_args, ' ')}"
}

$cloudsight_bin = $::threatstack::cloudsight_bin
$confdir = $::threatstack::confdir
$cloudsight_bin = $::threatstack::cloudsight_bin
$confdir = $::threatstack::confdir

if $::threatstack::agent_config_args {
$full_config_args = $::threatstack::agent_config_args.map | $config | {
"${config.keys[0]} ${config.values[0]}"
}
$config_args_content = join($full_config_args, "\n")
if $::threatstack::agent_config_args {
$full_config_args = $::threatstack::agent_config_args.map | $config | {
"${config.keys[0]} ${config.values[0]}"
}
$config_args_content = join($full_config_args, "\n")

# this file tracks state and is used to notify
# Exec[threatstack-agent-configure] of the need to run.
file { "${confdir}/.config_args":
ensure => present,
owner => 'root',
group => 'root',
mode => '0644',
content => $config_args_content
}
# this file tracks state and is used to notify
# Exec[threatstack-agent-configure] of the need to run.
file { "${confdir}/.config_args":
ensure => present,
owner => 'root',
group => 'root',
mode => '0644',
content => $config_args_content
}

exec { 'threatstack-agent-configure':
command => "${cloudsight_bin} config -set ${join($full_config_args, ' ')}",
subscribe => File["${confdir}/.config_args"],
refreshonly => true,
path => ['/bin', '/usr/bin'],
notify => Class['threatstack::service']
}
} else {
$config_args_content = ''
}
exec { 'threatstack-agent-configure':
command => "${cloudsight_bin} config -set ${join($full_config_args, ' ')}",
subscribe => File["${confdir}/.config_args"],
refreshonly => true,
path => ['/bin', '/usr/bin'],
notify => Class['threatstack::service']
}
} else {
$config_args_content = ''
}

exec { 'threatstack-agent-setup':
command => "${cloudsight_bin} setup --deploy-key='${::threatstack::deploy_key}' --hostname='${::threatstack::ts_hostname}' ${full_setup_args}",
subscribe => Package[$threatstack::ts_package],
creates => "${confdir}/.audit",
path => ['/bin', '/usr/bin'],
unless => 'ps auwwwx| grep [t]sagentd'
}
}
exec { 'threatstack-agent-setup':
command => "${cloudsight_bin} setup --deploy-key='${::threatstack::deploy_key}' --hostname='${::threatstack::ts_hostname}' ${full_setup_args}",
subscribe => Package[$threatstack::ts_package],
creates => "${confdir}/.audit",
path => ['/bin', '/usr/bin'],
unless => 'ps auwwwx| grep [t]sagentd'
}
}
12 changes: 10 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,19 @@
default => 'threatstack'
}

$cloudsight_bin = $facts['os']['family'] ? {
'Windows' => 'C:\\Program Files\\Threat Stack\\tsagent.exe',
default => '/usr/bin/tsagent'
}

$confdir = $facts['os']['family'] ? {
'Windows' => 'C:\\ProgramData\\Threat Stack\\config',
default => '/opt/threatstack/etc'
}

$package_version = 'installed'
$rulesets = ['Base Rule Set']
$extra_args = undef
$cloudsight_bin = '/usr/bin/tsagent'
$confdir = '/opt/threatstack/etc'

case $facts['os']['family'] {
'Windows': {
Expand Down

0 comments on commit 47e5d9c

Please sign in to comment.