Compare commits
24 Commits
migrate_to
...
v1.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e0b14a4514 | ||
|
|
b1ef5ea1d0 | ||
|
|
2264af0bca | ||
|
|
9b1d5b47a7 | ||
|
|
7c3a0cacb5 | ||
|
|
e674820a5c | ||
|
|
273beb03fa | ||
|
|
d5012c2652 | ||
|
|
8cc737c70a | ||
|
|
4398bb1053 | ||
|
|
5e4998f14e | ||
|
|
bb8a0671d7 | ||
|
|
29b356bb2b | ||
|
|
99a2397715 | ||
|
|
c55bcb70ac | ||
|
|
9603b4070d | ||
|
|
af1f46641b | ||
|
|
74ea38cd6e | ||
|
|
113fe1c53d | ||
|
|
b549ac8228 | ||
|
|
e6b37122f8 | ||
|
|
0ec4289588 | ||
|
|
32fa6bcd68 | ||
|
|
0e9c2d2b23 |
@@ -5,10 +5,10 @@
|
||||
# Optional: (Default value: 587) Port address of the SMTP server to use.
|
||||
#SMTP_PORT=
|
||||
|
||||
# Mandatory: Username to authenticate with.
|
||||
# Optional: Username to authenticate with.
|
||||
#SMTP_USERNAME=
|
||||
|
||||
# Mandatory: Password of the SMTP user. (Not needed if SMTP_PASSWORD_FILE is used)
|
||||
# Optional (Mandatory if SMTP_USERNAME is set): Password of the SMTP user. (Not needed if SMTP_PASSWORD_FILE is used)
|
||||
#SMTP_PASSWORD=
|
||||
|
||||
# Mandatory: Server hostname for the Postfix container. Emails will appear to come from the hostname's domain.
|
||||
@@ -17,7 +17,7 @@
|
||||
# Optional: This will add a header for tracking messages upstream. Helpful for spam filters. Will appear as "RelayTag: ${SMTP_HEADER_TAG}" in the email headers.
|
||||
#SMTP_HEADER_TAG=
|
||||
|
||||
# Optional: This will add a header for tracking messages upstream. Helpful for spam filters. Will appear as "RelayTag: ${SMTP_HEADER_TAG}" in the email headers.
|
||||
# Optional: Setting this will allow you to add additional, comma seperated, subnets to use the relay. Used like SMTP_NETWORKS='xxx.xxx.xxx.xxx/xx,xxx.xxx.xxx.xxx/xx'.
|
||||
#SMTP_NETWORKS=
|
||||
|
||||
# Optional: Set this to a mounted file containing the password, to avoid passwords in env variables.
|
||||
|
||||
25
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
25
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**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.
|
||||
|
||||
Also be sure you are using the latest image by doing _docker pull juanluisbaptiste/postfix:latest_.
|
||||
|
||||
**Please include the contents of:**
|
||||
|
||||
* Your docker-compose.yml file
|
||||
* Your .env file file
|
||||
|
||||
**Describe the issue**
|
||||
Please include a description of what you are trying to accomplish and what you are facing when running this container.
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
48
.github/workflows/release.yml
vendored
Normal file
48
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "*"
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
token: ${{ secrets.API_GITHUB_TOKEN }}
|
||||
|
||||
- name: Docker meta
|
||||
id: docker_meta
|
||||
uses: crazy-max/ghaction-docker-meta@v2
|
||||
with:
|
||||
images: juanluisbaptiste/postfix
|
||||
tags: |
|
||||
type=semver,pattern={{major}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}.{{minor}}.{{patch}}
|
||||
type=semver,pattern={{version}}
|
||||
alpine
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
push: true
|
||||
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
|
||||
tags: ${{ steps.docker_meta.outputs.tags }}
|
||||
labels: ${{ steps.docker_meta.outputs.labels }}
|
||||
36
.github/workflows/test.yml
vendored
Normal file
36
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
name: Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master, develop]
|
||||
pull_request:
|
||||
branches: [master, develop]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- name: Checkout with token
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
token: ${{ secrets.API_GITHUB_TOKEN }}
|
||||
|
||||
- name: Checkout without token
|
||||
if: github.event_name == 'pull_request'
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Docker Build Test
|
||||
run: docker buildx build --load --tag test:test --file ./Dockerfile ./
|
||||
|
||||
- name: Version
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: cycjimmy/semantic-release-action@v2.5.3
|
||||
with:
|
||||
semantic_version: 17.4
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.API_GITHUB_TOKEN }}
|
||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.env
|
||||
11
.releaserc.yml
Normal file
11
.releaserc.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
branches:
|
||||
- name: master
|
||||
- name: develop
|
||||
prerelease: true
|
||||
plugins:
|
||||
- "@semantic-release/commit-analyzer"
|
||||
- "@semantic-release/release-notes-generator"
|
||||
- - "@semantic-release/github"
|
||||
- successComment: false
|
||||
failComment: false
|
||||
17
README.md
17
README.md
@@ -3,7 +3,7 @@
|
||||
[](https://hub.docker.com/r/juanluisbaptiste/postfix/)
|
||||
[](https://hub.docker.com/r/juanluisbaptiste/postfix/)
|
||||
|
||||
Simple Postfix SMTP TLS relay [docker](http://www.docker.com) image with no local authentication enabled (to be run in a secure LAN).
|
||||
Simple Postfix SMTP TLS relay [docker](http://www.docker.com) alpine based image with no local authentication enabled (to be run in a secure LAN).
|
||||
|
||||
It also includes rsyslog to enable logging to stdout.
|
||||
|
||||
@@ -12,12 +12,11 @@ _If you want to follow the development of this project check out [my blog](https
|
||||
|
||||
### Available image tags
|
||||
|
||||
This image has been built on CentOS 7 since its inception, but the new CentOS 8 does [not include supervisor](https://github.com/juanluisbaptiste/docker-postfix/issues/16) anymore, so I have started migrating this image to Alpine linux. So currently there are two image tags available:
|
||||
Currently we only handle a rolling release of new versions so only _latest_ tag is available, but there is [work in progress](https://github.com/juanluisbaptiste/docker-postfix/pull/29) to start releasing versioned images to be able to pin to specific versions in production deployments.
|
||||
|
||||
* juanluisbaptiste/postfix:latest, current CentOS 7 based image
|
||||
* juanluisbaptiste/postfix:alpine, new Alpine based image
|
||||
|
||||
If testing goes well for some time, then the current CentOS image will be replaced by the new Alpine one, and _latest_ tag will point to it.
|
||||
*_NOTES_*:
|
||||
* The _alpine_ tag has been switched to use the master branch, but it's irrelevant as it is the same as _latest_.
|
||||
* Old CentOS 7 based image is avaiable on the _centos_base_image branch_, but it is not being developed any more.
|
||||
|
||||
### Build instructions
|
||||
|
||||
@@ -26,7 +25,7 @@ Clone this repo and then:
|
||||
cd docker-Postfix
|
||||
sudo docker build -t juanluisbaptiste/postfix .
|
||||
|
||||
Or you can use the provided [docker-compose](https://github.com/juanluisbaptiste/docker-postfix/blob/master/docker-compose.overrides.yml) files:
|
||||
Or you can use the provided [docker-compose](https://github.com/juanluisbaptiste/docker-postfix/blob/master/docker-compose.override.yml) files:
|
||||
|
||||
sudo docker-compose build
|
||||
|
||||
@@ -40,8 +39,8 @@ The following env variables need to be passed to the container:
|
||||
|
||||
* `SMTP_SERVER` Server address of the SMTP server to use.
|
||||
* `SMTP_PORT` (Optional, Default value: 587) Port address of the SMTP server to use.
|
||||
* `SMTP_USERNAME` Username to authenticate with.
|
||||
* `SMTP_PASSWORD` Password of the SMTP user. If `SMTP_PASSWORD_FILE` is set, not needed.
|
||||
* `SMTP_USERNAME` (Optional) Username to authenticate with.
|
||||
* `SMTP_PASSWORD` (Mandatory if `SMTP_USERNAME` is set) Password of the SMTP user. If `SMTP_PASSWORD_FILE` is set, not needed.
|
||||
* `SERVER_HOSTNAME` Server hostname for the Postfix container. Emails will appear to come from the hostname's domain.
|
||||
|
||||
The following env variable(s) are optional.
|
||||
|
||||
16
run.sh
16
run.sh
@@ -17,9 +17,8 @@ function add_config_value() {
|
||||
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
|
||||
|
||||
[ -z "${SMTP_SERVER}" ] && echo "SMTP_SERVER is not set" && exit 1
|
||||
[ -z "${SMTP_USERNAME}" ] && echo "SMTP_USERNAME is not set" && exit 1
|
||||
[ -z "${SMTP_PASSWORD}" ] && echo "SMTP_PASSWORD is not set" && exit 1
|
||||
[ -z "${SERVER_HOSTNAME}" ] && echo "SERVER_HOSTNAME is not set" && exit 1
|
||||
[ ! -z "${SMTP_USERNAME}" -a -z "${SMTP_PASSWORD}" ] && echo "SMTP_USERNAME is set but SMTP_PASSWORD is not set" && exit 1
|
||||
|
||||
SMTP_PORT="${SMTP_PORT:-587}"
|
||||
|
||||
@@ -33,10 +32,15 @@ add_config_value "mydestination" 'localhost'
|
||||
add_config_value "myorigin" '$mydomain'
|
||||
add_config_value "relayhost" "[${SMTP_SERVER}]:${SMTP_PORT}"
|
||||
add_config_value "smtp_use_tls" "yes"
|
||||
add_config_value "smtp_sasl_auth_enable" "yes"
|
||||
add_config_value "smtp_sasl_password_maps" "lmdb:/etc/postfix/sasl_passwd"
|
||||
add_config_value "smtp_sasl_security_options" "noanonymous"
|
||||
if [ ! -z "${SMTP_USERNAME}" ]; then
|
||||
add_config_value "smtp_sasl_auth_enable" "yes"
|
||||
add_config_value "smtp_sasl_password_maps" "lmdb:/etc/postfix/sasl_passwd"
|
||||
add_config_value "smtp_sasl_security_options" "noanonymous"
|
||||
fi
|
||||
add_config_value "always_add_missing_headers" "${ALWAYS_ADD_MISSING_HEADERS:-no}"
|
||||
#Also use "native" option to allow looking up hosts added to /etc/hosts via
|
||||
# docker options (issue #51)
|
||||
add_config_value "smtp_host_lookup" "native,dns"
|
||||
|
||||
if [ "${SMTP_PORT}" = "465" ]; then
|
||||
add_config_value "smtp_tls_wrappermode" "yes"
|
||||
@@ -44,7 +48,7 @@ if [ "${SMTP_PORT}" = "465" ]; then
|
||||
fi
|
||||
|
||||
# Create sasl_passwd file with auth credentials
|
||||
if [ ! -f /etc/postfix/sasl_passwd ]; then
|
||||
if [ ! -f /etc/postfix/sasl_passwd -a ! -z "${SMTP_USERNAME}" ]; then
|
||||
grep -q "${SMTP_SERVER}" /etc/postfix/sasl_passwd > /dev/null 2>&1
|
||||
if [ $? -gt 0 ]; then
|
||||
echo "Adding SASL authentication configuration"
|
||||
|
||||
Reference in New Issue
Block a user