From 6db1ca7175549e466c3f105108112c1a059d741b Mon Sep 17 00:00:00 2001 From: Timo Makinen Date: Fri, 18 Sep 2015 12:41:04 +0300 Subject: [PATCH] clamav: Fix clamav::daemon for CentOS/RedHat 7 --- clamav/manifests/init.pp | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) 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"], } }