Rspamd does not run if antivirus is disabled


(Mark Verlinde) #1

NethServer release 7.5.1804
Module: nethserver-mail2-filter

If the checkbox Anti-virus is unchecked rspamd does not start at boot nor does it restart.
Note: it keeps running after unchecking Anti-virus, but wont start up again.

to reproduce:
uncheck (Configuration) Email>Filter Anti-virus
Restart rspamd in (status) services rsampd restart

installed nethserver modules:

nethserver-antivirus.noarch               1.2.1-1.ns7        @nethserver-base
nethserver-backup-config.noarch           2.1.0-1.ns7        @nethserver
nethserver-base.noarch                    3.4.1-1.ns7        @nethserver-updates
nethserver-cgp.noarch                     2.1.3-1.ns7        @nethserver-base
nethserver-collectd.noarch                3.0.7-1.ns7        @nethserver-updates
nethserver-dc.x86_64                      1.5.3-1.ns7        @nethserver-updates
nethserver-diagtools.noarch               1.0.2-1.ns7        @nethserver
nethserver-dnsmasq.noarch                 1.6.6-1.ns7        @nethserver
nethserver-duc.noarch                     1.4.3-1.ns7        @nethserver
nethserver-firewall-base.noarch           3.4.1-1.ns7        @nethserver-updates
nethserver-hosts.noarch                   1.2.2-1.ns7        @nethserver
nethserver-httpd.noarch                   3.2.6-1.ns7        @nethserver-updates
nethserver-httpd-admin.noarch             2.3.2-1.ns7        @nethserver-updates
nethserver-httpd-virtualhosts.noarch      3.2.6-1.ns7        @nethserver-updates
nethserver-lang-en.noarch                 1.2.12-1.ns7       @nethserver-updates
nethserver-letsencrypt.noarch             1.1.6-1.ns7        @nethserver
nethserver-lib.noarch                     2.2.8-1.ns7        @nethserver-updates
nethserver-lsm.noarch                     1.2.3-1.ns7        @nethserver
nethserver-mail-smarthost.noarch          1.0.1-1.ns7        @nethserver
nethserver-mail2-common.noarch            2.2.5-1.ns7        @nethserver-updates
nethserver-mail2-filter.noarch            2.2.5-1.ns7        @nethserver-updates
nethserver-mail2-server.noarch            2.2.5-1.ns7        @nethserver-updates
nethserver-mysql.noarch                   1.1.3-1.ns7        @nethserver-base
nethserver-nethforge-release.noarch       7-2.ns7            @nethserver
nethserver-ntp.noarch                     1.1.3-1.ns7        @nethserver
nethserver-openssh.noarch                 1.2.2-1.ns7        @nethserver
nethserver-phonehome.noarch               1.3.0-1.ns7        @nethserver
nethserver-php.noarch                     1.2.0-1.ns7        @nethserver
nethserver-release.noarch                 7-8.ns7            @nethserver
nethserver-roundcubemail.noarch           1.2.9-1.ns7        @nethserver-base
nethserver-samba.noarch                   4.1.0-1.ns7        @nethserver-base
nethserver-smartd.noarch                  1.1.0-1.ns7        @nethserver
nethserver-sssd.noarch                    1.4.0-1.ns7        @nethserver-updates
nethserver-subscription.noarch            3.1.0-1.ns7        @nethserver
nethserver-unbound.noarch                 1.1.0-1.ns7        @nethserver-base
nethserver-vsftpd.noarch                  1.1.0-1.ns7        @nethserver-base
nethserver-yum.noarch                     1.4.1-1.ns7        @nethserver

Background info:
Came across this while testing my own home brew rspamd on arm, where rspamd was throwing errors in this configuration. Much later i found out is wont start/restart.Checked this behavior on a (relatively) clean x86_64 VM before filing it here.

We Are NethServer - Community Overview - Sep 18
(Alessio Fattorini) #2

@stephdl could you take a look at this?

(Stéphane de Labrusse) #3

Will try asap but currently in a road trip in spain

(Alessio Fattorini) #4

Yeaaah! Don’t worry Enjoy your trip

(Stefano Zamboni) #5

<private message>
are you gonna meet our common (old and wise) friend? if so, please remember him I’m waiting for him here :wink:
</private message>
in any case, enjoy

(Stéphane de Labrusse) #6

this time I am going to the green spain, galicia and asturias, you need a raincoat :smiley:

(Stéphane de Labrusse) #7

confirmed, thank for reporting, I can reproduce it

(Stéphane de Labrusse) #8

/etc/e-smith/templates/etc/rspamd/rspamd.conf/20Options:10:filters = "{(($rspamd{'VirusCheckStatus'}||'') eq 'enabled')?'chartable,dkim,spf,surbl,regexp,fuzzy_check':''}";

should be

/etc/e-smith/templates/etc/rspamd/rspamd.conf/20Options:10:filters = "{(($rspamd{'SpamCheckStatus'}||'') eq 'enabled')?'chartable,dkim,spf,surbl,regexp,fuzzy_check':''}";

a stupid mistake :frowning:

$rspamd{'VirusCheckStatus'} -> $rspamd{'SpamCheckStatus'}

let me get time to create an issue and commit, my daughter wants to be woke up :smiley:

EDIT: testing more it seems that filters = ''; property must be removed if no modules are desired, else the rspamd service crash when restarted.

(Mark Verlinde) #9

Can confirm if i boldly comment the line in the rspamd.conf rspamd restarts if antivirus is disabled.

# Options
options {
    pidfile = "$RUNDIR/";
local_addrs = "";

#filters = "chartable,dkim,spf,surbl,regexp,fuzzy_check";
raw_mode = false;

(Stéphane de Labrusse) #10

thank for your tests, really appreciated.

I’m introducing to stop the rspamd service when virus and spam are not checked, thank for your idea, I wait the review of @davidep before to merge.

(Mark Verlinde) #11

That’s a new feature, not the bug :+1:

Solved with testing package nethserver-mail2-filter-2.2.5-1.3.g37aeec5.ns7.noarch

(Mark Verlinde) #12

BTW (as a reminder for my self to)

the real resource hog is clamd@rspamd.service
I think we get a lot of troubles if you disable/stop rspamd itself

(Davide Principi) #13

I agree with Mark. If completely stopping rspamd does not save much resources, it’s not worth the effort.

On the other hand we could see if disabling AV checks can allow stopping clamd entirely. IIRC we run a private clamd@rspamd instance: it could be acceptable…