[Rspamd-Users] replies module error "Attempt to perform arithmetic [on string]"

Daniel Lysfjord lysfjord.daniel at smokepit.net
Wed Sep 11 19:12:32 UTC 2024


On 2024-09-11 20:44, Gerald Galster wrote:
>>>>>> I noticed an error ...
>>>>>> ...
>>>>>> call to (REPLIES_SET) failed (2):
>>>>>> /usr/local/share/rspamd/plugins/replies.lua:276: attempt to 
>>>>>> perform
>>>>>> arithmetic on field 'expire' (a string value); trace:
>>>>>> [1]:{/usr/local/share/rspamd/plugins/replies.lua:276 - <unknown> 
>>>>>> [Lua]};
>>>>>> Any ideas?
>>>>> rspamadm configtest?
>>>> (root at rivendell) 242# rspamadm configtest
>>>> implicitly enabling luapattern returncodes_matcher for rule 
>>>> SH_EMAIL_ZRD
>>>> implicitly enabling luapattern returncodes_matcher for rule 
>>>> SPAMHAUS_ZRD
>>>> syntax OK
>>> Have a look at https://rspamd.com/doc/modules/replies.html
>>> If your config looks like that, create it from scratch (no copy & 
>>> paste),
>>> to rule out any invisible chars that might interfere.
>>> Basically expire = 5d; is accepted here.
>> 
>> Re-created the file from scratch, precisely the same error. Here's its 
>> hexdump (FreeBSD machine so line ends are proper):
> 
> IIRC sources are compiled via ports on FreeBSD. You could grab a 
> tarball of
> the original rspamd sources and diff the directory trees. If they match 
> you
> could look for lua/luajit versions.
> 
> I've verified that the following config works on Linux with rspamd 3.9 
> and
> liblua 5.4:
> 
>   # replies.conf
>   action = "no action";
>   expire = 5d;
>   key_prefix = "rr";
>   sender_prefix = "rsrk";
>   message = "Message is reply to one we originated";
>   symbol = "REPLY";
>   max_local_size = 20;
>   max_global_size = 30;
>   servers = "127.0.0.1:2240";
> 
>   # rspamd log
>   (default: F (no action): [-4.00/9.00] [REPLY(-4.00){}, ...
>    forced: no action "Message is reply to one we originated"; score=nan 
> (set by replies)
> 
> Best regards,
> Gerald

I run rspamd on FreeBSD, and tested this to see if it's a problem for 
more people;

# jexec rspamd pkg info rspamd
rspamd-3.9.1
Name           : rspamd
Version        : 3.9.1
Installed on   : Thu Jul 25 12:32:25 2024 CEST
Origin         : mail/rspamd
Architecture   : FreeBSD:14:amd64
Prefix         : /usr/local
Categories     : mail
Licenses       : APACHE20
Maintainer     : vsevolod at FreeBSD.org
WWW            : https://rspamd.com/
Comment        : Fast spam filtering system
Options        :
         BLAS           : off
         CGP            : off
         GPERF          : off
         HYPERSCAN      : on
         LUAJIT         : on
Shared Libs required:
         libsqlite3.so.0
         libsodium.so.26
         libpcre2-8.so.0
         libluajit-5.1.so.2
         libintl.so.8
         libicuuc.so.74
         libicuio.so.74
         libicui18n.so.74
         libicudata.so.74
         libhs.so.5
         libglib-2.0.so.0
Shared Libs provided:
         librspamd-server.so
         librspamd-replxx.so
         librspamd-kann.so
         librspamd-ev.so
         librspamd-actrie.so
Annotations    :
         FreeBSD_version: 1401000
         build_timestamp: 2024-07-24T22:26:41+0000
         built_by       : poudriere-git-3.4.99.20240709
         cpe            : 
cpe:2.3:a:rspamd_project:rspamd:3.9.1:::::freebsd14:x64
         port_checkout_unclean: no
         port_git_hash  : d4359dc2249
         ports_top_checkout_unclean: yes
         ports_top_git_hash: f9b3e6c3ed9
         repo_type      : binary
         repository     : poudriere
Flat size      : 12.2MiB
Description    :
Rspamd is fast, modular and lightweight spam filter. It is designed to 
work
with big amount of mail and can be easily extended with own filters 
written in
lua.

# jexec rspamd pkg info | grep lua
luajit-devel-2.1.0.20240821    Just-In-Time Compiler for Lua

# jexec rspamd rspamadm configdump replies
*** Section replies ***
message = "Message is reply to one we originated";
expire = 432000;
key_prefix = "rr";
symbol = "REPLY";
servers = "10.0.0.100";

*** End of section replies ***


# grep -v "^ *\(--\|#\)" modules.d/replies.conf

replies {
   expire = 86400;
   key_prefix = "rr";
   message = "Message is reply to one we originated";
   symbol = "REPLY";

   .include(try=true,priority=5) "${DBDIR}/dynamic/replies.conf"
   .include(try=true,priority=1,duplicate=merge) 
"$LOCAL_CONFDIR/local.d/replies.conf"
   .include(try=true,priority=10) 
"$LOCAL_CONFDIR/override.d/replies.conf"
}

# grep -v "^ *\(--\|#\)" local.d/replies.conf

   servers = "10.0.0.100";
   expire = 5d;
   key_prefix = "rr";
   message = "Message is reply to one we originated";
   symbol = "REPLY";

I sent a mail somewhere, then replied, and, yes, in the headers there is 
the symbol "REPLY"

Everything seems to be working just fine.


More information about the Users mailing list