Skip to content

Commit

Permalink
Run freshclam once to populate database
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjfisher authored and Sean Harvey committed May 30, 2019
1 parent e7a04ea commit f66b5e7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions manifests/freshclam.pp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@
$service_subscribe = File['freshclam.conf']
}

if $clamav::freshclam_initial_run {
# Run freshclam once so that the clamav daemon won't fail on startup
exec { 'freshclam':
path => '/sbin:/bin:/usr/sbin:/usr/bin',
creates => "${config_options['DatabaseDirectory']}/main.cvd",
subscribe => $service_subscribe,
}
}

# NOTE: RedHat comes with /etc/cron.daily/freshclam instead of a service
if $clamav::freshclam_service {
service { 'freshclam':
Expand All @@ -53,6 +62,7 @@
hasrestart => true,
hasstatus => true,
subscribe => $service_subscribe,
require => Exec['/usr/bin/freshclam'],
}
}

Expand Down
5 changes: 5 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
$freshclam_options = $clamav::params::freshclam_options,
$freshclam_sysconfig = $clamav::params::freshclam_sysconfig,
$freshclam_delay = $clamav::params::freshclam_delay,
$freshclam_initial_run = $clamav::params::freshclam_initial_run,

$clamav_milter_package = $clamav::params::clamav_milter_package,
$clamav_milter_version = $clamav::params::clamav_milter_version,
Expand Down Expand Up @@ -118,6 +119,10 @@
Anchor['clamav::end']
}

if $manage_clamd and $manage_freshclam {
Class['clamav::freshclam'] -> Class['clamav::clamd']
}

if $manage_clamav_milter {
Class['clamav::install'] ->
class { '::clamav::clamav_milter': } ->
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
$clamd_service_enable = true
$freshclam_service_ensure = 'running'
$freshclam_service_enable = true
$freshclam_initial_run = true
$clamav_milter_service_ensure = 'running'
$clamav_milter_service_enable = true

Expand Down

0 comments on commit f66b5e7

Please sign in to comment.