docker: Use spamass-milter
This commit is contained in:
parent
0581e0cf6b
commit
eadc7ff8ca
5 changed files with 31 additions and 9 deletions
13
Dockerfile
13
Dockerfile
|
|
@ -31,12 +31,13 @@ COPY --from=nodebuild /build/web/build/ ./web/build/
|
|||
RUN go generate ./... && \
|
||||
CGO_ENABLED=1 GOOS=linux go build -a -installsuffix cgo -ldflags="-w -s" -o happyDeliver ./cmd/happyDeliver
|
||||
|
||||
# Stage 3: Prepare perl
|
||||
# Stage 3: Prepare perl and spamass-milt
|
||||
FROM alpine:3 AS pl
|
||||
|
||||
RUN echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
|
||||
apk add --no-cache \
|
||||
build-base \
|
||||
libmilter-dev \
|
||||
musl-obstack-dev \
|
||||
openssl \
|
||||
openssl-dev \
|
||||
|
|
@ -68,6 +69,7 @@ RUN echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/a
|
|||
perl-variable-magic \
|
||||
perl-xml-libxml \
|
||||
perl-dev \
|
||||
spamassassin-client \
|
||||
zlib-dev \
|
||||
&& \
|
||||
ln -s /usr/bin/ld /bin/ld
|
||||
|
|
@ -75,6 +77,11 @@ RUN echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/a
|
|||
RUN cpanm --notest Mail::SPF && \
|
||||
cpanm --notest Mail::Milter::Authentication
|
||||
|
||||
RUN wget https://download.savannah.nongnu.org/releases/spamass-milt/spamass-milter-0.4.0.tar.gz && \
|
||||
tar xzf spamass-milter-0.4.0.tar.gz && \
|
||||
cd spamass-milter-0.4.0 && \
|
||||
./configure && make install
|
||||
|
||||
# Stage 4: Runtime image with Postfix and all filters
|
||||
FROM alpine:3
|
||||
|
||||
|
|
@ -83,6 +90,7 @@ RUN echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/a
|
|||
apk add --no-cache \
|
||||
bash \
|
||||
ca-certificates \
|
||||
libmilter \
|
||||
openssl \
|
||||
perl \
|
||||
perl-alien-libxml2 \
|
||||
|
|
@ -134,8 +142,9 @@ RUN mkdir -p /etc/happydeliver \
|
|||
/var/cache/authentication_milter \
|
||||
/var/lib/authentication_milter \
|
||||
/var/spool/postfix/authentication_milter \
|
||||
/var/spool/postfix/spamassassin \
|
||||
&& chown -R happydeliver:happydeliver /var/lib/happydeliver /var/log/happydeliver \
|
||||
&& chown -R mail:mail /var/spool/postfix/authentication_milter
|
||||
&& chown -R mail:mail /var/spool/postfix/authentication_milter /var/spool/postfix/spamassassin
|
||||
|
||||
# Copy the built application
|
||||
COPY --from=builder /build/happyDeliver /usr/local/bin/happyDeliver
|
||||
|
|
|
|||
|
|
@ -18,6 +18,12 @@
|
|||
"Sanitize" : {
|
||||
"hosts_to_remove" : [
|
||||
"__HOSTNAME__"
|
||||
],
|
||||
"extra_auth_results_types" : [
|
||||
"X-Spam-Status",
|
||||
"X-Spam-Report",
|
||||
"X-Spam-Level",
|
||||
"X-Spam-Checker-Version"
|
||||
]
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ inet_interfaces = all
|
|||
inet_protocols = ipv4
|
||||
|
||||
# Recipient settings
|
||||
mydestination = $myhostname, localhost.$mydomain, localhost
|
||||
mydestination = localhost.$mydomain, localhost
|
||||
mynetworks = 127.0.0.0/8 [::1]/128
|
||||
|
||||
# Relay settings - accept mail for our test domain
|
||||
|
|
@ -28,7 +28,7 @@ transport_maps = pcre:/etc/postfix/transport_maps
|
|||
# OpenDKIM for DKIM verification
|
||||
milter_default_action = accept
|
||||
milter_protocol = 6
|
||||
smtpd_milters = unix:/var/spool/postfix/authentication_milter/authentication_milter.sock
|
||||
smtpd_milters = unix:/var/spool/postfix/authentication_milter/authentication_milter.sock unix:/var/spool/postfix/spamassassin/spamass-milter.sock
|
||||
non_smtpd_milters = $smtpd_milters
|
||||
|
||||
# SPF policy checking
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
# SMTP service
|
||||
smtp inet n - n - - smtpd
|
||||
-o content_filter=spamassassin
|
||||
|
||||
# Pickup service
|
||||
pickup unix n - n 60 1 pickup
|
||||
|
|
@ -74,10 +73,6 @@ scache unix - - n - 1 scache
|
|||
maildrop unix - n n - - pipe
|
||||
flags=DRXhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
|
||||
|
||||
# SPF policy service
|
||||
policy-spf unix - n n - 0 spawn
|
||||
user=nobody argv=/usr/bin/postfix-policyd-spf-perl
|
||||
|
||||
# SpamAssassin content filter
|
||||
spamassassin unix - n n - - pipe
|
||||
user=mail argv=/usr/bin/spamc -f -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,18 @@ stdout_logfile=/var/log/happydeliver/spamd.log
|
|||
stderr_logfile=/var/log/happydeliver/spamd_error.log
|
||||
user=root
|
||||
|
||||
# SpamAssassin milter
|
||||
[program:spamass_milter]
|
||||
command=/usr/local/sbin/spamass-milter -p /var/spool/postfix/spamassassin/spamass-milter.sock -m
|
||||
autostart=true
|
||||
autorestart=true
|
||||
priority=7
|
||||
stdout_logfile=/var/log/happydeliver/spamass-milter.log
|
||||
stderr_logfile=/var/log/happydeliver/spamass-milter_error.log
|
||||
user=mail
|
||||
group=mail
|
||||
umask=007
|
||||
|
||||
# Postfix service
|
||||
[program:postfix]
|
||||
command=/usr/sbin/postfix start-fg
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue