[Rspamd-Users] Patch for rspamadm configdump

Steve Sturges (ststurge) ststurge at cisco.com
Mon Jan 24 18:59:52 UTC 2022

Hi all-

The attached patch (against rspamd 3.1 source) addresses a two issues that I’ve observed when specifying scores, changing policies (and specifying other custom metadata) for symbols that are defined in lua or regexs. It also adds a —symbol-detail (or -d) option to rsapmadm configdump that consolidates the output for each symbol into a single object/structure.

Details of changes included in this patch:

* symbol score defined in a conf file, but no description provided in the conf file (as is done in scores.d/headers_group.conf)

For example, symbols where scores are defined or one_shot is changed in local.d/headers_groups.conf, and no description is provided, use the description from lua. If the description is provided in both, the one from the config file is used.  This eliminates the need to replicate a description between config file and lua.

See changes in src/lua/lua_config.c

* Properly group symbols that start out “ungrouped” when another group is later defined.

If a symbol is scored separately in a conf file and that conf file does not include a group definition, the symbol starts out ungrouped.  When the regex config, for example, is read where the symbol is fully defined, the group was not getting set because the symbol was initially ungrouped. This allows the definition to put the symbol in the proper group as defined in the regex config.

See changes in src/libserver/cfg_utils.c, src/lua/lua_config.c

* Enhancement support for rspamadm configdump --symbol-detail

This option dumps the output for all symbols in a single table (versus the different group and symbol tables of no-options). It will also include output for any custom metadata that is defined in a config file that are not rspam specific keywords.

The output format helps save having to look in different places when looking at all of the different options/settings for symbols that are defined across multiple config files and lua.

Using this option, here is the example output for the DKIM_CHECK symbol with this option with 2 example custom fields as specified in my local config.

        score = 0.0;
        description = "DKIM check callback";
        type = "normal";
        disabled = false;
        one_shot = true;
        group = "policies";
        groups [
        custom_field_1 = true;
        some_other_custom_field = false;

Relevant help from rspamadm configdump --help:

  rspamadm [OPTION…] configdump - dumps Rspamd configuration

Application Options:
  -d, --symbol-details     Show full symbol details only

See changes to src/libserver/rspamd_symcache.h, src/libserver/rspamd_symcache.c and src/rspamadm/configdump.c.

And Vsevolod, thanks for building an awesome tool!


-------------- next part --------------
A non-text attachment was scrubbed...
Name: symbol_detail.diff
Type: application/octet-stream
Size: 9285 bytes
Desc: symbol_detail.diff
URL: <https://lists.rspamd.com/pipermail/users/attachments/20220124/f62bce0e/attachment.obj>

More information about the Users mailing list