From 0adb6341d1d0bf12be716b54763676867212b02c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20M=E4kinen?= Date: Wed, 15 May 2013 12:50:52 +0300 Subject: [PATCH] clamav: Initial version of module. --- clamav/manifests/init.pp | 50 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 clamav/manifests/init.pp diff --git a/clamav/manifests/init.pp b/clamav/manifests/init.pp new file mode 100644 index 0000000..21c613e --- /dev/null +++ b/clamav/manifests/init.pp @@ -0,0 +1,50 @@ + +# Install Clam AntiVirus +# +class clamav { + + package { "clamav": + ensure => installed, + } + +} + + +# Scan directories periodically +# +# === Parameters: +# +# $name: +# Directory path to scan. +# $hour: +# At what hour should scanning occur. Defaults to 4am. +# $weekday: +# At what day should sacnning occur. For daily scanning you +# can use "*". Defaults to Sunday. +# $exclude: +# Directories matching to this regex will be excluded from +# scanning. Default is to scan everything. +# +# === Sample usage: +# +# clamav::scan { "/export/roles": +# exclude => "/export/roles/[a-z]*/library/archive", +# } +# +define clamav::scan($hour="04", $weekday="Sunday", $exclude=undef) { + + require clamav + + if $exclude { + $exclude_opts = "--exclude-dir='${exclude}'" + } + + cron { "virusscan-${name}": + command => "clamscan -r --infected --no-summary ${name} ${exclude_opts}", + user => "root", + hour => $hour, + minute => "00", + weekday => $weekday, + } + +}