forked from applariat/kubernetes-postfix-relay-host
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
53 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ COPY . / | |
|
||
EXPOSE 25 | ||
|
||
ENTRYPOINT [ "/tx-smtp-relay.sh" ] | ||
ENTRYPOINT [ "/smtp-relay.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# tx-smtp-relay | ||
# smtp-relay | ||
|
||
This image provides an SMTP relay host for emails from within a Kubernetes cluster. | ||
|
||
|
@@ -10,32 +10,32 @@ open relay service to your cluster. This means you don't have to configure all o | |
This image supports the following enironment variables. All are **required**. | ||
|
||
|
||
| Variable | Use | Example | | ||
|----------------------------|---------------------------------------------------------------------|------------------------------| | ||
| `TX_SMTP_RELAY_HOST` | Hostname of upstream SMTP relay server | `[smtp.sendgrid.net]:587` | | ||
| `TX_SMTP_RELAY_USERNAME` | Username for upstream SMTP relay server | `apikey` | | ||
| `TX_SMTP_RELAY_PASSWORD` | Password for upstream SMTP relay server | `pAsSwOrD` | | ||
| `TX_SMTP_RELAY_MYHOSTNAME` | Hostname of this SMTP relay | `tx-smtp-relay.yourhost.com` | | ||
| `TX_SMTP_RELAY_MYNETWORKS` | Comma-separated list of local networks that can use this SMTP relay | `127.0.0.0/8,10.0.0.0/8` | | ||
| Variable | Use | Example | | ||
|----------------------------|---------------------------------------------------------------------|---------------------------| | ||
| `SMTP_RELAY_HOST` | Hostname of upstream SMTP relay server | `[smtp.sendgrid.net]:587` | | ||
| `SMTP_RELAY_USERNAME` | Username for upstream SMTP relay server | `apikey` | | ||
| `SMTP_RELAY_PASSWORD` | Password for upstream SMTP relay server | `pAsSwOrD` | | ||
| `SMTP_RELAY_MYHOSTNAME` | Hostname of this SMTP relay | `smtp-relay.yourhost.com` | | ||
| `SMTP_RELAY_MYNETWORKS` | Comma-separated list of local networks that can use this SMTP relay | `127.0.0.0/8,10.0.0.0/8` | | ||
|
||
# Quickstart | ||
Run on docker | ||
``` | ||
docker run --rm -it -p 2525:25 \ | ||
-e TX_SMTP_RELAY_HOST="[smtp.sendgrid.net]:587" \ | ||
-e TX_SMTP_RELAY_MYHOSTNAME=tx-smtp-relay.yourhost.com \ | ||
-e TX_SMTP_RELAY_USERNAME=username \ | ||
-e TX_SMTP_RELAY_PASSWORD=password \ | ||
-e TX_SMTP_RELAY_MYNETWORKS=127.0.0.0/8,10.0.0.0/8 \ | ||
djjudas21/tx-smtp-relay | ||
-e SMTP_RELAY_HOST="[smtp.sendgrid.net]:587" \ | ||
-e SMTP_RELAY_MYHOSTNAME=smtp-relay.yourhost.com \ | ||
-e SMTP_RELAY_USERNAME=username \ | ||
-e SMTP_RELAY_PASSWORD=password \ | ||
-e SMTP_RELAY_MYNETWORKS=127.0.0.0/8,10.0.0.0/8 \ | ||
djjudas21/smtp-relay | ||
``` | ||
Send a test message | ||
<pre> | ||
<b>telnet localhost 2525</b> | ||
220 tx-smtp-relay.yourhost.com ESMTP Postfix | ||
220 smtp-relay.yourhost.com ESMTP Postfix | ||
<b>helo localhost</b> | ||
250 tx-smtp-relay.yourhost.com | ||
250 smtp-relay.yourhost.com | ||
<b>mail from: [email protected]</b> | ||
250 2.1.0 Ok | ||
<b>rcpt to: [email protected]</b> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/sh | ||
|
||
SMTP_RELAY_HOST=${SMTP_RELAY_HOST?Missing env var SMTP_RELAY_HOST} | ||
SMTP_RELAY_MYHOSTNAME=${SMTP_RELAY_MYHOSTNAME?Missing env var SMTP_RELAY_MYHOSTNAME} | ||
SMTP_RELAY_USERNAME=${SMTP_RELAY_USERNAME?Missing env var SMTP_RELAY_USERNAME} | ||
SMTP_RELAY_PASSWORD=${SMTP_RELAY_PASSWORD?Missing env var SMTP_RELAY_PASSWORD} | ||
SMTP_RELAY_MYNETWORKS=${SMTP_RELAY_MYNETWORKS?Missing env var SMTP_RELAY_MYNETWORKS} | ||
SMTP_RELAY_WRAPPERMODE=${SMTP_RELAY_WRAPPERMODE?Missing env var SMTP_RELAY_WRAPPERMODE} | ||
SMTP_TLS_SECURITY_LEVEL=${SMTP_TLS_SECURITY_LEVEL?Missing env var SMTP_TLS_SECURITY_LEVEL} | ||
|
||
|
||
# handle sasl | ||
echo "${SMTP_RELAY_HOST} ${SMTP_RELAY_USERNAME}:${SMTP_RELAY_PASSWORD}" > /etc/postfix/sasl_passwd || exit 1 | ||
postmap /etc/postfix/sasl_passwd || exit 1 | ||
rm /etc/postfix/sasl_passwd || exit 1 | ||
|
||
postconf 'smtp_sasl_auth_enable = yes' || exit 1 | ||
postconf 'smtp_sasl_password_maps = lmdb:/etc/postfix/sasl_passwd' || exit 1 | ||
postconf 'smtp_sasl_security_options =' || exit 1 | ||
|
||
# These are required. | ||
postconf "relayhost = ${SMTP_RELAY_HOST}" || exit 1 | ||
postconf "myhostname = ${SMTP_RELAY_MYHOSTNAME}" || exit 1 | ||
postconf "mynetworks = ${SMTP_RELAY_MYNETWORKS}" || exit 1 | ||
postconf "smtp_tls_wrappermode = ${SMTP_RELAY_WRAPPERMODE}" || exit 1 | ||
postconf "smtp_tls_security_level = ${SMTP_TLS_SECURITY_LEVEL}" || exit 1 | ||
|
||
# http://www.postfix.org/COMPATIBILITY_README.html#smtputf8_enable | ||
postconf 'smtputf8_enable = no' || exit 1 | ||
|
||
# This makes sure the message id is set. If this is set to no dkim=fail will happen. | ||
postconf 'always_add_missing_headers = yes' || exit 1 | ||
|
||
/usr/bin/supervisord -n |
This file was deleted.
Oops, something went wrong.