6 Commits

Author SHA1 Message Date
Nasser
ceab4779d9 feat: Add message_size_limit option (#86)
* feat: Add MESSAGE_SIZE_LIMIT configuration option (PR #86)
2022-06-20 16:38:09 -05:00
Juan Luis Baptiste
1426f26546 Fix fix: tag doc in PR tempalte. 2022-05-13 10:06:21 -05:00
Juan Luis Baptiste
7d8086dd01 Add usage comments to bug and PR templates
to tell users to remove unncesary parts before submitting.
2022-05-13 10:05:01 -05:00
Andrey Andreev
7a9b9513a7 fix: read passwords from files 2022-05-13 09:22:27 -05:00
Nico Weichbrodt
a80ceca118 feat: Allow disabling SMTPUTF8 2022-04-20 22:59:41 -05:00
linucksrox
f280c00f87 feat: Add ENV option to enable subject line logging 2022-04-04 16:40:35 -05:00
5 changed files with 45 additions and 6 deletions

View File

@@ -31,3 +31,12 @@
# Optional: This will use allow you to set a custom $mydestination value. Default is localhost. # Optional: This will use allow you to set a custom $mydestination value. Default is localhost.
#DESTINATION= #DESTINATION=
# Optional: This will output the subject line of messages in the log.
#LOG_SUBJECT=yes
# Optional: This will disable (no) or enable (yes) the use of SMTPUTF8
#SMTPUTF8_ENABLE=no
# Optional: This will use allow you to set a custom $message_size_limit value. Default is 10240000.
#MESSAGE_SIZE_LIMIT=

View File

@@ -6,12 +6,14 @@ labels: ''
assignees: '' assignees: ''
--- ---
<!-- BEFORE SUBMITTING YOUR PR, PLEASE REMOVE THIS TEXT -->
<!-- REMOVE START -->
**Reporting a bug** **Reporting a bug**
First of all, this is **not** a problem reporting forum, only report if you are pretty sure what you are experiencing is a bug with this image, not a configuration issue, for that you can use the [Github discussions section](https://github.com/juanluisbaptiste/docker-postfix/discussions) and we will do our best to help you to figure out what's going on with your setup. First of all, this is **not** a problem reporting forum, only report if you are pretty sure what you are experiencing is a bug with this image, not a configuration issue, for that you can use the [Github discussions section](https://github.com/juanluisbaptiste/docker-postfix/discussions) and we will do our best to help you to figure out what's going on with your setup.
Also be sure you are using the latest image by doing _docker pull juanluisbaptiste/postfix:latest_. Also be sure you are using the latest image by doing _docker pull juanluisbaptiste/postfix:latest_.
<!-- REMOVE END -->
**Please include the contents of:** **Please include the contents of:**

View File

@@ -1,10 +1,13 @@
<!-- BEFORE SUBMITTING YOUR PR, PLEASE REMOVE THIS TEXT -->
<!-- REMOVE START -->
# Creating a Pull Request # Creating a Pull Request
We use github actions to do automatic [semantic versioning](https://github.com/semantic-release/semantic-release), so please use the following nomenclature for the commit message according to the type of change: We use github actions to do automatic [semantic versioning](https://github.com/semantic-release/semantic-release), so please use the following nomenclature for the commit message according to the type of change:
* Prefix with `feat:`, and it will trigger a minor version bump. * Prefix with `feat:`, and it will trigger a minor version bump.
* Prefix with `fix`:, and it will trigger a patch version bump. * Prefix with `fix:`, and it will trigger a patch version bump.
* Prefix with `BREAKING CHANGE:`, and it will trigger a major version bump. * Prefix with `BREAKING CHANGE:`, and it will trigger a major version bump.
<!-- REMOVE END -->
## Description of the change ## Description of the change
<!--Please be very clear on the intention of the modifications included in the pull request.--> <!--Please be very clear on the intention of the modifications included in the pull request.-->

View File

@@ -79,6 +79,12 @@ The following env variable(s) are optional.
* `DESTINATION` This will define a list of domains from which incoming messages will be accepted. * `DESTINATION` This will define a list of domains from which incoming messages will be accepted.
* `LOG_SUBJECT` This will output the subject line of messages in the log.
* `SMTPUTF8_ENABLE` This will enable (default) or disable support for SMTPUTF8. Valid values are `no` to disable and `yes` to enable. Not setting this variable will use the postfix default, which is `yes`.
* `MESSAGE_SIZE_LIMIT` This will change the default limit of 10240000 bytes (10MB).
To use this container from anywhere, the 25 port or the one specified by `SMTP_PORT` needs to be exposed to the docker host server: To use this container from anywhere, the 25 port or the one specified by `SMTP_PORT` needs to be exposed to the docker host server:
docker run -d --name postfix -p "25:25" \ docker run -d --name postfix -p "25:25" \

27
run.sh
View File

@@ -14,8 +14,8 @@ function add_config_value() {
} }
# Read password and username from file to avoid unsecure env variables # Read password and username from file to avoid unsecure env variables
if [ -n "${SMTP_PASSWORD_FILE}" ]; then [ -f "${SMTP_PASSWORD_FILE}" ] && read SMTP_PASSWORD < ${SMTP_PASSWORD_FILE} || echo "SMTP_PASSWORD_FILE defined, but file not existing, skipping."; fi if [ -n "${SMTP_PASSWORD_FILE}" ]; then [ -e "${SMTP_PASSWORD_FILE}" ] && SMTP_PASSWORD=$(cat "${SMTP_PASSWORD_FILE}") || echo "SMTP_PASSWORD_FILE defined, but file not existing, skipping."; fi
if [ -n "${SMTP_USERNAME_FILE}" ]; then [ -f "${SMTP_USERNAME_FILE}" ] && read SMTP_USERNAME < ${SMTP_USERNAME_FILE} || echo "SMTP_USERNAME_FILE defined, but file not existing, skipping."; fi if [ -n "${SMTP_USERNAME_FILE}" ]; then [ -e "${SMTP_USERNAME_FILE}" ] && SMTP_USERNAME=$(cat "${SMTP_USERNAME_FILE}") || echo "SMTP_USERNAME_FILE defined, but file not existing, skipping."; fi
[ -z "${SMTP_SERVER}" ] && echo "SMTP_SERVER is not set" && exit 1 [ -z "${SMTP_SERVER}" ] && echo "SMTP_SERVER is not set" && exit 1
[ -z "${SERVER_HOSTNAME}" ] && echo "SERVER_HOSTNAME is not set" && exit 1 [ -z "${SERVER_HOSTNAME}" ] && echo "SERVER_HOSTNAME is not set" && exit 1
@@ -61,11 +61,18 @@ fi
#Set header tag #Set header tag
if [ ! -z "${SMTP_HEADER_TAG}" ]; then if [ ! -z "${SMTP_HEADER_TAG}" ]; then
postconf -e "header_checks = regexp:/etc/postfix/header_tag" postconf -e "header_checks = regexp:/etc/postfix/header_checks"
echo -e "/^MIME-Version:/i PREPEND RelayTag: $SMTP_HEADER_TAG\n/^Content-Transfer-Encoding:/i PREPEND RelayTag: $SMTP_HEADER_TAG" > /etc/postfix/header_tag echo -e "/^MIME-Version:/i PREPEND RelayTag: $SMTP_HEADER_TAG\n/^Content-Transfer-Encoding:/i PREPEND RelayTag: $SMTP_HEADER_TAG" >> /etc/postfix/header_checks
echo "Setting configuration option SMTP_HEADER_TAG with value: ${SMTP_HEADER_TAG}" echo "Setting configuration option SMTP_HEADER_TAG with value: ${SMTP_HEADER_TAG}"
fi fi
#Enable logging of subject line
if [ "${LOG_SUBJECT}" == "yes" ]; then
postconf -e "header_checks = regexp:/etc/postfix/header_checks"
echo -e "/^Subject:/ WARN" >> /etc/postfix/header_checks
echo "Enabling logging of subject line"
fi
#Check for subnet restrictions #Check for subnet restrictions
nets='10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16' nets='10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16'
if [ ! -z "${SMTP_NETWORKS}" ]; then if [ ! -z "${SMTP_NETWORKS}" ]; then
@@ -79,6 +86,12 @@ if [ ! -z "${SMTP_NETWORKS}" ]; then
fi fi
add_config_value "mynetworks" "${nets}" add_config_value "mynetworks" "${nets}"
# Set SMTPUTF8
if [ ! -z "${SMTPUTF8_ENABLE}" ]; then
postconf -e "smtputf8_enable = ${SMTPUTF8_ENABLE}"
echo "Setting configuration option smtputf8_enable with value: ${SMTPUTF8_ENABLE}"
fi
if [ ! -z "${OVERWRITE_FROM}" ]; then if [ ! -z "${OVERWRITE_FROM}" ]; then
echo -e "/^From:.*$/ REPLACE From: $OVERWRITE_FROM" > /etc/postfix/smtp_header_checks echo -e "/^From:.*$/ REPLACE From: $OVERWRITE_FROM" > /etc/postfix/smtp_header_checks
postmap /etc/postfix/smtp_header_checks postmap /etc/postfix/smtp_header_checks
@@ -86,6 +99,12 @@ if [ ! -z "${OVERWRITE_FROM}" ]; then
echo "Setting configuration option OVERWRITE_FROM with value: ${OVERWRITE_FROM}" echo "Setting configuration option OVERWRITE_FROM with value: ${OVERWRITE_FROM}"
fi fi
# Set message_size_limit
if [ ! -z "${MESSAGE_SIZE_LIMIT}" ]; then
postconf -e "message_size_limit = ${MESSAGE_SIZE_LIMIT}"
echo "Setting configuration option message_size_limit with value: ${MESSAGE_SIZE_LIMIT}"
fi
#Start services #Start services
# If host mounting /var/spool/postfix, we need to delete old pid file before # If host mounting /var/spool/postfix, we need to delete old pid file before