diff --git a/manifests/config.pp b/manifests/config.pp index 8c7451d..a6f1de1 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -17,34 +17,37 @@ $merged_config = $default_config + $config } + $merged_conf = { 'config' => $merged_config } file { '/usr/local/maldetect/conf.maldet': ensure => present, mode => '0644', owner => root, group => root, - content => epp('maldet/conf.maldet.epp', { 'config' => $merged_config }), + content => epp('maldet/conf.maldet.epp', $merged_conf), } # Allow config overrides for daily cron + $cron_conf = { 'config' => $cron_config } if versioncmp($maldet::version, '1.5') >= 0 { file { '/usr/local/maldetect/cron/conf.maldet.cron': ensure => present, mode => '0644', owner => root, group => root, - content => epp('maldet/conf.maldet.epp', { 'config' => $cron_config }), + content => epp('maldet/conf.maldet.epp', $cron_conf), } } - if $facts['service_provider'] == 'redhat' { - # MONITOR_MODE is commented out by default and can prevent maldet service - # from starting when using the init based startup script. + # MONITOR_MODE is commented out by default and can prevent maldet service + # from starting when using the init based startup script. + $monitor_mode = { 'monitor_mode' => $merged_config['default_monitor_mode'] } + if $::facts['service_provider'] == 'redhat' { file { '/etc/sysconfig/maldet': ensure => present, mode => '0644', owner => root, group => root, - content => inline_epp('MONITOR_MODE="<%= $monitor_mode %>"', {'monitor_mode' => $merged_config['default_monitor_mode']}), + content => inline_epp('MONITOR_MODE="<%= $monitor_mode %>"', $monitor_mode), } } diff --git a/manifests/install.pp b/manifests/install.pp index d442446..a8d5cc5 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -13,7 +13,12 @@ # inotify-tools is used by the maldet service ensure_packages(['psmisc', 'wget', 'cpulimit', 'inotify-tools', 'perl']) - if $facts['os']['family'] == 'Redhat' { + file { ['/usr/sbin/maldet', '/usr/sbin/lmd']: + ensure => link, + target => '/usr/local/maldetect/maldet', + } + + if $::facts['os']['family'] == 'Redhat' { include ::epel Class['epel'] -> Package['psmisc'] -> diff --git a/metadata.json b/metadata.json index d595222..85b26fc 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "nexcess-maldet", - "version": "1.0.0", + "version": "1.1.0", "author": "nexcess", "summary": "Install and configure Linux Malware Detect", "license": "Apache-2.0", diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index c83ffa6..54b7628 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -28,6 +28,10 @@ it { should contain_package('cpulimit').with(:ensure => 'present') } it { should contain_package('inotify-tools').with(:ensure => 'present') } it { should contain_package('perl').with(:ensure => 'present') } + it { should contain_file('/usr/sbin/maldet'). + with(:ensure => 'link') } + it { should contain_file('/usr/sbin/lmd'). + with(:ensure => 'link') } it { should contain_maldet('https://www.rfxn.com/downloads'). with(:ensure => 'present') }