From 2cd6484a8c662f9bdd3c44d855bed969f5eeda07 Mon Sep 17 00:00:00 2001 From: Arne Teuke Date: Thu, 26 Dec 2019 19:10:20 +0100 Subject: [PATCH] adds log variables --- manifests/params.pp | 36 ++++++++++++++++++++++-- templates/scan_conf.erb | 62 +++++++---------------------------------- 2 files changed, 44 insertions(+), 54 deletions(-) diff --git a/manifests/params.pp b/manifests/params.pp index 1a3180c..d3e277f 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -24,12 +24,44 @@ # @param [string] pkg_ensure # which [package type](https://confdroid.com/2017/05/puppet-type-package/) # to choose, i.e. `latest` or `present`. +# @param [string] cv_logfile where to log messages for the clamd service. +# @param [string] cv_logfileunlock whether log file should be locked for +# writing -the lock protects againstrunning clamd multiple times +# @param [string] cv_logfilemaxsize themax size for the logfile. This also +# enables logrotation. +# @param [string] cv_logtime Whether to log the time with each message. +# @param [string] cv_logclean whether to log clean files. Useful in debugging +# but drastically increases the log size. +# @param [string] cv_logsyslog Use system logger (can work together with +# LogFile). +# @param [string] cv_logfacility type of syslog messages - please refer to +# 'man syslog'for facility names +# @param [string] cv_logverbose Whether to log verbose. +# @param [string] cv_logrotate whether to enable log rotation. Always enabled +# when LogFileMaxSize is enabled. +# @param [string] cv_preludeenable whether to enable prelude output. +# @param [string] cv_preludeanalyzername name of the analyzer used by +# prelude-admin. ############################################################################## class cd_clamav::params ( # installation -$reqpackages = ['clamav','clamav-update','clamd'], -$pkg_ensure = 'present', +$reqpackages = ['clamav','clamav-update','clamd'], +$pkg_ensure = 'present', + +# clamd +$cv_logfile = '/var/log/clamd.scan', +$cv_logfileunlock = 'no' +$cv_logfilemaxsize = '2M', +$cv_logtime = 'yes', +$cv_logclean = 'no', +$cv_logsyslog = 'yes', +$cv_logfacility = 'LOG_MAIL', +$cv_logverbose = 'no', +$cv_logrotate = 'yes', +$cv_preludeenable = 'no', +$cv_preludeanalyzername = 'ClamAV', + ) { diff --git a/templates/scan_conf.erb b/templates/scan_conf.erb index f31d854..f400746 100755 --- a/templates/scan_conf.erb +++ b/templates/scan_conf.erb @@ -3,61 +3,19 @@ ## original available under https://confdroid.com/2019/12/cd_clamav-scan-conf/ ################################################################################ -# Comment or remove the line below. -Example - -# Uncomment this option to enable logging. -# LogFile must be writable for the user running daemon. -# A full path is required. -# Default: disabled -#LogFile /var/log/clamd.scan - -# By default the log file is locked for writing - the lock protects against -# running clamd multiple times (if want to run another clamd, please -# copy the configuration file, change the LogFile variable, and run -# the daemon with --config-file option). -# This option disables log file locking. -# Default: no -#LogFileUnlock yes - -# Maximum size of the log file. -# Value of 0 disables the limit. -# You may use 'M' or 'm' for megabytes (1M = 1m = 1048576 bytes) -# and 'K' or 'k' for kilobytes (1K = 1k = 1024 bytes). To specify the size -# in bytes just don't use modifiers. If LogFileMaxSize is enabled, log -# rotation (the LogRotate option) will always be enabled. -# Default: 1M -#LogFileMaxSize 2M - -# Log time with each message. -# Default: no -#LogTime yes - -# Also log clean files. Useful in debugging but drastically increases the -# log size. -# Default: no -#LogClean yes - -# Use system logger (can work together with LogFile). -# Default: no -LogSyslog yes - -# Specify the type of syslog messages - please refer to 'man syslog' -# for facility names. -# Default: LOG_LOCAL6 -#LogFacility LOG_MAIL - -# Enable verbose logging. -# Default: no -#LogVerbose yes - -# Enable log rotation. Always enabled when LogFileMaxSize is enabled. -# Default: no -#LogRotate yes +LogFile <%= @cv_logfile -%> +LogFileUnlock <%= @cv_logfileunlock %> +LogFileMaxSize <%= @cv_logfilemaxsize %> +LogTime <%= @cv_logtime %> +LogClean <%= @cv_logclean %> +LogSyslog <%= @cv_logsyslog %> +LogFacility <%= @cv_logfacility %> +LogVerbose <%= @cv_logverbose %> +LogRotate <%= @cv_logrotate %> # Enable Prelude output. # Default: no -#PreludeEnable yes +PreludeEnable yes # # Set the name of the analyzer used by prelude-admin. # Default: ClamAV