Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restart clamd rspamd instance on nethserver-antivirus-update #137

Merged
merged 5 commits into from
Aug 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions api/filter/update
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ foreach (keys %$props) {

$db->set_prop('rspamd', $_, $value);
}
$db->set_prop('clamd@rspamd', 'VirusCheckStatus', $props->{'VirusCheckStatus'});
system("/sbin/e-smith/signal-event -j nethserver-mail-filter-save");
9 changes: 9 additions & 0 deletions createlinks-filter
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ my @templates = qw(
/etc/rspamd/local.d/antivirus.conf
/etc/rspamd/local.d/greylist.conf
/etc/rspamd/local.d/multimap.conf
/etc/rspamd/local.d/force_actions.conf
/etc/rspamd/override.d/metrics.conf
/etc/rspamd/local.d/settings.conf
/etc/rspamd/rspamd.conf
Expand Down Expand Up @@ -82,6 +83,7 @@ event_services($event, qw(
rspamd reload
postfix reload
httpd-admin reload
clamd@rspamd restart
));

#
Expand Down Expand Up @@ -116,3 +118,10 @@ event_services('trusted-networks-modify', qw(
rspamd reload
));


#
# nethserver-antivirus-update event
#
event_services('nethserver-antivirus-update', qw(
clamd@rspamd restart
));
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enabled
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
service
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# This file will be overwritten by the next rpm update
# use /etc/rspamd/override.d/file.conf' - to override the defaults
#
{
$vc = $rspamd{'VirusCheckStatus'} || 'enabled';

if ($vc eq 'enabled') {
$OUT .= 'rules {
CLAM_VIRUS_FAIL {
action = "soft reject";
message = "Cannot validate the message now. Try again later";
expression = "CLAM_VIRUS_FAIL";
}
}';
} else {
$OUT .= "# VirusCheckStatus is disabled\n";
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
{
$vc = $rspamd{'VirusCheckStatus'} || 'enabled';

#Do not soft reject if clamav is not reachable
authenticated \{
if ($vc eq 'enabled') {
$OUT .= "#Do not soft reject if clamav is not reachable\n";
$OUT .= 'authenticated {
priority = high;
authenticated = yes;
apply \{
apply {
symbols_disabled = ["FORCE_ACTION_CLAM_VIRUS_FAIL"];
\}
\}
}
}';
} else {
$OUT .= "# VirusCheckStatus is disabled";
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# start clamd and redis-rspamd by rspamd.service
[Unit]
Wants=clamd@rspamd.service
After=clamd@rspamd.service
Wants=redis-rspamd.service
After=redis-rspamd.service

Expand Down