-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
spamassassin: - Switched from Debian to Alpine - Simplified start up and configuration
- Loading branch information
Showing
8 changed files
with
60 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,50 @@ | ||
FROM debian:jessie | ||
FROM alpine:3.6 | ||
MAINTAINER Jeffrey Boehm "[email protected]" | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
supervisor \ | ||
spamassassin \ | ||
pyzor \ | ||
razor \ | ||
spamass-milter && \ | ||
rm -rf /var/lib/apt/lists/* | ||
ENV SPAMASS_USER=spamass \ | ||
SPAMASS_GROUP=spamass \ | ||
SPAMASS_CONF=/var/lib/spamassassin \ | ||
SA_HOME=/var/lib/spamassassin/.spamassassin \ | ||
SA_PORT=1783 | ||
|
||
RUN apk --no-cache add \ | ||
libgcc \ | ||
libmilter-dev \ | ||
libstdc++ \ | ||
openssl \ | ||
perl-mail-spf \ | ||
python3 \ | ||
razor \ | ||
spamassassin \ | ||
spamassassin-client \ | ||
supervisor \ | ||
wget && \ | ||
apk --no-cache add --virtual .fetch-deps \ | ||
autoconf \ | ||
automake \ | ||
build-base && \ | ||
pip3 install \ | ||
pyzor && \ | ||
wget https://github.com/andybalholm/spamass-milter/archive/master.tar.gz && \ | ||
tar -xvf master.tar.gz && \ | ||
cd spamass-milter-master && \ | ||
./autogen.sh && \ | ||
make && \ | ||
make install && \ | ||
cd / && \ | ||
rm -rf spamass-milter-master master.tar.gz && \ | ||
apk del .fetch-deps && \ | ||
addgroup -S ${SPAMASS_GROUP} && \ | ||
adduser -D ${SPAMASS_USER} -G ${SPAMASS_GROUP} && \ | ||
chgrp ${SPAMASS_GROUP} ${SPAMASS_CONF} && \ | ||
chmod 775 ${SPAMASS_CONF} | ||
|
||
USER ${SPAMASS_USER} | ||
VOLUME ["${SPAMASS_CONF}"] | ||
|
||
COPY rootfs/ / | ||
|
||
EXPOSE 9999 | ||
|
||
VOLUME /var/lib/spamassassin | ||
|
||
HEALTHCHECK CMD spamc -K -p ${SA_PORT} || exit 1 | ||
CMD ["/usr/bin/supervisord"] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,28 +2,22 @@ | |
nodaemon=true | ||
logfile=/dev/stderr | ||
logfile_maxbytes=0 | ||
pidfile=/var/run/supervisord.pid | ||
pidfile=/tmp/supervisord.pid | ||
|
||
[program:sa-update] | ||
command=/usr/local/bin/sa-update.sh | ||
redirect_stderr=true | ||
stdout_logfile=/dev/stderr | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
|
||
[program:spamd] | ||
command=/usr/local/bin/spamd.sh | ||
redirect_stderr=true | ||
stdout_logfile=/dev/stderr | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
|
||
[program:spamass-milter] | ||
command=spamass-milter -p inet:[email protected] -u spamass-milter | ||
command=spamass-milter -p inet:[email protected] -- -p %(ENV_SA_PORT)s | ||
redirect_stderr=true | ||
stdout_logfile=/dev/stderr | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
|
||
echo asd > /tmp/spam | ||
spamassassin -t -D < /tmp/spam | ||
rm /tmp/spam |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,12 @@ | ||
#!/bin/sh | ||
SA_HOME="/var/lib/spamassassin/.spamassassin" | ||
PYZOR_HOME="/var/lib/spamassassin/.pyzor" | ||
RAZOR_HOME="/var/lib/spamassassin/.razor" | ||
echo "Starting spamassassin.." | ||
|
||
create_homedir() { | ||
if ! [ -d ${SA_HOME} ] | ||
then | ||
mkdir ${SA_HOME} | ||
chown debian-spamd ${SA_HOME} | ||
fi | ||
} | ||
|
||
pyzor_discover() { | ||
start-stop-daemon \ | ||
--chuid debian-spamd:debian-spamd --start \ | ||
--exec /usr/bin/pyzor -- \ | ||
--homedir ${PYZOR_HOME} discover | ||
} | ||
|
||
razor_setup() { | ||
if [ -d ${RAZOR_HOME} ] | ||
then | ||
return 0 | ||
fi | ||
|
||
mkdir ${RAZOR_HOME} | ||
|
||
razor-admin -home=${RAZOR_HOME} -register | ||
razor-admin -home=${RAZOR_HOME} -create | ||
razor-admin -home=${RAZOR_HOME} -discover | ||
} | ||
|
||
create_homedir | ||
pyzor_discover | ||
razor_setup | ||
|
||
/usr/local/bin/sa-update.sh --startup | ||
|
||
spamd \ | ||
--username=debian-spamd \ | ||
/usr/sbin/spamd \ | ||
--syslog stderr \ | ||
--pidfile=/run/spamd.pid \ | ||
--pidfile=${SA_HOME}/spamd.pid \ | ||
--max-children 5 \ | ||
--helper-home-dir \ | ||
--nouser-config | ||
--helper-home-dir=${SA_HOME} \ | ||
--nouser-config \ | ||
--listen 127.0.0.1:${SA_PORT} |