Compare commits
41 Commits
13ded603ca
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d8143691dd | ||
|
|
4356c549db | ||
| 9792e3c268 | |||
|
|
170e087a3c | ||
|
|
e65c98a16e | ||
| 5e3dcbbd1b | |||
|
|
ec9f3674f2 | ||
| ab50ce82f2 | |||
|
|
bda2cfda73 | ||
| dfb9601a5d | |||
|
|
3e0ccc94d0 | ||
|
|
ca315d9f4e | ||
| dfd2cba657 | |||
|
|
63540d9d22 | ||
|
|
97de17ae32 | ||
| d0dc4b2fc8 | |||
|
|
5c456b4c30 | ||
|
|
4543a31013 | ||
| dd1a1478ff | |||
|
|
2b3fee4c2b | ||
|
|
3da895df4d | ||
| beea16b8c4 | |||
|
|
234821e921 | ||
|
|
5a1c95427c | ||
| 8e32d2ad32 | |||
| 66173a7573 | |||
|
|
5d46317b6a | ||
|
|
442e9070c9 | ||
| 905676c71a | |||
|
|
f9ae014080 | ||
|
|
f653fadbba | ||
| e8f292967e | |||
|
|
164673a5ba | ||
| 5cf60685b7 | |||
|
|
d63385552a | ||
| 0b24fcdb8e | |||
|
|
b600b953ec | ||
|
|
deb6f938ae | ||
| 7f20c0e45e | |||
| 2d3304abac | |||
|
|
048c910a4b |
@@ -33,7 +33,8 @@
|
|||||||
- manage required config files
|
- manage required config files
|
||||||
- manage cronjob settings via parameters
|
- manage cronjob settings via parameters
|
||||||
- run cron job to scan the file system (by default starting at root, configurable) via clamdscan
|
- run cron job to scan the file system (by default starting at root, configurable) via clamdscan
|
||||||
- manage services
|
- set ConcurrentDatabaseReload option `yes`/`no` to optimize RAM consumption. defaults to `no`
|
||||||
|
- manage `freshclam` and `clamd` services
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
@@ -41,7 +42,7 @@ All dependencies must be included in the catalogue.
|
|||||||
|
|
||||||
- [confdroid_resources](https://sourcecode.confdroid.com/confdroid/confdroid_resources) for managing yum repo resources.
|
- [confdroid_resources](https://sourcecode.confdroid.com/confdroid/confdroid_resources) for managing yum repo resources.
|
||||||
|
|
||||||
### Deployment
|
## Deployment
|
||||||
|
|
||||||
- native Puppet deployment
|
- native Puppet deployment
|
||||||
|
|
||||||
|
|||||||
@@ -71,9 +71,8 @@
|
|||||||
<p><a href="#features">Features</a></p>
|
<p><a href="#features">Features</a></p>
|
||||||
</li><li>
|
</li><li>
|
||||||
<p><a href="#dependencies">Dependencies</a></p>
|
<p><a href="#dependencies">Dependencies</a></p>
|
||||||
<ul><li>
|
</li><li>
|
||||||
<p><a href="#deployment">Deployment</a></p>
|
<p><a href="#deployment">Deployment</a></p>
|
||||||
</li></ul>
|
|
||||||
</li><li>
|
</li><li>
|
||||||
<p><a href="#parameters">Parameters</a></p>
|
<p><a href="#parameters">Parameters</a></p>
|
||||||
</li><li>
|
</li><li>
|
||||||
@@ -108,7 +107,9 @@
|
|||||||
</li><li>
|
</li><li>
|
||||||
<p>run cron job to scan the file system (by default starting at root, configurable) via clamdscan</p>
|
<p>run cron job to scan the file system (by default starting at root, configurable) via clamdscan</p>
|
||||||
</li><li>
|
</li><li>
|
||||||
<p>manage services</p>
|
<p>set ConcurrentDatabaseReload option <code>yes</code>/<code>no</code> to optimize RAM consumption. defaults to <code>no</code></p>
|
||||||
|
</li><li>
|
||||||
|
<p>manage <code>freshclam</code> and <code>clamd</code> services</p>
|
||||||
</li></ul>
|
</li></ul>
|
||||||
|
|
||||||
<h2 id="label-Dependencies">Dependencies</h2>
|
<h2 id="label-Dependencies">Dependencies</h2>
|
||||||
@@ -118,7 +119,7 @@
|
|||||||
<p><a href="https://sourcecode.confdroid.com/confdroid/confdroid_resources">confdroid_resources</a> for managing yum repo resources.</p>
|
<p><a href="https://sourcecode.confdroid.com/confdroid/confdroid_resources">confdroid_resources</a> for managing yum repo resources.</p>
|
||||||
</li></ul>
|
</li></ul>
|
||||||
|
|
||||||
<h3 id="label-Deployment">Deployment</h3>
|
<h2 id="label-Deployment">Deployment</h2>
|
||||||
<ul><li>
|
<ul><li>
|
||||||
<p>native Puppet deployment</p>
|
<p>native Puppet deployment</p>
|
||||||
</li></ul>
|
</li></ul>
|
||||||
|
|||||||
@@ -71,9 +71,8 @@
|
|||||||
<p><a href="#features">Features</a></p>
|
<p><a href="#features">Features</a></p>
|
||||||
</li><li>
|
</li><li>
|
||||||
<p><a href="#dependencies">Dependencies</a></p>
|
<p><a href="#dependencies">Dependencies</a></p>
|
||||||
<ul><li>
|
</li><li>
|
||||||
<p><a href="#deployment">Deployment</a></p>
|
<p><a href="#deployment">Deployment</a></p>
|
||||||
</li></ul>
|
|
||||||
</li><li>
|
</li><li>
|
||||||
<p><a href="#parameters">Parameters</a></p>
|
<p><a href="#parameters">Parameters</a></p>
|
||||||
</li><li>
|
</li><li>
|
||||||
@@ -108,7 +107,9 @@
|
|||||||
</li><li>
|
</li><li>
|
||||||
<p>run cron job to scan the file system (by default starting at root, configurable) via clamdscan</p>
|
<p>run cron job to scan the file system (by default starting at root, configurable) via clamdscan</p>
|
||||||
</li><li>
|
</li><li>
|
||||||
<p>manage services</p>
|
<p>set ConcurrentDatabaseReload option <code>yes</code>/<code>no</code> to optimize RAM consumption. defaults to <code>no</code></p>
|
||||||
|
</li><li>
|
||||||
|
<p>manage <code>freshclam</code> and <code>clamd</code> services</p>
|
||||||
</li></ul>
|
</li></ul>
|
||||||
|
|
||||||
<h2 id="label-Dependencies">Dependencies</h2>
|
<h2 id="label-Dependencies">Dependencies</h2>
|
||||||
@@ -118,7 +119,7 @@
|
|||||||
<p><a href="https://sourcecode.confdroid.com/confdroid/confdroid_resources">confdroid_resources</a> for managing yum repo resources.</p>
|
<p><a href="https://sourcecode.confdroid.com/confdroid/confdroid_resources">confdroid_resources</a> for managing yum repo resources.</p>
|
||||||
</li></ul>
|
</li></ul>
|
||||||
|
|
||||||
<h3 id="label-Deployment">Deployment</h3>
|
<h2 id="label-Deployment">Deployment</h2>
|
||||||
<ul><li>
|
<ul><li>
|
||||||
<p>native Puppet deployment</p>
|
<p>native Puppet deployment</p>
|
||||||
</li></ul>
|
</li></ul>
|
||||||
|
|||||||
@@ -158,7 +158,23 @@
|
|||||||
60
|
60
|
||||||
61
|
61
|
||||||
62
|
62
|
||||||
63</pre>
|
63
|
||||||
|
64
|
||||||
|
65
|
||||||
|
66
|
||||||
|
67
|
||||||
|
68
|
||||||
|
69
|
||||||
|
70
|
||||||
|
71
|
||||||
|
72
|
||||||
|
73
|
||||||
|
74
|
||||||
|
75
|
||||||
|
76
|
||||||
|
77
|
||||||
|
78
|
||||||
|
79</pre>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<pre class="code"><span class="info file"># File 'manifests/main/files.pp', line 6</span>
|
<pre class="code"><span class="info file"># File 'manifests/main/files.pp', line 6</span>
|
||||||
@@ -193,6 +209,7 @@ class confdroid_clamav::main::files (
|
|||||||
seltype => etc_t,
|
seltype => etc_t,
|
||||||
seluser => system_u,
|
seluser => system_u,
|
||||||
content => template($cv_freshclam_erb),
|
content => template($cv_freshclam_erb),
|
||||||
|
notify => Service[$cv_freshclam],
|
||||||
}
|
}
|
||||||
|
|
||||||
# freshclam service config file
|
# freshclam service config file
|
||||||
@@ -206,6 +223,21 @@ class confdroid_clamav::main::files (
|
|||||||
seltype => etc_t,
|
seltype => etc_t,
|
||||||
seluser => system_u,
|
seluser => system_u,
|
||||||
content => template($cv_freshclam_svc_erb),
|
content => template($cv_freshclam_svc_erb),
|
||||||
|
notify => Service[$cv_freshclam],
|
||||||
|
}
|
||||||
|
|
||||||
|
# clamd service config file
|
||||||
|
file { $cv_clamd_svc :
|
||||||
|
ensure => file,
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
mode => '0600',
|
||||||
|
selrange => s0,
|
||||||
|
selrole => object_r,
|
||||||
|
seltype => etc_t,
|
||||||
|
seluser => system_u,
|
||||||
|
content => template($cv_clamd_svc_erb),
|
||||||
|
notify => Service[$cv_service],
|
||||||
}
|
}
|
||||||
|
|
||||||
# shell script for scanning and alerting
|
# shell script for scanning and alerting
|
||||||
|
|||||||
@@ -120,8 +120,8 @@ class confdroid_clamav::main::install (
|
|||||||
) inherits confdroid_clamav::params {
|
) inherits confdroid_clamav::params {
|
||||||
require confdroid_resources::main::epel
|
require confdroid_resources::main::epel
|
||||||
|
|
||||||
package { $reqpackages:
|
package { $cv_reqpackages:
|
||||||
ensure => $pkg_ensure,
|
ensure => $cv_pkg_ensure,
|
||||||
}
|
}
|
||||||
}</pre>
|
}</pre>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ inherited by all classes except defines.
|
|||||||
|
|
||||||
<li>
|
<li>
|
||||||
|
|
||||||
<span class='name'>reqpackages</span>
|
<span class='name'>cv_reqpackages</span>
|
||||||
|
|
||||||
|
|
||||||
<span class='type'>(<tt>Array</tt>)</span>
|
<span class='type'>(<tt>Array</tt>)</span>
|
||||||
@@ -127,7 +127,7 @@ inherited by all classes except defines.
|
|||||||
|
|
||||||
<li>
|
<li>
|
||||||
|
|
||||||
<span class='name'>pkg_ensure</span>
|
<span class='name'>cv_pkg_ensure</span>
|
||||||
|
|
||||||
|
|
||||||
<span class='type'>(<tt>String</tt>)</span>
|
<span class='type'>(<tt>String</tt>)</span>
|
||||||
@@ -517,6 +517,114 @@ inherited by all classes except defines.
|
|||||||
—
|
—
|
||||||
<div class='inline'>
|
<div class='inline'>
|
||||||
<p>whether to enable the clamd service</p>
|
<p>whether to enable the clamd service</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
<span class='name'>cv_use_excludepaths</span>
|
||||||
|
|
||||||
|
|
||||||
|
<span class='type'>(<tt>Boolean</tt>)</span>
|
||||||
|
|
||||||
|
|
||||||
|
<em class="default">(defaults to: <tt>true</tt>)</em>
|
||||||
|
|
||||||
|
|
||||||
|
—
|
||||||
|
<div class='inline'>
|
||||||
|
<p>whether to use advanced exclude paths</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
<span class='name'>cv_concurrentdatabasereload</span>
|
||||||
|
|
||||||
|
|
||||||
|
<span class='type'>(<tt>String</tt>)</span>
|
||||||
|
|
||||||
|
|
||||||
|
<em class="default">(defaults to: <tt>'no'</tt>)</em>
|
||||||
|
|
||||||
|
|
||||||
|
—
|
||||||
|
<div class='inline'>
|
||||||
|
<p>whether to enable concurrent database reloads. This is useful when you have multiple clamd instances running on the same machine. If you have only one clamd instance, this should be set to ‘no’.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
<span class='name'>cv_clamd_max_mem</span>
|
||||||
|
|
||||||
|
|
||||||
|
<span class='type'>(<tt>String</tt>)</span>
|
||||||
|
|
||||||
|
|
||||||
|
<em class="default">(defaults to: <tt>'512M'</tt>)</em>
|
||||||
|
|
||||||
|
|
||||||
|
—
|
||||||
|
<div class='inline'>
|
||||||
|
<p>maximum memory usage for clamd.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
<span class='name'>cv_clamd_cpu_quota</span>
|
||||||
|
|
||||||
|
|
||||||
|
<span class='type'>(<tt>String</tt>)</span>
|
||||||
|
|
||||||
|
|
||||||
|
<em class="default">(defaults to: <tt>'30%'</tt>)</em>
|
||||||
|
|
||||||
|
|
||||||
|
—
|
||||||
|
<div class='inline'>
|
||||||
|
<p>maximum CPU usage for clamd.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
<span class='name'>cv_nice_value</span>
|
||||||
|
|
||||||
|
|
||||||
|
<span class='type'>(<tt>String</tt>)</span>
|
||||||
|
|
||||||
|
|
||||||
|
<em class="default">(defaults to: <tt>'19'</tt>)</em>
|
||||||
|
|
||||||
|
|
||||||
|
—
|
||||||
|
<div class='inline'>
|
||||||
|
<p>nice value for clamd. This is a number between -20 and 19. The lower the number, the higher the priority. The default is 19, which is the lowest priority.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
<span class='name'>cv_timeout_start_sec</span>
|
||||||
|
|
||||||
|
|
||||||
|
<span class='type'>(<tt>String</tt>)</span>
|
||||||
|
|
||||||
|
|
||||||
|
<em class="default">(defaults to: <tt>'420'</tt>)</em>
|
||||||
|
|
||||||
|
|
||||||
|
—
|
||||||
|
<div class='inline'>
|
||||||
|
<p>timeout for starting the clamd service.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
@@ -532,17 +640,6 @@ inherited by all classes except defines.
|
|||||||
<pre class="lines">
|
<pre class="lines">
|
||||||
|
|
||||||
|
|
||||||
39
|
|
||||||
40
|
|
||||||
41
|
|
||||||
42
|
|
||||||
43
|
|
||||||
44
|
|
||||||
45
|
|
||||||
46
|
|
||||||
47
|
|
||||||
48
|
|
||||||
49
|
|
||||||
50
|
50
|
||||||
51
|
51
|
||||||
52
|
52
|
||||||
@@ -582,16 +679,35 @@ inherited by all classes except defines.
|
|||||||
86
|
86
|
||||||
87
|
87
|
||||||
88
|
88
|
||||||
89</pre>
|
89
|
||||||
|
90
|
||||||
|
91
|
||||||
|
92
|
||||||
|
93
|
||||||
|
94
|
||||||
|
95
|
||||||
|
96
|
||||||
|
97
|
||||||
|
98
|
||||||
|
99
|
||||||
|
100
|
||||||
|
101
|
||||||
|
102
|
||||||
|
103
|
||||||
|
104
|
||||||
|
105
|
||||||
|
106
|
||||||
|
107
|
||||||
|
108</pre>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<pre class="code"><span class="info file"># File 'manifests/params.pp', line 39</span>
|
<pre class="code"><span class="info file"># File 'manifests/params.pp', line 50</span>
|
||||||
|
|
||||||
class confdroid_clamav::params (
|
class confdroid_clamav::params (
|
||||||
|
|
||||||
# installation
|
# installation
|
||||||
Array $reqpackages = ['clamav','clamd','s-nail'],
|
Array $cv_reqpackages = ['clamav','clamd','s-nail'],
|
||||||
String $pkg_ensure = 'present',
|
String $cv_pkg_ensure = 'present',
|
||||||
|
|
||||||
# clamd
|
# clamd
|
||||||
String $cv_logfile = '/var/log/clamd.scan',
|
String $cv_logfile = '/var/log/clamd.scan',
|
||||||
@@ -615,6 +731,12 @@ class confdroid_clamav::params (
|
|||||||
String $cv_alert_file = 'tmp/clamav-alert.txt',
|
String $cv_alert_file = 'tmp/clamav-alert.txt',
|
||||||
Boolean $cv_enable_freshclam = true,
|
Boolean $cv_enable_freshclam = true,
|
||||||
Boolean $cv_enable_clamd = true,
|
Boolean $cv_enable_clamd = true,
|
||||||
|
Boolean $cv_use_excludepaths = true,
|
||||||
|
String $cv_concurrentdatabasereload = 'no',
|
||||||
|
String $cv_clamd_max_mem = '512M',
|
||||||
|
String $cv_clamd_cpu_quota = '30%',
|
||||||
|
String $cv_nice_value = '19',
|
||||||
|
String $cv_timeout_start_sec = '420'
|
||||||
|
|
||||||
) {
|
) {
|
||||||
# service
|
# service
|
||||||
@@ -631,6 +753,8 @@ class confdroid_clamav::params (
|
|||||||
$cv_freshclam_erb = 'confdroid_clamav/freshclam_conf.erb'
|
$cv_freshclam_erb = 'confdroid_clamav/freshclam_conf.erb'
|
||||||
$cv_freshclam_svc = '/usr/lib/systemd/system/freshclam.service'
|
$cv_freshclam_svc = '/usr/lib/systemd/system/freshclam.service'
|
||||||
$cv_freshclam_svc_erb = 'confdroid_clamav/freshclam_svc.erb'
|
$cv_freshclam_svc_erb = 'confdroid_clamav/freshclam_svc.erb'
|
||||||
|
$cv_clamd_svc = '/usr/lib/systemd/system/clamd@.service'
|
||||||
|
$cv_clamd_svc_erb = 'confdroid_clamav/clamd_svc.erb'
|
||||||
$cv_shell_script = "${cv_config_d_dir}/scan.sh"
|
$cv_shell_script = "${cv_config_d_dir}/scan.sh"
|
||||||
$cv_shell_script_erb = 'confdroid_clamav/scan.sh.erb'
|
$cv_shell_script_erb = 'confdroid_clamav/scan.sh.erb'
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ class confdroid_clamav::main::files (
|
|||||||
seltype => etc_t,
|
seltype => etc_t,
|
||||||
seluser => system_u,
|
seluser => system_u,
|
||||||
content => template($cv_freshclam_erb),
|
content => template($cv_freshclam_erb),
|
||||||
|
notify => Service[$cv_freshclam],
|
||||||
}
|
}
|
||||||
|
|
||||||
# freshclam service config file
|
# freshclam service config file
|
||||||
@@ -46,6 +47,21 @@ class confdroid_clamav::main::files (
|
|||||||
seltype => etc_t,
|
seltype => etc_t,
|
||||||
seluser => system_u,
|
seluser => system_u,
|
||||||
content => template($cv_freshclam_svc_erb),
|
content => template($cv_freshclam_svc_erb),
|
||||||
|
notify => Service[$cv_freshclam],
|
||||||
|
}
|
||||||
|
|
||||||
|
# clamd service config file
|
||||||
|
file { $cv_clamd_svc :
|
||||||
|
ensure => file,
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
mode => '0600',
|
||||||
|
selrange => s0,
|
||||||
|
selrole => object_r,
|
||||||
|
seltype => etc_t,
|
||||||
|
seluser => system_u,
|
||||||
|
content => template($cv_clamd_svc_erb),
|
||||||
|
notify => Service[$cv_service],
|
||||||
}
|
}
|
||||||
|
|
||||||
# shell script for scanning and alerting
|
# shell script for scanning and alerting
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class confdroid_clamav::main::install (
|
|||||||
) inherits confdroid_clamav::params {
|
) inherits confdroid_clamav::params {
|
||||||
require confdroid_resources::main::epel
|
require confdroid_resources::main::epel
|
||||||
|
|
||||||
package { $reqpackages:
|
package { $cv_reqpackages:
|
||||||
ensure => $pkg_ensure,
|
ensure => $cv_pkg_ensure,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
# Author: 12ww1160 (12ww1160@confdroid.com)
|
# Author: 12ww1160 (12ww1160@confdroid.com)
|
||||||
# @summary Class holds all parameters for the confdroid_clamav module and is
|
# @summary Class holds all parameters for the confdroid_clamav module and is
|
||||||
# inherited by all classes except defines.
|
# inherited by all classes except defines.
|
||||||
# @param [Array] reqpackages List of packages to install.
|
# @param [Array] cv_reqpackages List of packages to install.
|
||||||
# @param [String] pkg_ensure
|
# @param [String] cv_pkg_ensure
|
||||||
# which [package type](https://confdroid.com/2017/05/puppet-type-package/)
|
# which [package type](https://confdroid.com/2017/05/puppet-type-package/)
|
||||||
# to choose, i.e. `latest` or `present`.
|
# to choose, i.e. `latest` or `present`.
|
||||||
# @param [String] cv_logfile where to log messages for the clamd service.
|
# @param [String] cv_logfile where to log messages for the clamd service.
|
||||||
@@ -35,12 +35,23 @@
|
|||||||
# @param [String] cv_alert_file location and name of the alert file
|
# @param [String] cv_alert_file location and name of the alert file
|
||||||
# @param [Boolean] cv_enable_freshclam whether to enable the freshclam service
|
# @param [Boolean] cv_enable_freshclam whether to enable the freshclam service
|
||||||
# @param [Boolean] cv_enable_clamd whether to enable the clamd service
|
# @param [Boolean] cv_enable_clamd whether to enable the clamd service
|
||||||
|
# @param [Boolean] cv_use_excludepaths whether to use advanced exclude paths
|
||||||
|
# @param [String] cv_concurrentdatabasereload whether to enable concurrent
|
||||||
|
# database reloads. This is useful when you have multiple clamd instances
|
||||||
|
# running on the same machine. If you have only one clamd instance, this
|
||||||
|
# should be set to 'no'.
|
||||||
|
# @param [String] cv_clamd_max_mem maximum memory usage for clamd.
|
||||||
|
# @param [String] cv_clamd_cpu_quota maximum CPU usage for clamd.
|
||||||
|
# @param [String] cv_nice_value nice value for clamd. This is a number between
|
||||||
|
# -20 and 19. The lower the number, the higher the priority. The default is
|
||||||
|
# 19, which is the lowest priority.
|
||||||
|
# @param [String] cv_timeout_start_sec timeout for starting the clamd service.
|
||||||
##############################################################################
|
##############################################################################
|
||||||
class confdroid_clamav::params (
|
class confdroid_clamav::params (
|
||||||
|
|
||||||
# installation
|
# installation
|
||||||
Array $reqpackages = ['clamav','clamd','s-nail'],
|
Array $cv_reqpackages = ['clamav','clamd','s-nail'],
|
||||||
String $pkg_ensure = 'present',
|
String $cv_pkg_ensure = 'present',
|
||||||
|
|
||||||
# clamd
|
# clamd
|
||||||
String $cv_logfile = '/var/log/clamd.scan',
|
String $cv_logfile = '/var/log/clamd.scan',
|
||||||
@@ -64,6 +75,12 @@ class confdroid_clamav::params (
|
|||||||
String $cv_alert_file = 'tmp/clamav-alert.txt',
|
String $cv_alert_file = 'tmp/clamav-alert.txt',
|
||||||
Boolean $cv_enable_freshclam = true,
|
Boolean $cv_enable_freshclam = true,
|
||||||
Boolean $cv_enable_clamd = true,
|
Boolean $cv_enable_clamd = true,
|
||||||
|
Boolean $cv_use_excludepaths = true,
|
||||||
|
String $cv_concurrentdatabasereload = 'no',
|
||||||
|
String $cv_clamd_max_mem = '512M',
|
||||||
|
String $cv_clamd_cpu_quota = '30%',
|
||||||
|
String $cv_nice_value = '19',
|
||||||
|
String $cv_timeout_start_sec = '420'
|
||||||
|
|
||||||
) {
|
) {
|
||||||
# service
|
# service
|
||||||
@@ -80,6 +97,8 @@ class confdroid_clamav::params (
|
|||||||
$cv_freshclam_erb = 'confdroid_clamav/freshclam_conf.erb'
|
$cv_freshclam_erb = 'confdroid_clamav/freshclam_conf.erb'
|
||||||
$cv_freshclam_svc = '/usr/lib/systemd/system/freshclam.service'
|
$cv_freshclam_svc = '/usr/lib/systemd/system/freshclam.service'
|
||||||
$cv_freshclam_svc_erb = 'confdroid_clamav/freshclam_svc.erb'
|
$cv_freshclam_svc_erb = 'confdroid_clamav/freshclam_svc.erb'
|
||||||
|
$cv_clamd_svc = '/usr/lib/systemd/system/clamd@.service'
|
||||||
|
$cv_clamd_svc_erb = 'confdroid_clamav/clamd_svc.erb'
|
||||||
$cv_shell_script = "${cv_config_d_dir}/scan.sh"
|
$cv_shell_script = "${cv_config_d_dir}/scan.sh"
|
||||||
$cv_shell_script_erb = 'confdroid_clamav/scan.sh.erb'
|
$cv_shell_script_erb = 'confdroid_clamav/scan.sh.erb'
|
||||||
|
|
||||||
|
|||||||
22
templates/clamd_svc.erb
Normal file
22
templates/clamd_svc.erb
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
################################################################################
|
||||||
|
### clamd.svc created by Puppet, manual changes will be overwritten!!! ###
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description = clamd scanner (%i) daemon
|
||||||
|
Documentation=man:clamd(8) man:clamd.conf(5) https://www.clamav.net/documents/
|
||||||
|
After = syslog.target nss-lookup.target network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type = forking
|
||||||
|
ExecStart = /usr/sbin/clamd -c /etc/clamd.d/%i.conf
|
||||||
|
# Reload the database
|
||||||
|
ExecReload=/bin/kill -USR2 $MAINPID
|
||||||
|
Restart = on-failure
|
||||||
|
TimeoutStartSec=<%= @cv_timeout_start_sec %>
|
||||||
|
MemoryMax=<%= @cv_clamd_max_mem %>
|
||||||
|
CPUQuota=<%= @cv_clamd_cpu_quota %>
|
||||||
|
Nice=<%= @cv_nice_value %>
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy = multi-user.target
|
||||||
@@ -1,23 +1,26 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
# Set paths
|
|
||||||
SCAN_DIR="<%= @cv_scan_dir %>"
|
SCAN_DIR="<%= @cv_scan_dir %>"
|
||||||
LOG_FILE="<%= @cv_logfile %>"
|
LOG_FILE="<%= @cv_logfile %>"
|
||||||
TMP_ALERT="<%= @cv_alert_file %>"
|
TMP_ALERT="<%= @cv_alert_file %>"
|
||||||
EMAIL="<%= @cv_alert_email %>"
|
EMAIL="<%= @cv_alert_email %>"
|
||||||
|
|
||||||
# Run clamscan
|
# Ensure the log directory exists
|
||||||
clamscan -r --infected --log="$LOG_FILE" "$SCAN_DIR" > /dev/null
|
mkdir -p "$(dirname "$LOG_FILE")"
|
||||||
|
|
||||||
# Check if infections were found
|
# Preferred: clamdscan with multiscan + fdpass
|
||||||
if grep -q "Infected files: [^0]" "$LOG_FILE"; then
|
clamdscan --multiscan --fdpass --infected --log="$LOG_FILE" "$SCAN_DIR" > /dev/null || true
|
||||||
echo "ClamAV has found infected files on $(hostname)!" > "$TMP_ALERT"
|
|
||||||
echo "" >> "$TMP_ALERT"
|
# Check for infections (same logic as before)
|
||||||
grep "FOUND" "$LOG_FILE" >> "$TMP_ALERT"
|
if grep -q "Infected files: [^0]" "$LOG_FILE" 2>/dev/null; then
|
||||||
|
{
|
||||||
|
echo "ClamAV has found infected files on $(hostname)!"
|
||||||
|
echo ""
|
||||||
|
grep "FOUND" "$LOG_FILE" || true
|
||||||
|
} > "$TMP_ALERT"
|
||||||
|
|
||||||
# Send the alert email
|
|
||||||
mail -s "⚠️ ClamAV Alert on $(hostname)" "$EMAIL" < "$TMP_ALERT"
|
mail -s "⚠️ ClamAV Alert on $(hostname)" "$EMAIL" < "$TMP_ALERT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Clean up
|
|
||||||
rm -f "$TMP_ALERT"
|
rm -f "$TMP_ALERT"
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ LogRotate <%= @cv_logrotate %>
|
|||||||
PreludeEnable <%= @cv_preludeenable %>
|
PreludeEnable <%= @cv_preludeenable %>
|
||||||
TCPSocket <%= @cv_tcpsocket %>
|
TCPSocket <%= @cv_tcpsocket %>
|
||||||
TCPAddr <%= @cv_tcpaddress %>
|
TCPAddr <%= @cv_tcpaddress %>
|
||||||
|
ConcurrentDatabaseReload <%= @cv_concurrentdatabasereload %>
|
||||||
#
|
#
|
||||||
# Set the name of the analyzer used by prelude-admin.
|
# Set the name of the analyzer used by prelude-admin.
|
||||||
# Default: ClamAV
|
# Default: ClamAV
|
||||||
@@ -21,7 +22,7 @@ PreludeAnalyzerName ClamAV
|
|||||||
|
|
||||||
# Log additional information about the infected file, such as its
|
# Log additional information about the infected file, such as its
|
||||||
# size and hash, together with the virus name.
|
# size and hash, together with the virus name.
|
||||||
#ExtendedDetectionInfo yes
|
ExtendedDetectionInfo yes
|
||||||
|
|
||||||
# This option allows you to save a process identifier of the listening
|
# This option allows you to save a process identifier of the listening
|
||||||
# daemon (main thread).
|
# daemon (main thread).
|
||||||
@@ -132,6 +133,28 @@ PreludeAnalyzerName ClamAV
|
|||||||
#ExcludePath ^/proc/
|
#ExcludePath ^/proc/
|
||||||
#ExcludePath ^/sys/
|
#ExcludePath ^/sys/
|
||||||
|
|
||||||
|
<% if @cv_use_excludepaths %>
|
||||||
|
ExcludePath ^/proc
|
||||||
|
ExcludePath ^/sys
|
||||||
|
ExcludePath ^/dev
|
||||||
|
ExcludePath ^/run
|
||||||
|
ExcludePath ^/var/run
|
||||||
|
ExcludePath ^/var/tmp
|
||||||
|
ExcludePath ^/tmp
|
||||||
|
ExcludePath ^/var/lib/clamav
|
||||||
|
ExcludePath ^/var/log/clamav
|
||||||
|
ExcludePath ^/var/lib/docker
|
||||||
|
ExcludePath ^/var/lib/containerd
|
||||||
|
ExcludePath ^/var/lib/kubelet/pods
|
||||||
|
ExcludePath ^/var/lib/kubelet/plugins
|
||||||
|
ExcludePath ^/var/lib/kubelet/plugins_registry
|
||||||
|
ExcludePath ^/var/log/pods
|
||||||
|
ExcludePath ^/var/log/containers
|
||||||
|
ExcludePath ^/var/cache
|
||||||
|
ExcludePath ^/run/containerd
|
||||||
|
ExcludePath ^/run/docker
|
||||||
|
<% end %>
|
||||||
|
|
||||||
# Maximum depth directories are scanned at.
|
# Maximum depth directories are scanned at.
|
||||||
# Default: 15
|
# Default: 15
|
||||||
#MaxDirectoryRecursion 20
|
#MaxDirectoryRecursion 20
|
||||||
|
|||||||
Reference in New Issue
Block a user