Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow enabling ports 465 and 587 #34

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ services:
POSTFIX_RELAYHOST: "exchange.server.IP.addr"
POSTFIX_RELAY_DOMAINS: "yourdomain.tld,someotherdomain.tld"
POSTFIX_DNSBL_SITES: "hostkarma.junkemailfilter.com=127.0.0.2, bl.spamcop.net, cbl.abuseat.org=127.0.0.2, zen.spamhaus.org"
ENABLE_SUBMISSION_PORT: "true"
ENABLE_OPENDKIM: "true"
OPENDKIM_MODE: "v"
OPENDKIM_LOGRESULTS: "true"
Expand Down Expand Up @@ -273,6 +274,8 @@ volumes:
| `POSTFIX_RELAY_DOMAINS` | See [documentation link](http://www.postfix.org/postconf.5.html#relay_domains). |
| `POSTFIX_RELAYHOST_PORT` | Optional port argument for `POSTFIX_RELAYHOST`. Default is `25` so only need to change if you're `relayhost` is running on a different port. |
| `POSTFIX_RELAYHOST` | See [documentation link](http://www.postfix.org/postconf.5.html#relayhost). |
| `ENABLE_SUBMISSION_PORT` | Enable port 587. See [documentation link](https://www.postfix.org/postconf.5.html#service_name). |
| `ENABLE_SMTPS_PORT` | Enable legacy port 465. See [documentation link](https://www.postfix.org/postconf.5.html#service_name). |
mikenye marked this conversation as resolved.
Show resolved Hide resolved
| `POSTFIX_SMTP_TLS_CHAIN_FILES` | See [documentation link](http://www.postfix.org/postconf.5.html#smtp_tls_chain_files). |
| `POSTFIX_SMTPD_MILTERS` | Any milters given here are applied after DKIM & ClamAV. See [documentation link](http://www.postfix.org/postconf.5.html#smtpd_milters). |
| `POSTFIX_SMTPD_RECIPIENT_RESTRICTIONS_PERMIT_SASL_AUTHENTICATED` | Set to `true` to include in `smtpd_recipient_restrictions`. See [documentation link](http://www.postfix.org/postconf.5.html#permit_sasl_authenticated). |
Expand Down
25 changes: 18 additions & 7 deletions rootfs/etc/cont-init.d/11-postfix-generate-master.cf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,29 @@ cp -v ${POSTFIX_MASTERCF_ORIGINAL_FILE} ${POSTFIX_MASTERCF_FILE}
# Enable postscreen
# See: http://www.postfix.org/POSTSCREEN_README.html
# Comment out the "smtp inet ... smtpd" service in master.cf
sed -i 's/^smtp *inet.*smtpd$/#&/' /etc/postfix/master.cf
sed -i 's/^smtp *inet.*smtpd$/#&/' $POSTFIX_MASTERCF_FILE
# Uncomment the new "smtpd pass ... smtpd" service in master.cf
sed -i '/^#smtpd *pass.*smtpd$/s/^#//g' /etc/postfix/master.cf
sed -i '/^#smtpd *pass.*smtpd$/s/^#//g' $POSTFIX_MASTERCF_FILE
# Uncomment the new "smtp inet ... postscreen" service in master.cf
sed -i '/^#smtp *inet.*postscreen$/s/^#//g' /etc/postfix/master.cf
sed -i '/^#smtp *inet.*postscreen$/s/^#//g' $POSTFIX_MASTERCF_FILE
# Uncomment the new "tlsproxy unix ... tlsproxy" service in master.cf
sed -i '/^#tlsproxy *unix.*tlsproxy$/s/^#//g' /etc/postfix/master.cf
sed -i '/^#tlsproxy *unix.*tlsproxy$/s/^#//g' $POSTFIX_MASTERCF_FILE
# Uncomment the new "dnsblog unix ... dnsblog" service in master.cf
sed -i '/^#dnsblog *unix.*dnsblog$/s/^#//g' /etc/postfix/master.cf
sed -i '/^#dnsblog *unix.*dnsblog$/s/^#//g' $POSTFIX_MASTERCF_FILE

# Do we enable & configure spf-engine?
if [ "${ENABLE_SPF}" = "true" ]; then
echo "policy unix - n n - 0 spawn" >> "${POSTFIX_MASTERCF_FILE}"
echo " user=nobody argv=/usr/local/lib/policyd-spf-perl" >> "${POSTFIX_MASTERCF_FILE}"
echo "policy unix - n n - 0 spawn" >>"${POSTFIX_MASTERCF_FILE}"
echo " user=nobody argv=/usr/local/lib/policyd-spf-perl" >>"${POSTFIX_MASTERCF_FILE}"
fi

# Please note that on Debian submission port (587) and smtps port (465) are called
# "submission" and "submissions" either in /etc/postfix/master.cf and in /etc/services
# Do we enable & configure submission port?
if [ "${ENABLE_SUBMISSION_PORT}" = "true" ]; then
sed -i '/^#submission *inet.*smtpd$/s/^#//g' $POSTFIX_MASTERCF_FILE
fi
# Do we enable & configure smtps port?
if [ "${ENABLE_SMTPS_PORT}" = "true" ]; then
sed -i '/^#submissions *inet.*smtpd$/s/^#//g' $POSTFIX_MASTERCF_FILE
fi
Loading