Initial commit: Postfix mail server with SES relay

- Containerized Postfix configuration for mailing list management
- Environment-based configuration for SES credentials
- Template-based config generation for flexibility
- Static virtual aliases (Phase 1)
- Prepared for future web interface and SQL backend (Phase 2+)

Features:
- Docker Compose orchestration
- Secure credential management via .env
- Configurable SMTP host/port
- Git-ignored sensitive files
- Comprehensive documentation
This commit is contained in:
James Pattinson
2025-10-12 18:07:21 +00:00
commit 55d9da3fb5
11 changed files with 339 additions and 0 deletions

25
postfix/Dockerfile Normal file
View File

@@ -0,0 +1,25 @@
FROM debian:stable-slim
# Install Postfix and tools
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
postfix \
libsasl2-modules \
mailutils \
gettext-base \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Copy configs
COPY main.cf.template /etc/postfix/main.cf.template
COPY sasl_passwd.template /etc/postfix/sasl_passwd.template
COPY virtual_aliases.cf /etc/postfix/virtual_aliases.cf
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# Generate Postfix maps for virtual aliases
RUN postmap /etc/postfix/virtual_aliases.cf
# Expose SMTP
EXPOSE 25
ENTRYPOINT ["/entrypoint.sh"]

15
postfix/entrypoint.sh Normal file
View File

@@ -0,0 +1,15 @@
#!/bin/sh
set -e
# Generate main.cf from template with environment variables
envsubst < /etc/postfix/main.cf.template > /etc/postfix/main.cf
# Generate SASL password file from environment variables
envsubst < /etc/postfix/sasl_passwd.template > /etc/postfix/sasl_passwd
# Generate Postfix hash
postmap /etc/postfix/sasl_passwd
chmod 600 /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
# Start Postfix in foreground
exec postfix start-fg

21
postfix/main.cf.template Normal file
View File

@@ -0,0 +1,21 @@
# Basic
myhostname = lists.sasalliance.org
myorigin = sasalliance.org
mydestination = $myhostname, localhost.$mydomain, localhost
# Relay through SES
relayhost = [${SMTP_HOST}]:${SMTP_PORT}
smtp_tls_security_level = encrypt
smtp_tls_note_starttls_offer = yes
# SASL auth for SES
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
# Virtual aliases (static for now)
virtual_alias_maps = hash:/etc/postfix/virtual_aliases.cf
# Other recommended settings
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases

View File

@@ -0,0 +1 @@
[${SMTP_HOST}]:${SMTP_PORT} ${SES_USER}:${SES_PASS}

View File

@@ -0,0 +1 @@
community@lists.sasalliance.org james@pattinson.org, james.pattinson@sasalliance.org