Custom SpamAssassin rules to mitigate spam mails and phishing mails.
Rules are maintained in the rules/ folder and automatically published as an sa-update-compatible channel via GitHub Pages.
Subscribe to the channel without GPG verification (suitable for testing):
sa-update --channel pitgrap.github.io/spamassassin-rules --no-gpgCreate a channel configuration file so sa-update picks up the channel on every run:
# /etc/spamassassin/channel.d/pitgrap.conf
channel pitgrap.github.io/spamassassin-rulesThen run sa-update as usual (e.g. from a cron job):
sa-update
service spamassassin restart # or: systemctl restart spamassassinrules/ SpamAssassin rule files (.cf)
00_custom_rules.cf Custom rules for spam and phishing detection
Every push to main that touches the rules/ folder triggers the workflow in
.github/workflows/publish.yml:
| Step | Description |
|---|---|
| Lint | spamassassin --lint -C rules/ — validates rule syntax |
| Archive | tar -czf <version>.tar.gz of all rules |
| Checksum | sha256sum of the archive saved as <version>.tar.gz.sha256 |
| VERSION | Plain-text file containing the current version integer |
| Deploy | Artifacts pushed to the gh-pages branch (GitHub Pages) |
The version number is the monotonically increasing git commit count
(git rev-list --count HEAD), which ensures sa-update always picks up
newer versions.
- Edit or create
.cffiles insiderules/. - Commit and push to
main. - The workflow lints your changes and, if lint passes, publishes the updated channel automatically.
SpamAssassin rule syntax reference: https://spamassassin.apache.org/full/3.4.x/doc/Mail_SpamAssassin_Conf.html