NAME

spamdba - pf spamd database assistant

SYNOPSIS

spamdba [-hv] (add|delete|dump|load) [-l] (-stw) [-p pattern] [-f file]

DESCRIPTION

spamdba assists postmasters to routinely manipulate the spamd(8) database. This tool is a wrapper for spamdb(8), simplifying common tasks, such as:-

OPTIONS

-h, -?

Show a help summary of options and exit.

-v

Show version and exit.

add

Add entries via spamdb(8).

delete

Delete entries via spamdb(8).

dump

Dump (export) the spamdb(8) database.

load

Load (import) entries from a dumped spamdb(8) database.

-l

Generate a log file.

-s

Add or delete SPAMTRAP entries.

-t

Add or delete TRAPPED entries.

-w

Add or delete WHITE entries.

-p

Pattern to match with grep(1)

-f file

A file containing a list of single IP addresses or email addresses to add or delete. Blank and comment lines beginning with # are ignored.

FILES

/etc/mail/spamd.trap-addresses optional default trap address list

SECURITY

Suggestions for unprivileged, non-root usage:

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

EXAMPLES

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

SEE ALSO

spamdb(8), spamd(8)

AVAILABILITY

For your convenience, the project offers:

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.

VERSION

This page documents spamdba version 1.0.3

LICENCE

spamdba has an ISC, or 'two-term BSD' styled open source copyright. Refer to the LICENCE file within the source distribution.

HISTORY

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.