11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'modules/clamav/manifests/init.pp', line 11
class clamav($proxy=undef) {
package { [ 'clamav-daemon', 'clamav-freshclam' ]:
ensure => present,
}
exec { 'add clamav to Debian-exim':
command => 'usermod -a -G Debian-exim clamav',
unless => 'id -Gn clamav | grep -q Debian-exim',
path => '/bin:/sbin:/usr/bin:/usr/sbin',
require => Package['clamav-daemon'],
}
file { '/etc/clamav/clamd.conf':
owner => 'root',
group => 'root',
mode => '0444',
source => 'puppet:///modules/clamav/clamd.conf',
require => Package['clamav-daemon'],
}
# overwriting the unit file from the distro package
# because we are adding auto-restart on failure
systemd::override { 'clamav-daemon-auto-restart':
unit => 'clamav-daemon',
source => 'puppet:///modules/clamav/clamav_systemd_override',
}
# Add proxy settings to freshclam
if $proxy {
$proxy_arr = split($proxy, ':')
$proxy_host = $proxy_arr[0]
$proxy_port = $proxy_arr[1]
file_line { 'freshclam_proxyserver':
line => "HTTPProxyServer ${proxy_host}",
match => '^HTTPProxyServer',
path => '/etc/clamav/freshclam.conf',
notify => Service['clamav-freshclam'],
}
file_line { 'freshclam_proxyport':
line => "HTTPProxyPort ${proxy_port}",
match => '^HTTPProxyPort',
path => '/etc/clamav/freshclam.conf',
notify => Service['clamav-freshclam'],
}
}
service { 'clamav-freshclam':
ensure => running,
require => Package['clamav-freshclam'],
}
profile::auto_restarts::service { 'clamav-freshclam': }
service { 'clamav-daemon':
ensure => running,
require => File['/etc/clamav/clamd.conf'],
subscribe => File['/etc/clamav/clamd.conf'],
}
}
|