diff --git a/clamav/manifests/init.pp b/clamav/manifests/init.pp index 92ae554..439fc2a 100644 --- a/clamav/manifests/init.pp +++ b/clamav/manifests/init.pp @@ -43,13 +43,49 @@ class clamav::daemon { require clamav + case $::operatingsystem { + "centos","redhat": { + if (versioncmp($::operatingsystemrelease, 7) < 0) { + $package = "clamd" + $service = "clamd" + } else { + $package = "clamav-scanner-systemd" + $service = "clamd@scan" + exec { "sed -i 's/^Example$/#Example/' /etc/clamd.d/scan.conf": + path => "/bin:/usr/bin:/sbin:/usr/sbin", + user => "root", + onlyif => "egrep '^Example$' /etc/clamd.d/scan.conf", + require => Package["clamd"], + notify => Service["clamd"], + } + exec { "sed -i 's/^#LocalSocket /LocalSocket /' /etc/clamd.d/scan.conf": + path => "/bin:/usr/bin:/sbin:/usr/sbin", + user => "root", + onlyif => "egrep '#LocalSocket ' /etc/clamd.d/scan.conf", + require => Package["clamd"], + notify => Service["clamd"], + } + file { "/etc/clamd.conf": + ensure => link, + target => "/etc/clamd.d/scan.conf", + owner => "root", + group => "root", + require => Package["clamd"], + } + } + } + } + package { "clamd": ensure => installed, + name => $package, } service { "clamd": - ensure => running, - enable => true, + ensure => running, + name => $service, + enable => true, + require => Package["clamd"], } }