Skip to content

Instantly share code, notes, and snippets.

@noudAndi
Last active December 19, 2021 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noudAndi/0a76e8aaac33e2abbcd74d100b768504 to your computer and use it in GitHub Desktop.
Save noudAndi/0a76e8aaac33e2abbcd74d100b768504 to your computer and use it in GitHub Desktop.
This a a quick help, if you want to have additional spamassasin rules updated automatically.

Intro

This is the way, I implemented automatic updates of spamassasin rules for MailPlus Server on my Synology DS920+, running on DSM 7.0.

MY Finding: DSM 7.0 is using rspamd instead of spamassasin, this means, some older scripts, created for DSM 6 or earlier might not work anymore.

Disclaimer!

This script and description come with no warranty, I cannot held responsible, if something breaks on you machine!

Step-by-step

  1. Create a file with the code snippet below on you machine (refenced as )
  2. Go to "Task Scheduler" and create a new task Run command: "bash " Run script as user "root" Run script every 2 hrs Optional: "Send run details per email"
  3. Let the task run manually and check the result
  4. Test the new rules, by sending a mail in from an external account with a trigger word from the new ruleset.

the script

#!/bin/bash

SA_UPDATE="/var/packages/MailPlus-Server/target/bin/sa-update"
sa_files_folder="/var/spool/@MailPlus-Server/rspamd/sa_rules/update_db"


# Download via Spamassasin update tool
su MailPlus-Server -s /bin/sh -c "$SA_UPDATE --nogpg --channel spamassassin.heinlein-support.de -D -v --updatedir $sa_files_folder"
su MailPlus-Server -s /bin/sh -c "$SA_UPDATE --nogpg --channel sa.schaal-it.net                 -D -v --updatedir $sa_files_folder"

# Reload
/volume1/@appstore/MailPlus-Server/scripts/SpamRuleUpdate.sh local
/volume1/@appstore/MailPlus-Server/scripts/SpamRuleUpdate.sh all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment