Skip to content

Commit

Permalink
Drop TX_ prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
djjudas21 committed Dec 6, 2021
1 parent 7449d16 commit f23ca31
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 53 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
with:
# list of Docker images to use as base name for tags
images: |
djjudas21/tx-smtp-relay
djjudas21/smtp-relay
- name: Login to DockerHub
uses: docker/login-action@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ jobs:
uses: docker/build-push-action@v2
with:
push: false
tags: djjudas21/tx-smtp-relay:testing
tags: djjudas21/smtp-relay:testing
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ COPY . /

EXPOSE 25

ENTRYPOINT [ "/tx-smtp-relay.sh" ]
ENTRYPOINT [ "/smtp-relay.sh" ]
32 changes: 16 additions & 16 deletions README.md
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.

Expand All @@ -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>
Expand Down
34 changes: 34 additions & 0 deletions smtp-relay.sh
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
34 changes: 0 additions & 34 deletions tx-smtp-relay.sh

This file was deleted.

0 comments on commit f23ca31

Please sign in to comment.