spamdba - pf spamd database assistant
spamdba [-hv] (add|delete|dump|load) [-l] (-stw) [-p pattern] [-f file]
spamdba assists postmasters to routinely manipulate the spamd(8) database. This tool is a wrapper for spamdb(8), simplifying common tasks, such as:-
Adding/deleting of all, or a pattern matched subset of entries.
Dumping & loading - for OS upgrades, database format changes, sharing data between different architecture/OS machines, etc.
Show a help summary of options and exit.
Show version and exit.
Add entries via spamdb(8).
Delete entries via spamdb(8).
Dump (export) the spamdb(8) database.
Load (import) entries from a dumped spamdb(8) database.
Generate a log file.
Add or delete SPAMTRAP entries.
Add or delete TRAPPED entries.
Add or delete WHITE entries.
Pattern to match with grep(1)
A file containing a list of single IP addresses or email addresses to add or delete. Blank and comment lines beginning with #
are ignored.
/etc/mail/spamd.trap-addresses optional default trap address list
Suggestions for unprivileged, non-root usage:
add a group, such as postmasters
or mailadmins
add suitable members to that group
make /var/db/spamd writable by that group
Example commands could include:
you$ ls -l /var/db/spamd
you$ sudo cp -p /var/db/spamd /var/db/spamd~
you$ sudo groupadd postmasters
you$ sudo usermod -G postmasters you
you$ sudo chgrp postmasters /var/db/spamd
you$ sudo chmod g+w /var/db/spamd
you$ sudo chmod o-r /var/db/spamd
you$ ls -l /var/db/spamd*
-rw-rw---- 1 _spamd postmasters 212992 Mar 31 15:07 /var/db/spamd
-rw-r--r-- 1 _spamd _spamd 212992 Mar 31 15:07 /var/db/spamd~
You may also want to grant the same group write privileges to /etc/mail/spamd.trap-addresses, e.g:
-rw-rw---- 1 postmaster postmasters 16955 Mar 28 20:11 /etc/mail/spamd.trap-addresses
Delete spam trap addresses, limiting to a pattern, and with logging:
you$ spamdba delete -l -s -p '@britvault.co.uk$'
Processed: 257
Log: /tmp/spamdba_delete_SPAMTRAP.log.53YIYA6
Add spam trap addresses not already loaded, from the default file /etc/mail/spamd.trap-addresses:
you$ spamdba add -s
Processed: 257
Runs to delete all spam trap addresses, and then add in those matching a pattern:
you$ spamdba delete -s
Processed: 515
you$ spamdba add -l -s -p jun-2006
Processed: 470
Log: /tmp/spamdba_add_SPAMTRAP.log.Phpqt3Z
Delete whitelisted hosts in a net block pattern:
you$ spamdba delete -l -w -p '^157.55.'
Processed: 14
Log: /tmp/spamdba_delete_WHITE.log.Ou7QbA7
Whoops! Re-whitelist those hosts again:
you$ spamdba add -w -f /tmp/spamdba_delete_WHITE.log.Ou7QbA7
Processed: 14
Dump on one host & load on another of a different architecture:
you@primary-mx sparc64$ spamdba dump
Dump: /tmp/spamdba.dump.a26SCL9
you@mx-backup i386$ spamdba load -f ~/spamdba.dump
Processed: 515
Log: /tmp/spamdba_add_SPAMTRAP.log.JsieTX8
Processed: 1100
Log: /tmp/spamdba_add_TRAPPED.log.ej7gp1B
Processed: 241
Log: /tmp/spamdba_add_WHITE.log.Ru65NEp
spamdb(8), spamd(8)
For your convenience, the project offers:
anonymous CVS source code access
anonymous HTTP access from http://web.britvault.co.uk/products/spamdba/
a mailing list for discussion & diffs
The source code distribution README file contains specifics.
While designed specifically for OpenBSD, it might function on Unix-like pf spamd enabled OSs, such as NetBSD, FreeBSD, DragonFly BSD, etc.
This page documents spamdba version 1.0.3
spamdba has an ISC, or 'two-term BSD' styled open source copyright. Refer to the LICENCE file within the source distribution.
Craig Skinner developed spamdba, mostly in 2013-2014. He packaged it for OpenBSD in 2014. The ChangeLog file in the source distribution contains more information.