Skip to content

Commit

Permalink
Merge pull request #16 from behringer24/development
Browse files Browse the repository at this point in the history
Merge configuration to master
  • Loading branch information
Andreas Behringer authored Mar 29, 2020
2 parents 4766e3b + e21a28e commit d1648a6
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 20 deletions.
11 changes: 8 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ ENV POSTFIXADMIN_DB_HOST=${SQLITE_DB}
ENV POSTFIXADMIN_DB_USER=user
ENV POSTFIXADMIN_DB_PASSWORD=topsecret
ENV POSTFIXADMIN_DB_NAME=postfixadmin
ENV SSL_CERT=</etc/dovecot/private/dovecot.pem
ENV SSL_KEY=</etc/dovecot/private/dovecot.key

# Set PHP install sources
RUN apt-get update \
Expand All @@ -25,6 +23,7 @@ RUN apt-get update \

# Install packages
RUN apt-get update && apt-get install -y -q --no-install-recommends \
make \
postfix postfix-sqlite \
nginx \
supervisor \
Expand All @@ -51,6 +50,10 @@ RUN wget -q -O - "https://github.com/postfixadmin/postfixadmin/archive/postfixad
&& mkdir /var/www/html/templates_c \
&& chown -R www-data:www-data /var/www/html/templates_c

# Install envproc config file preprocessor
ADD https://raw.githubusercontent.com/behringer24/envproc/master/envproc /usr/local/bin/
RUN chmod a+x /usr/local/bin/envproc

# Install debug packages // remove in prod
RUN apt-get update && apt-get install -y -q \
procps \
Expand All @@ -60,6 +63,7 @@ RUN apt-get update && apt-get install -y -q \

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

