Puppet Class: clamav::freshclam

Defined in:
manifests/freshclam.pp

Overview

Class: clamav::freshclam

Configure freshclam to update clamav virus definitions

Hiera:

clamav::freshclam::enable: true/false clamav::freshclam::minute: 0-59 clamav::freshclam::hour: 0-23 clamav::freshclam::command: command to initiate freshclam clamav::freshclam::proxy_username: http proxy username clamav::freshclam::proxy_password: http proxy password clamav::freshclam::proxy_port: http proxy port clamav::freshclam::proxy_server: http proxy server

Parameters:

  • enable (Any) (defaults to: hiera('clamav::freshclam::enable',true))
  • minute (Any) (defaults to: hiera('clamav::freshclam::minute',fqdn_rand(59)))
  • hour (Any) (defaults to: hiera('clamav::freshclam::hour',fqdn_rand(23)))
  • command (Any) (defaults to: hiera('clamav::freshclam::command','/usr/bin/freshclam --quiet'))
  • proxy_server (Any) (defaults to: hiera('clamav::freshclam::proxy_server',''))
  • proxy_port (Any) (defaults to: hiera('clamav::freshclam::proxy_port',''))
  • proxy_username (Any) (defaults to: hiera('clamav::freshclam::proxy_username',''))
  • proxy_password (Any) (defaults to: hiera('clamav::freshclam::proxy_password',''))
  • logfile (Any) (defaults to: '/var/log/clamav/freshclam.log')


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
# File 'manifests/freshclam.pp', line 16

class clamav::freshclam (
  $enable = hiera('clamav::freshclam::enable',true),
  $minute = hiera('clamav::freshclam::minute',fqdn_rand(59)),
  $hour = hiera('clamav::freshclam::hour',fqdn_rand(23)),
  $command = hiera('clamav::freshclam::command','/usr/bin/freshclam --quiet'),
  $proxy_server = hiera('clamav::freshclam::proxy_server',''),
  $proxy_port = hiera('clamav::freshclam::proxy_port',''),
  $proxy_username = hiera('clamav::freshclam::proxy_username',''),
  $proxy_password = hiera('clamav::freshclam::proxy_password',''),
  $logfile = '/var/log/clamav/freshclam.log',
) {
  include clamav::params

  file { '/etc/freshclam.conf':
    ensure  => present,
    owner   => $clamav::params::user,
    mode    => '0400',
    content => template('clamav/freshclam.conf.erb'),
    require => Package[$clamav::params::package],
  }

  $cron_ensure = $enable ? {
    true    => 'present',
    default => 'absent',
  }
  cron { 'clamav-freshclam':
    ensure  => $cron_ensure,
    command => $command,
    minute  => $minute,
    hour    => $hour,
    require => File['/etc/freshclam.conf'],
  }

  # remove the freshclam cron that is installed with the package
  file { '/etc/cron.daily/freshclam':
    ensure  => absent,
    require => File['/etc/freshclam.conf'],
  }

  # ensure proper permissions on our logfile
  file { $logfile:
    ensure  => present,
    owner   => $clamav::params::user,
    mode    => '0644',
    require => File['/etc/freshclam.conf'],
  }
}