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:
25
postfix/Dockerfile
Normal file
25
postfix/Dockerfile
Normal 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
15
postfix/entrypoint.sh
Normal 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
21
postfix/main.cf.template
Normal 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
|
||||
1
postfix/sasl_passwd.template
Normal file
1
postfix/sasl_passwd.template
Normal file
@@ -0,0 +1 @@
|
||||
[${SMTP_HOST}]:${SMTP_PORT} ${SES_USER}:${SES_PASS}
|
||||
1
postfix/virtual_aliases.cf
Normal file
1
postfix/virtual_aliases.cf
Normal file
@@ -0,0 +1 @@
|
||||
community@lists.sasalliance.org james@pattinson.org, james.pattinson@sasalliance.org
|
||||
Reference in New Issue
Block a user