Commit 139e87be authored by nimrod's avatar nimrod
Browse files

SpamAssassin daemon image.

parent 754b3cea
Loading
Loading
Loading
Loading

spamd/.dockerignore

0 → 100644
+4 −0
Original line number Diff line number Diff line
*
!entrypoint
!spamd-ping
!spamd-learn

spamd/Dockerfile

0 → 100644
+18 −0
Original line number Diff line number Diff line
FROM debian:stretch-slim
RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
        gnupg \
        libmail-spf-perl \
        spamassassin \
        spamc \
    && \
    sa-update && \
    rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/* /var/cache/apt/archives/*
COPY --chown=root:root spamd-ping spamd-learn /usr/local/bin/
COPY --chown=root:root entrypoint /entrypoint
EXPOSE 783
VOLUME /run/spamd
VOLUME /var/backups/sa-learn
ENTRYPOINT [ "/entrypoint" ]
CMD [ "spamd", "--create-prefs", "--max-children=5", "--helper-home-dir", "--listen=0.0.0.0:783", "--socketpath=/var/run/spamd/spamd.sock", "--syslog=stderr" ]
HEALTHCHECK CMD spamd-ping

spamd/README.md

0 → 100644
+28 −0
Original line number Diff line number Diff line
# spamd

> SpamAssassin container image.

## Exposed interfaces

The daemon is accessible over TCP at port 783 and over the `spamd.sock` Unix
socket in the `/run/spamd` volume.

## Training the Bayesian classifier

The image comes with the script `spamd-learn` which goes over the mobx files in
`/var/mail`, uses them for training the classifier and them saves the database
in the `/var/backups/sa-learn` volume. On statup, the container restores the
database from that volume. To update the database run `spamd-learn` from inside
the container with `docker exec` (there's no need to restart the container
afterwards). For an example see the [Cron image](../crond) inside this project.

## License

This software is licensed under the MIT license (see `LICENSE.txt`).

## Author Information

Nimrod Adar, [contact me](mailto:nimrod@shore.co.il) or visit my [website](
https://www.shore.co.il/). Patches are welcome via [`git send-email`](
http://git-scm.com/book/en/v2/Git-Commands-Email). The repository is located
at: <https://www.shore.co.il/git/>.

spamd/entrypoint

0 → 100755
+9 −0
Original line number Diff line number Diff line
#!/bin/sh
set -eux

install -d -m 750 -o debian-spamd -g debian-spamd /run/spamd
install -d -m 750 -o debian-spamd -g debian-spamd /var/backups/sa-learn

sh -c 'sleep 60; sa-learn --restore /var/backups/sa-learn/backup.txt' &

eval exec "$@"

spamd/gtube.txt

0 → 100644
+26 −0
Original line number Diff line number Diff line
Subject: Test spam mail (GTUBE)
Message-ID: <GTUBE1.1010101@example.net>
Date: Wed, 23 Jul 2003 23:30:00 +0200
From: Sender <sender@example.net>
To: Recipient <recipient@example.net>
Precedence: junk
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

This is the GTUBE, the
	Generic
	Test for
	Unsolicited
	Bulk
	Email

If your spam filter supports it, the GTUBE provides a test by which you
can verify that the filter is installed correctly and is detecting incoming
spam. You can send yourself a test mail containing the following string of
characters (in upper case and with no white spaces and line breaks):

XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X

You should send this test mail from an account outside of your network.
Loading