Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
4f9a333219 |
13
Dockerfile
13
Dockerfile
@ -1,20 +1,18 @@
|
|||||||
FROM alpine:3.21.0
|
FROM alpine:3.21.3
|
||||||
|
|
||||||
LABEL Maintainer="Wolfgang Hottgenroth <woho@hottis.de>"
|
LABEL Maintainer="Wolfgang Hottgenroth <woho@hottis.de>"
|
||||||
LABEL ImageName="quay.io/wollud1969/exim-docker"
|
LABEL ImageName=""
|
||||||
|
|
||||||
# domain to be used in sender address of sent mails
|
# domain to be used in sender address of sent mails
|
||||||
ENV LOCALMAILNAME=""
|
ENV LOCALMAILNAME=""
|
||||||
# smarthost to send mail to
|
# smarthost to send mail to
|
||||||
ENV SMARTHOST=""
|
ENV SMARTHOST=""
|
||||||
ENV SMARTHOST_USER=""
|
|
||||||
ENV SMARTHOST_PASS=""
|
|
||||||
# ip addresses or networks to allow for relaying, separate multiple ones by semicolon
|
# ip addresses or networks to allow for relaying, separate multiple ones by semicolon
|
||||||
ENV RELAYNETS="127.0.0.1/32"
|
ENV RELAYNETS=""
|
||||||
|
|
||||||
RUN apk add --no-cache exim m4
|
RUN apk add --no-cache exim bash
|
||||||
|
|
||||||
COPY exim.conf.m4 /etc/exim
|
COPY exim.conf.tmpl /etc/exim
|
||||||
COPY start.sh /etc/exim
|
COPY start.sh /etc/exim
|
||||||
|
|
||||||
WORKDIR /etc/exim
|
WORKDIR /etc/exim
|
||||||
@ -22,7 +20,6 @@ WORKDIR /etc/exim
|
|||||||
EXPOSE 25
|
EXPOSE 25
|
||||||
|
|
||||||
CMD [ "./start.sh" ]
|
CMD [ "./start.sh" ]
|
||||||
#CMD [ "/usr/bin/m4 exim.conf.m4 > exim.conf && /usr/sbin/exim -bd -q15m -v" ]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
9
ENV
9
ENV
@ -1,9 +0,0 @@
|
|||||||
export HOSTNAME=`hostname`
|
|
||||||
export LOCALMAILNAME="hottis.de"
|
|
||||||
#export LOCALMAILNAME=""
|
|
||||||
export SMARTHOST=smtprelaypool.ispgateway.de
|
|
||||||
#export SMARTHOST=""
|
|
||||||
export SMARTHOST_USER=pseudosmarthostuser@hottis.de
|
|
||||||
#export SMARTHOST_USER="_"
|
|
||||||
export SMARTHOST_PASS="Chaediek3Chaer7u"
|
|
||||||
export RELAYNETS="0.0.0.0/0"
|
|
@ -18,6 +18,7 @@ docker run \
|
|||||||
-e SMARTHOST=smarthost.example.com \
|
-e SMARTHOST=smarthost.example.com \
|
||||||
-e LOCALMAILNAME=example.com \
|
-e LOCALMAILNAME=example.com \
|
||||||
-e RELAYNETS=$RELAYNETS \
|
-e RELAYNETS=$RELAYNETS \
|
||||||
|
-e ROOT=root@example.com \
|
||||||
--network $MAILER_NETWORK \
|
--network $MAILER_NETWORK \
|
||||||
--name mailer \
|
--name mailer \
|
||||||
--restart always \
|
--restart always \
|
||||||
|
64
exim.conf.m4
64
exim.conf.m4
@ -1,64 +0,0 @@
|
|||||||
dnl values
|
|
||||||
define(`HOSTNAME', esyscmd(`echo -n $HOSTNAME'))dnl
|
|
||||||
define(`LOCALMAILNAME', esyscmd(`echo -n $LOCALMAILNAME'))dnl
|
|
||||||
define(`SMARTHOST', esyscmd(`echo -n $SMARTHOST'))dnl
|
|
||||||
define(`SMARTHOST_USER', esyscmd(`echo -n $SMARTHOST_USER'))dnl
|
|
||||||
define(`SMARTHOST_PASS', esyscmd(`echo -n $SMARTHOST_PASS'))dnl
|
|
||||||
define(`RELAYNETS', esyscmd(`echo -n $RELAYNETS'))dnl
|
|
||||||
|
|
||||||
ifelse(SMARTHOST, `', `
|
|
||||||
errprint(`Error: SMARTHOST not set')
|
|
||||||
m4exit(1)
|
|
||||||
')
|
|
||||||
|
|
||||||
ifelse(HOSTNAME, `', `
|
|
||||||
errprint(`Error: HOSTNAME not set')
|
|
||||||
m4exit(1)
|
|
||||||
')
|
|
||||||
|
|
||||||
dnl template for exim.conf
|
|
||||||
|
|
||||||
primary_hostname = HOSTNAME
|
|
||||||
|
|
||||||
acl_smtp_rcpt = acl_check_rcpt
|
|
||||||
|
|
||||||
begin routers
|
|
||||||
smarthost_route:
|
|
||||||
driver = manualroute
|
|
||||||
domains = *
|
|
||||||
transport = smarthost_smtp
|
|
||||||
route_list = * SMARTHOST
|
|
||||||
|
|
||||||
begin transports
|
|
||||||
smarthost_smtp:
|
|
||||||
driver = smtp
|
|
||||||
port = 25
|
|
||||||
multi_domain
|
|
||||||
ifelse(SMARTHOST_USER, `', `', `dnl
|
|
||||||
hosts_require_auth = *
|
|
||||||
')
|
|
||||||
|
|
||||||
ifelse(SMARTHOST_USER, `', `', `
|
|
||||||
begin authenticators
|
|
||||||
plain:
|
|
||||||
driver = plaintext
|
|
||||||
public_name = PLAIN
|
|
||||||
client_send = ^SMARTHOST_USER^SMARTHOST_PASS
|
|
||||||
|
|
||||||
login:
|
|
||||||
driver = plaintext
|
|
||||||
public_name = LOGIN
|
|
||||||
client_send = : SMARTHOST_USER : SMARTHOST_PASS
|
|
||||||
')
|
|
||||||
|
|
||||||
begin acl
|
|
||||||
acl_check_rcpt:
|
|
||||||
accept
|
|
||||||
hosts = RELAYNETS
|
|
||||||
deny
|
|
||||||
message = "Relaying denied"
|
|
||||||
|
|
||||||
ifelse(LOCALMAILNAME, `', `', `
|
|
||||||
begin rewrite
|
|
||||||
*@* ${1}@LOCALMAILNAME Ffrs
|
|
||||||
')
|
|
28
exim.conf.tmpl
Normal file
28
exim.conf.tmpl
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
primary_hostname = %HOSTNAME%
|
||||||
|
qualify_domain = %LOCALMAILNAME%
|
||||||
|
|
||||||
|
acl_smtp_rcpt = acl_check_rcpt
|
||||||
|
|
||||||
|
begin routers
|
||||||
|
smarthost_route:
|
||||||
|
driver = manualroute
|
||||||
|
domains = *
|
||||||
|
transport = smarthost_smtp
|
||||||
|
route_list = * %SMARTHOST%
|
||||||
|
|
||||||
|
begin transports
|
||||||
|
smarthost_smtp:
|
||||||
|
driver = smtp
|
||||||
|
port = 25
|
||||||
|
multi_domain
|
||||||
|
|
||||||
|
begin acl
|
||||||
|
acl_check_rcpt:
|
||||||
|
accept
|
||||||
|
hosts = %RELAYNETS%
|
||||||
|
deny
|
||||||
|
message = "Relaying denied"
|
||||||
|
|
||||||
|
begin rewrite
|
||||||
|
*@* ${1}@${qualify_domain} Ffrs
|
||||||
|
|
13
start.sh
13
start.sh
@ -1,4 +1,13 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
m4 exim.conf.m4 > exim.conf && exim -bd -q15m -v
|
rm exim.conf
|
||||||
|
|
||||||
|
cat exim.conf.tmpl \
|
||||||
|
| sed -e 's/%HOSTNAME%/'$HOSTNAME'/' \
|
||||||
|
-e 's#%RELAYNETS%#'$RELAYNETS'#' \
|
||||||
|
-e 's/%LOCALMAILNAME%/'$LOCALMAILNAME'/' \
|
||||||
|
-e 's/%SMARTHOST%/'$SMARTHOST'/' \
|
||||||
|
> exim.conf
|
||||||
|
|
||||||
|
exim -bd -q15m -v
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user