From 58e9765fbd05fb576a08c307cd323b50c0a2a971 Mon Sep 17 00:00:00 2001 From: Simon Schmid Date: Tue, 23 Jun 2020 10:45:23 +0200 Subject: [PATCH] Add option to specify passwordmap file --- README.md | 1 + s6/postfix/run | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/README.md b/README.md index b31908a..e2008c9 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ Relay host parameters: - `RELAYHOST` - Postfix `relayhost`. Default ''. (example `mail.example.com:25`) - `RELAYHOST_AUTH` - Enable authentication for relayhost. Generally used with `RELAYHOST_PASSWORDMAP`. Default `no`. - `RELAYHOST_PASSWORDMAP` - relayhost password map in format: `RELAYHOST_PASSWORDMAP=mail1.example.com:user1:pass2,mail2.example.com:user2:pass2` +- `RELAYHOST_PASSWORDMAP_FILE` - relayhost password map file, content is copied into RELAYHOST_PASSWORDMAP. Useful in combination with docker secrets. Virtual alias map: diff --git a/s6/postfix/run b/s6/postfix/run index d666b8b..561ca16 100755 --- a/s6/postfix/run +++ b/s6/postfix/run @@ -91,6 +91,16 @@ if [ "${RELAYHOST_AUTH}" == "yes" ]; then postconf -e smtp_sasl_mechanism_filter="PLAIN LOGIN" fi +if [ -n "${RELAYHOST_PASSWORDMAP_FILE}" ]; then + echo "postfix >> Reading password map file: ${RELAYHOST_PASSWORDMAP_FILE}" + if [ -e "${RELAYHOST_PASSWORDMAP_FILE}" ]; then + RELAYHOST_PASSWORDMAP=$(cat $RELAYHOST_PASSWORDMAP_FILE) + echo "postfix >> Read password map " + else + echo "postfix >> Specified password map file not found!" + fi +fi + if [ -n "${RELAYHOST_PASSWORDMAP}" ]; then echo "postfix >> Generating relayhost password map" truncate --size 0 /etc/postfix/sasl-passwords