Compare commits
9 Commits
v1.5.0
...
snyk-fix-6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e7a7b9987b | ||
|
|
193a9292ad | ||
|
|
5990535987 | ||
|
|
98e6ef216a | ||
|
|
5ba18a151e | ||
|
|
ceab4779d9 | ||
|
|
1426f26546 | ||
|
|
7d8086dd01 | ||
|
|
7a9b9513a7 |
@@ -37,3 +37,6 @@
|
|||||||
|
|
||||||
# Optional: This will disable (no) or enable (yes) the use of SMTPUTF8
|
# Optional: This will disable (no) or enable (yes) the use of SMTPUTF8
|
||||||
#SMTPUTF8_ENABLE=no
|
#SMTPUTF8_ENABLE=no
|
||||||
|
|
||||||
|
# Optional: This will use allow you to set a custom $message_size_limit value. Default is 10240000.
|
||||||
|
#MESSAGE_SIZE_LIMIT=
|
||||||
|
|||||||
4
.github/ISSUE_TEMPLATE/bug_report.md
vendored
4
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -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:**
|
||||||
|
|
||||||
|
|||||||
5
.github/pull_request_template.md
vendored
5
.github/pull_request_template.md
vendored
@@ -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.-->
|
||||||
|
|||||||
10
.github/workflows/release.yml
vendored
10
.github/workflows/release.yml
vendored
@@ -11,7 +11,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.API_GITHUB_TOKEN }}
|
token: ${{ secrets.API_GITHUB_TOKEN }}
|
||||||
|
|
||||||
@@ -28,19 +28,19 @@ jobs:
|
|||||||
alpine
|
alpine
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v3.3.1
|
||||||
with:
|
with:
|
||||||
push: true
|
push: true
|
||||||
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
|
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
|
||||||
|
|||||||
8
.github/workflows/test.yml
vendored
8
.github/workflows/test.yml
vendored
@@ -13,23 +13,23 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout with token
|
- name: Checkout with token
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.API_GITHUB_TOKEN }}
|
token: ${{ secrets.API_GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Checkout without token
|
- name: Checkout without token
|
||||||
if: github.event_name == 'pull_request'
|
if: github.event_name == 'pull_request'
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
- name: Docker Build Test
|
- name: Docker Build Test
|
||||||
run: docker buildx build --load --tag test:test --file ./Dockerfile ./
|
run: docker buildx build --load --tag test:test --file ./Dockerfile ./
|
||||||
|
|
||||||
- name: Version
|
- name: Version
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
uses: cycjimmy/semantic-release-action@v2.5.3
|
uses: cycjimmy/semantic-release-action@v3
|
||||||
with:
|
with:
|
||||||
semantic_version: 17.4
|
semantic_version: 17.4
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#Dockerfile for a Postfix email relay service
|
#Dockerfile for a Postfix email relay service
|
||||||
FROM alpine:3.13
|
FROM alpine:3.16
|
||||||
MAINTAINER Juan Luis Baptiste juan.baptiste@gmail.com
|
MAINTAINER Juan Luis Baptiste juan.baptiste@gmail.com
|
||||||
|
|
||||||
RUN apk update && \
|
RUN apk update && \
|
||||||
|
|||||||
@@ -83,6 +83,8 @@ The following env variable(s) are optional.
|
|||||||
|
|
||||||
* `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`.
|
* `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" \
|
||||||
|
|||||||
39
run.sh
39
run.sh
@@ -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
|
||||||
@@ -49,6 +49,9 @@ if [ "${SMTP_PORT}" = "465" ]; then
|
|||||||
add_config_value "smtp_tls_security_level" "encrypt"
|
add_config_value "smtp_tls_security_level" "encrypt"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Bind to both IPv4 and IPv4
|
||||||
|
add_config_value "inet_protocols" "all"
|
||||||
|
|
||||||
# Create sasl_passwd file with auth credentials
|
# Create sasl_passwd file with auth credentials
|
||||||
if [ ! -f /etc/postfix/sasl_passwd -a ! -z "${SMTP_USERNAME}" ]; then
|
if [ ! -f /etc/postfix/sasl_passwd -a ! -z "${SMTP_USERNAME}" ]; then
|
||||||
grep -q "${SMTP_SERVER}" /etc/postfix/sasl_passwd > /dev/null 2>&1
|
grep -q "${SMTP_SERVER}" /etc/postfix/sasl_passwd > /dev/null 2>&1
|
||||||
@@ -76,13 +79,25 @@ 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
|
||||||
for i in $(sed 's/,/\ /g' <<<$SMTP_NETWORKS); do
|
declare ipv6re="^((([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|\
|
||||||
if grep -Eq "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/[0-9]{1,2}" <<<$i ; then
|
([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|\
|
||||||
nets+=", $i"
|
([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|\
|
||||||
else
|
([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|\
|
||||||
echo "$i is not in proper IPv4 subnet format. Ignoring."
|
:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}|\
|
||||||
fi
|
::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|\
|
||||||
done
|
(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|\
|
||||||
|
(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/[0-9]{1,3})$"
|
||||||
|
|
||||||
|
for i in $(sed 's/,/\ /g' <<<$SMTP_NETWORKS); do
|
||||||
|
if grep -Eq "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/[0-9]{1,2}" <<<$i ; then
|
||||||
|
nets+=", $i"
|
||||||
|
elif grep -Eq "$ipv6re" <<<$i ; then
|
||||||
|
readarray -d \/ -t arr < <(printf '%s' "$i")
|
||||||
|
nets+=", [${arr[0]}]/${arr[1]}"
|
||||||
|
else
|
||||||
|
echo "$i is not in proper IPv4 or IPv6 subnet format. Ignoring."
|
||||||
|
fi
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
add_config_value "mynetworks" "${nets}"
|
add_config_value "mynetworks" "${nets}"
|
||||||
|
|
||||||
@@ -99,6 +114,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
|
||||||
|
|||||||
Reference in New Issue
Block a user