COPY config/make/Makefile /root/
COPY config/nginx/default /etc/nginx/sites-available
COPY config/supervisor/supervisord.conf /etc/supervisord.conf
COPY config/postfixadmin/config.local.php /var/www/html/
Expand All @@ -76,4 +80,5 @@ VOLUME ["maildir:/var/vmail", "spool_mail:/var/spool/mail", "spool_postfix:/var/

EXPOSE 25 143 465 587 993 4190 11334 80

CMD ["/usr/bin/supervisord", "-n"]
CMD make -C ~ \
&& /usr/bin/supervisord -n
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@
# );

# Database driver: mysql, pgsql, sqlite
driver = sqlite
#driver = %{env:POSTFIXADMIN_DB_TYPE}
driver = ${env:POSTFIXADMIN_DB_TYPE}

# Database connection string. This is driver-specific setting.
connect = /etc/postfix/sqlite/postfixadmin.db
#connect = %{env:SQLITE_DB}
connect = ${env:SQLITE_DB}

# Default password scheme.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
# OS: Linux 4.19.76-linuxkit x86_64 Debian 10.2
# Hostname: 53941c6a59af

import_environment = $import_environment TZ POSTFIXADMIN_DB_TYPE SQLITE_DB SSL_CERT SSL_KEY POSTMASTER_ADDRESS

auth_mechanisms = plain login
log_timestamp = "%Y-%m-%d %H:%M:%S "

Expand All @@ -29,8 +27,8 @@ service auth {
}

ssl = yes
ssl_cert = </etc/dovecot/private/dovecot.pem
ssl_key = </etc/dovecot/private/dovecot.key
ssl_cert = <${env:SSL_CERT}
ssl_key = <${env:SSL_KEY}

userdb {
args = /etc/dovecot/dovecot-sql.conf
Expand All @@ -43,7 +41,7 @@ protocol pop3 {

protocol lda {
auth_socket_path = /var/run/dovecot/auth-master
postmaster_address = [email protected]
postmaster_address = ${env:POSTMASTER_ADDRESS}
}

log_path = /dev/stderr
Expand Down
17 changes: 17 additions & 0 deletions config/make/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
##
# Preprocess all makefiles with envproc to replace placeholders with
# environment variables
##

config:
envproc /etc/dovecot/dovecot.conf.tpl /etc/dovecot/dovecot.conf
envproc /etc/dovecot/dovecot-sql.conf.tpl /etc/dovecot/dovecot-sql.conf

envproc /etc/postfix/main.cf.tpl /etc/postfix/main.cf
envproc /etc/postfix/sqlite_sender_login_maps.cf.tpl /etc/postfix/sqlite_sender_login_maps.cf
envproc /etc/postfix/sqlite_virtual_alias_domain_catchall_maps.cf.tpl /etc/postfix/sqlite_virtual_alias_domain_catchall_maps.cf
envproc /etc/postfix/sqlite_virtual_alias_domain_mailbox_maps.cf.tpl /etc/postfix/sqlite_virtual_alias_domain_mailbox_maps.cf
envproc /etc/postfix/sqlite_virtual_alias_domain_maps.cf.tpl /etc/postfix/sqlite_virtual_alias_domain_maps.cf
envproc /etc/postfix/sqlite_virtual_alias_maps.cf.tpl /etc/postfix/sqlite_virtual_alias_maps.cf
envproc /etc/postfix/sqlite_virtual_domains_maps.cf.tpl /etc/postfix/sqlite_virtual_domains_maps.cf
envproc /etc/postfix/sqlite_virtual_mailbox_maps.cf.tpl /etc/postfix/sqlite_virtual_mailbox_maps.cf
16 changes: 8 additions & 8 deletions config/postfix/main.cf → config/postfix/main.cf.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ export_environment = TZ MAIL_CONFIG LANG POSTFIXADMIN_DB_TYPE SQLITE_DB SSL_CERT

disable_vrfy_command = yes

virtual_mailbox_domains = sqlite:/etc/postfix/sqlite_virtual_domains_maps.cf
virtual_alias_maps = sqlite:/etc/postfix/sqlite_virtual_alias_maps.cf, sqlite:/etc/postfix/sqlite_virtual_alias_domain_maps.cf, sqlite:/etc/postfix/sqlite_virtual_alias_domain_catchall_maps.cf
virtual_mailbox_maps = sqlite:/etc/postfix/sqlite_virtual_mailbox_maps.cf, sqlite:/etc/postfix/sqlite_virtual_alias_domain_mailbox_maps.cf
virtual_mailbox_domains = ${env:POSTFIXADMIN_DB_TYPE}:/etc/postfix/sqlite_virtual_domains_maps.cf
virtual_alias_maps = ${env:POSTFIXADMIN_DB_TYPE}:/etc/postfix/sqlite_virtual_alias_maps.cf, ${env:POSTFIXADMIN_DB_TYPE}:/etc/postfix/sqlite_virtual_alias_domain_maps.cf, ${env:POSTFIXADMIN_DB_TYPE}:/etc/postfix/sqlite_virtual_alias_domain_catchall_maps.cf
virtual_mailbox_maps = ${env:POSTFIXADMIN_DB_TYPE}:/etc/postfix/sqlite_virtual_mailbox_maps.cf, ${env:POSTFIXADMIN_DB_TYPE}:/etc/postfix/sqlite_virtual_alias_domain_mailbox_maps.cf
virtual_mailbox_base = /var/vmail/
virtual_mailbox_limit = 124000000
virtual_minimum_uid = 104
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_transport = dovecot

smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_cert_file = ${env:SSL_CERT}
smtpd_tls_key_file = ${env:SSL_KEY}
smtpd_use_tls = yes
smtpd_tls_auth_only = yes

Expand All @@ -28,11 +28,11 @@ smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = yes
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
smtpd_sender_restrictions = reject_authenticated_sender_login_mismatch, reject_unknown_sender_domain
smtpd_sender_login_maps = proxy:sqlite:/etc/postfix/sqlite_sender_login_maps.cf
smtpd_sender_login_maps = proxy:${env:POSTFIXADMIN_DB_TYPE}:/etc/postfix/sqlite_sender_login_maps.cf
broken_sasl_auth_clients = yes

myorigin = $myhostname
mydestination = $myhostname, localhost.$mydomain, localhost
myorigin = ${env:MAIL_HOST}
mydestination = ${env:MAIL_HOST}, $myhostname, localhost.$mydomain, localhost
mynetworks = 127.0.0.0/8
inet_protocols = ipv4

Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ services:
image: behringer24/mailship
environment:
POSTFIXADMIN_SETUP_PASSWORD:
SSL_CERT: /etc/dovecot/private/dovecot.pem
SSL_KEY: /etc/dovecot/private/dovecot.key
MAIL_HOST: example.com
POSTMASTER_ADDRESS: [email protected]
volumes:
- mail_dir:/var/vmail
- spool_mail:/var/spool/mail
Expand Down

0 comments on commit d1648a6

Please sign in to comment.