-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Optimization in Docker Image Size - Configuration by ENV-variables - SMTP Fallback for incompatible E-Mails - Cleaned Container Log - Bug Fixes
- Loading branch information
Showing
13 changed files
with
242 additions
and
121 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 |
---|---|---|
|
@@ -356,3 +356,4 @@ MigrationBackup/ | |
mount | ||
.devcontainer | ||
env | ||
/docker-testing |
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,70 +1,51 @@ | ||
FROM alpine:latest | ||
|
||
# Install dependencies | ||
#RUN apk add --no-cache --update postfix ca-certificates socat acme.sh bash && \ | ||
RUN apk add --no-cache --update postfix dovecot ca-certificates git gcc musl-dev linux-headers libmilter-dev | ||
|
||
#install python | ||
RUN apk add --update --no-cache python3 python3-dev && ln -sf python3 /usr/bin/python | ||
RUN python3 -m ensurepip | ||
RUN pip3 install --no-cache --upgrade pip setuptools | ||
RUN python3 -m ensurepip; pip3 install --no-cache --upgrade pip setuptools | ||
|
||
RUN pip3 install zimbraweb git+https://github.com/sdgathman/pymilter | ||
|
||
RUN pip3 install zimbraweb | ||
#postfix basic config | ||
RUN postconf -e "mynetworks=0.0.0.0/0" "maillog_file=/var/log/log" "smtpd_sasl_path=private/auth" "smtpd_sasl_type=dovecot" "smtpd_sasl_auth_enable=yes" "smtpd_delay_reject=yes" "smtpd_client_restrictions=permit_sasl_authenticated,reject" "smtpd_milters=unix:/milter.sock" | ||
|
||
RUN pip3 install git+https://github.com/sdgathman/pymilter | ||
|
||
#postfix config | ||
RUN postconf -e mynetworks=0.0.0.0/0 | ||
RUN postconf -e "maillog_file=/dev/stdout" | ||
RUN postconf -e smtpd_sasl_path=private/auth | ||
RUN postconf -e smtpd_sasl_type=dovecot | ||
RUN postconf -e smtpd_sasl_auth_enable=yes | ||
RUN postconf -e smtpd_delay_reject=yes | ||
RUN postconf -e smtpd_client_restrictions=permit_sasl_authenticated,reject | ||
RUN postconf -e smtpd_milters=unix:/milter.sock | ||
|
||
#add script execution | ||
#https://contrid.net/server/mail-servers/postfix-catch-all-pipe-to-script | ||
RUN touch /etc/postfix/virtual_aliases | ||
#postfix transport script execution | ||
RUN adduser --disabled-password posttransport | ||
RUN touch /var/log/log | ||
RUN chmod -R 777 /var/log/log | ||
RUN echo "* zimbrawebtransport:" > /etc/postfix/transport | ||
#not needed when texthash RUN postmap /etc/postfix/virtual_aliases | ||
#not needed when texthash RUN postmap /etc/postfix/transport | ||
#zusammen mit -e muss bei echo $ escaped werden | ||
RUN echo -e "zimbrawebtransport unix - n n - - pipe\n flags=FR user=nobody argv=/srv/zimbraweb/send_mail.py\n \${nexthop} \${user} \${sasl_username}" >> /etc/postfix/master.cf | ||
RUN echo -e "transport_maps = texthash:/etc/postfix/transport\nvirtual_alias_maps = texthash:/etc/postfix/virtual_aliases" >> /etc/postfix/main.cf | ||
RUN echo -e "zimbrawebtransport unix - n n - - pipe\n flags=FR user=posttransport argv=/srv/zimbraweb/send_mail.py\n \${nexthop} \${user} \${sasl_username}" >> /etc/postfix/master.cf | ||
RUN postconf -e "transport_maps=texthash:/etc/postfix/transport" | ||
|
||
RUN echo -e "submission inet n - y - - smtpd" >> /etc/postfix/master.cf | ||
RUN echo -e " -o syslog_name=postfix/submission" >> /etc/postfix/master.cf | ||
RUN echo -e " -o smtpd_sasl_auth_enable=yes" >> /etc/postfix/master.cf | ||
RUN echo -e " -o smtpd_sasl_path=private/auth" >> /etc/postfix/master.cf | ||
RUN echo -e " -o smtpd_client_restrictions=permit_sasl_authenticated,reject" >> /etc/postfix/master.cf | ||
RUN echo -e "submission inet n - y - - smtpd\n -o syslog_name=postfix/submission\n -o smtpd_sasl_auth_enable=yes\n -o smtpd_sasl_path=private/auth\n -o smtpd_client_restrictions=permit_sasl_authenticated,reject" >> /etc/postfix/master.cf | ||
|
||
#dovecot config | ||
ADD ./files/dovecot/conf.d/10-auth.conf /etc/dovecot/conf.d/10-auth.conf | ||
ADD ./files/dovecot/conf.d/10-master.conf /etc/dovecot/conf.d/10-master.conf | ||
ADD ./files/dovecot/conf.d/auth-checkpassword.conf.ext /etc/dovecot/conf.d/auth-checkpassword.conf.ext | ||
ADD ./files/dovecot/conf.d/ /etc/dovecot/conf.d/ | ||
|
||
#copy python scripts | ||
ADD ./files/*.py /srv/zimbraweb/ | ||
RUN chmod 777 /srv/zimbraweb/*.py | ||
|
||
RUN mkdir /srv/zimbraweb/mnt/ | ||
RUN chmod -R 777 /srv/zimbraweb/mnt/ | ||
|
||
RUN mkdir /srv/zimbraweb/logs/ | ||
RUN chmod -R 777 /srv/zimbraweb/logs/ | ||
|
||
#config mount | ||
RUN mkdir /srv/zimbraweb/mnt/; chmod -R 777 /srv/zimbraweb/mnt/ | ||
VOLUME /srv/zimbraweb/mnt/ | ||
|
||
# Add crontab to delete expired auth tokens | ||
RUN crontab -l /cron | ||
RUN echo "* * * * * find /dev/shm/ -name auth_* -type f -perm 444 -mmin +3 -delete" >> /cron | ||
RUN crontab /cron | ||
RUN rm /cron | ||
|
||
# Expose smtp submission port | ||
EXPOSE 587 | ||
|
||
ADD ./files/start.sh / | ||
RUN chmod +x /start.sh | ||
|
||
ADD ./files/tls.sh / | ||
RUN chmod +x /tls.sh | ||
RUN mkdir /tls/ | ||
RUN chmod +x /tls.sh; mkdir /tls/ | ||
|
||
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
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,19 @@ | ||
# This Docker compose is configured with SMTP-Relay. Please consult the Readme if you want this option. Otherwise plase use the plain container and not this compose file. | ||
|
||
version: '3' | ||
services: | ||
zimbraweb: | ||
image: 'ghcr.io/cirosec-studis/zimbraweb-smtp-bridge:latest' | ||
restart: unless-stopped | ||
ports: | ||
- '587:587' | ||
environment: | ||
- ENVCONFIG=true | ||
- smtp_fallback=enabled | ||
- smtp_fallback_relay_host=relayhost | ||
|
||
relayhost: | ||
image: boky/postfix | ||
restart: unless-stopped | ||
environment: | ||
- ALLOWED_SENDER_DOMAINS=student.dhbw-mannheim.de |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import logging, platform | ||
|
||
class HostnameFilter(logging.Filter): | ||
hostname = platform.node() | ||
def filter(self, record): | ||
record.hostname = HostnameFilter.hostname | ||
return True |
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
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
Oops, something went wrong.