forked from xingjiudong/docker-smtp-relay
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d7a469f
Showing
5 changed files
with
153 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
FROM alpine:3.4 | ||
MAINTAINER Pierre GINDRAUD <pgindraud@gmail.com> | ||
|
||
ENV RELAY_POSTMASTER postmaster@domain.com | ||
ENV RELAY_MYDOMAIN domain.com | ||
ENV RELAY_MYNETWORKS 127.0.0.0/8 | ||
ENV RELAY_HOST [127.0.0.1]:25 | ||
|
||
|
||
# Install dependencies | ||
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/main/" >> /etc/apk/repositories && \ | ||
echo "http://dl-cdn.alpinelinux.org/alpine/edge/community/" >> /etc/apk/repositories && \ | ||
apk --no-cache add \ | ||
cyrus-sasl cyrus-sasl-digestmd5 cyrus-sasl-crammd5 \ | ||
postfix \ | ||
supervisor \ | ||
rsyslog && \ | ||
|
||
# Configuration of main.cf | ||
postconf -e 'notify_classes = bounce, 2bounce, data, delay, policy, protocol, resource, software' && \ | ||
postconf -e 'bounce_notice_recipient = $2bounce_notice_recipient' && \ | ||
postconf -e 'delay_notice_recipient = $2bounce_notice_recipient' && \ | ||
postconf -e 'error_notice_recipient = $2bounce_notice_recipient' && \ | ||
postconf -e 'inet_interfaces = all' && \ | ||
postconf -e 'inet_protocols = all' && \ | ||
postconf -e 'myorigin = $mydomain' && \ | ||
postconf -e 'relay_domains = $mydomain' && \ | ||
|
||
postconf -e 'smtpd_sasl_auth_enable = yes' && \ | ||
postconf -e 'smtpd_sasl_type = cyrus' && \ | ||
postconf -e 'smtpd_sasl_local_domain = $mydomain' && \ | ||
postconf -e 'smtpd_sasl_security_options = noanonymous' && \ | ||
|
||
#postconf -e smtpd_banner="\$myhostname ESMTP" && \ | ||
#postconf -e relayhost=[smtp.gmail.com]:587 && \ | ||
#postconf -e smtp_sasl_auth_enable=yes && \ | ||
#postconf -e smtp_sasl_password_maps=hash:/etc/postfix/sasl_passwd && \ | ||
#postconf -e smtp_sasl_security_options=noanonymous && \ | ||
#postconf -e smtp_tls_CAfile=/etc/postfix/cacert.pem && \ | ||
#postconf -e smtp_use_tls=yes && \ | ||
|
||
# Configuration of sasl2 | ||
echo 'pwcheck_method: auxprop' && \ | ||
echo 'auxprop_plugin: sasldb' && \ | ||
echo 'mech_list: PLAIN LOGIN CRAM-MD5 DIGEST-MD5' | ||
|
||
COPY rsyslog.conf /etc/rsyslog.conf | ||
COPY start.sh /start.sh | ||
COPY supervisord.conf /etc/supervisord.conf | ||
|
||
RUN echo '' > /etc/postfix/aliases && \ | ||
chmod +x /start.sh | ||
|
||
EXPOSE 25 | ||
|
||
CMD ["/start.sh"] |
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,30 @@ | ||
# Docker SMTP Relay | ||
|
||
Coming soon | ||
|
||
|
||
## Docker Informations | ||
|
||
| Port | Usage | | ||
| ----------------- | --------------- | | ||
| 25 | SMTP | | ||
|
||
|
||
| Volume | Usage | | ||
| ------------- | --------------- | | ||
|
||
| Environnement | Usage | | ||
| ------------- | -------------------------------------------------------- | | ||
|
||
## Installation | ||
|
||
``` | ||
git clone | ||
docker build -t docker-smtp-relay . | ||
``` | ||
|
||
## Usage | ||
|
||
``` | ||
docker run -p 25:25 docker-smtp-relay | ||
``` |
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,30 @@ | ||
# rsyslog v5: load input modules | ||
# If you do not load inputs, nothing happens! | ||
# You may need to set the module load path if modules are not found. | ||
|
||
$ModLoad immark.so # provides --MARK-- message capability | ||
$ModLoad imuxsock.so # provides support for local system logging (e.g. via logger command) | ||
|
||
# default permissions for all log files. | ||
$FileOwner root | ||
$FileGroup adm | ||
$FileCreateMode 0640 | ||
$DirCreateMode 0755 | ||
$Umask 0022 | ||
|
||
# Include configuration files from directory | ||
$IncludeConfig /etc/rsyslog.d/* | ||
|
||
# Check config syntax on startup and abort if unclean (default off) | ||
#$AbortOnUncleanConfig on | ||
|
||
# Reduce repeating messages (default off) | ||
#$RepeatedMsgReduction on | ||
|
||
# Log all kernel messages to the console. | ||
# Logging much else clutters up the screen. | ||
#kern.* /dev/console | ||
|
||
# Log anything (except mail) of level info or higher. | ||
# Don't log private authentication messages! | ||
*.info;mail.*;authpriv.none;cron.none /proc/self/fd/2 |
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,20 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
postconf -e "2bounce_notice_recipient = $RELAY_POSTMASTER" | ||
postconf -e "mydomain = $RELAY_MYDOMAIN" | ||
postconf -e "mynetworks = $RELAY_MYNETWORKS" | ||
postconf -e "relayhost = $RELAY_HOST" | ||
|
||
if [ -f /etc/postfix/sender_canonical ]; then | ||
postconf -e "sender_canonical_maps = hash:/etc/postfix/sender_canonical" | ||
postmap /etc/postfix/sender_canonical | ||
fi | ||
|
||
aliases=$(postconf alias_maps |cut -d ':' -f 2) | ||
if [ -f $aliases ]; then | ||
newaliases | ||
fi | ||
|
||
exec /usr/bin/supervisord -c /etc/supervisord.conf |
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,17 @@ | ||
[supervisord] | ||
nodaemon=true | ||
|
||
[program:postfix] | ||
directory = /etc/postfix | ||
command=/usr/sbin/postfix start | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
redirect_stderr=true | ||
startsecs = 0 | ||
autorestart = false | ||
|
||
[program:rsyslogd] | ||
command = /usr/sbin/rsyslogd -n | ||
redirect_stderr=true | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 |