Smtp filter with Rspamd

**NethServer Version:Last
Hey. I have the smtp filter with Rspamd, how do I add addresses to black list and white list. If the addresses of about 2000 ?

I didn’t try this, but this might be an option: https://gist.github.com/kvaps/25507a87dc287e6a620e1eec2d60ebc1

I mean Rspamd in the implementation of the nethserver. In rspamd itself, this is done through the web interface. But in the plug-in to the nethserver. The file is read-only and can only be added to 1 address through the nethserver interface. Long addition will be))))

@davidep sometime ago did a script to learn email to spam from a imap folder…need to find it again…some clue ?

Oups a misunderstood your issue…you want to add email adresses manually from a file…let me check…we could create a second map for this purpose.

The first blacklist map is a template created from db properties, we need another map for this

My Communigate mail server is located on a separate Server, it would be nice to hook up the spam folder with NS to it. But you can still manually add. But I already have a large list of addresses and would like to add it immediately.

Ok not tested, we could do something for you

in the file /etc/rspamd/local.d/multimap.conf you have declaration for the map we use for instance

# whitelist the senders
FROM_WHITELIST {
    type = "from";
    map = [
    "${CONFDIR}/whitelist_from.map",
    ];
    prefilter = true;
    filter = "email:addr";
    action = "accept";
    description = "Accepted list of FROM email address";
    symbol = "FROM_WHITELIST";
}

the idea is to add the path to a new map

    map = [
    "${CONFDIR}/whitelist_from.map",
    "${CONFDIR}/manual_whitelist_from.map",
    ];

the path is /etc/rspamd, be sure of the permission on the new file manual_whitelist_from.map and add inside one address per line

Restart rspamd after : systemctl restart rspamd

Your work will be overwritten by the next time you save a setting in the filter panel, we need to find a way to add it probably by a db property.

@davidep what do you think, the idea is to create blacklist/whitelist from a file for those who have a long list, here around 2000

@kelevra can you test it by adding the maps needed, one by whithelist and blacklist

Card created in issue tracker

I don’t know… A long list seems hard to maintain

We have two ways but first I would like to do it by a hidden prop, once enabled you could either add manually with vim, or by the web UI

Ok just tested now…do not waste your time if you want to blacklist a gmail address…gmail wants to be different

firstname.lastname@gmail.com => firstnamelastname@gmail.com

check https://github.com/vstakhov/rspamd/issues/1966

maybe we should do a documentation on this

I did an issue

IMO, this is a very special case and it doesn’t worth an implementation inside the package.

We can just document here, or somewhere else, how to do it using a template-custom.

1 Like

Why not to follow @giacomo’s approach?

@kelevra’s request seems a typical template-custom use case which does not require additional code!

Maybe I’m wrong but the two templates to customize are:

  • /etc/e-smith/templates/etc/rspamd/whitelist_to.map
  • /etc/e-smith/templates/etc/rspamd/whitelist_from.map

Yep it is just one way, but then the system administrator is on his own to follow the modifications we can push.

mkdir /etc/e-smith/templates-custom/etc/rspamd/local.d/multimap.conf
cp /etc/e-smith/templates/etc/rspamd/local.d/multimap.conf/10base /etc/e-smith/templates-custom/etc/rspamd/local.d/multimap.conf
vim /etc/e-smith/templates-custom/etc/rspamd/local.d/multimap.conf/10base

and add the map you need for example

map = [
    "${CONFDIR}/whitelist_from.map",
    "/var/lib/rspamd/manual_whitelist_from.map",
    ];

And that’s fine: not everything should be added to a package. :wink:
More code, more bugs, more things to maintain. :scream_cat:

IMO, configuration corner cases should be always demanded to custom-templates.