first commit

This commit is contained in:
Andy 2020-02-05 23:11:51 +00:00
commit 32df68205f
6 changed files with 60 additions and 0 deletions

14
Dockerfile Normal file
View File

@ -0,0 +1,14 @@
FROM alpine:3.11
MAINTAINER Andrey Arapov <andrey.arapov@nixaid.com>
RUN apk update && \
apk upgrade && \
apk add spamassassin runit socklog && \
rm -rf /etc/service
RUN addgroup -S spamd && \
adduser -h /var/lib/spamassassin -s /sbin/nologin -S -G spamd spamd
COPY service /etc/service/
# RUN find /etc/service -xdev -type f -name "run" -exec chmod +x '{}' \;
ENTRYPOINT runsvdir -P /etc/service

13
LICENSE Normal file
View File

@ -0,0 +1,13 @@
Copyright (c) 2020, Andrey Arapov
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

4
service/logger/finish Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
echo "${PWD##*/}: Exitted with $1 (signal: $2)"
[ $1 -ne 0 ] && ( echo "${PWD##*/}: rc != 0, sleeping for 5 seconds ..."; sleep 5 )

10
service/logger/run Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
# Collect all logs which come to /dev/log
exec 2>&1
echo "${PWD##*/}: started."
set -x
exec chpst -Unobody socklog unix /dev/log
# exec socklog unix /dev/log
# exec socat UNIX-LISTEN:/dev/log,reuseaddr,fork -

4
service/spamassassin/finish Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
echo "${PWD##*/}: Exitted with $1 (signal: $2)"
[ $1 -ne 0 ] && ( echo "${PWD##*/}: rc != 0, sleeping for 5 seconds ..."; sleep 5 )

15
service/spamassassin/run Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
echo "${PWD##*/}: started."
set -x
# first run init
if [ ! -d "/var/lib/spamassassin/3.004001" ]; then
/usr/bin/sa-update
fi
# Docker bridge CIDR range:
# seq 17 31 | xargs -I@ echo 172.@.0.0/16 | xargs | tr ' ' ','
chown -Rh spamd:spamd -- /var/lib/spamassassin
exec /usr/sbin/spamd -r /run/spamd.pid -m 5 -c -i 0.0.0.0:783 -u spamd -H /var/lib/spamassassin -x -A 172.17.0.0/16,172.18.0.0/16,172.19.0.0/16,172.20.0.0/16,172.21.0.0/16,172.22.0.0/16,172.23.0.0/16,172.24.0.0/16,172.25.0.0/16,172.26.0.0/16,172.27.0.0/16,172.28.0.0/16,172.29.0.0/16,172.30.0.0/16,172.31.0.0/16 2>&1