From 2cc312d25b5670e5a9f0784df967223fead9a66c Mon Sep 17 00:00:00 2001 From: Jelte van Woudenbergh Date: Wed, 8 Feb 2023 14:16:15 +0100 Subject: [PATCH 1/4] added file based config changed OWNER to myself --- entrypoint.sh | 9 +++++++++ script/build.sh | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 7a7c5f8..11cd08b 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -17,6 +17,7 @@ $ docker run -p 25:25 \\ Environment Variables: SMF_DOMAIN - mail server hostname. use tutum/docker hostname if omitted. SMF_CONFIG - mail forward addresses mapping list. + SMF_CONFIG_FILE - file name that contain forward adresses mapping list. SMF_MYNETWORKS - configure relaying from trusted IPs, see http://www.postfix.org/postconf.5.html#mynetworks SMF_RELAYHOST - configure a relayhost SMF_SENDERPRIVACY - strips sender's IP, client, and user agent. @@ -349,6 +350,14 @@ else echo ">> END SMF_DOMAIN found. value:[$SMF_DOMAIN]" fi +if [ "" == "$SMF_CONFIG_FILE" ]; then + echo ">> ENV SMF_CONFIG_FILE not set." +else + echo ">> END SMF_CONFIG_FILE found. value:[$SMF_CONFIG_FILE]" + echo ">> INSERT config file into config var" + SMF_CONFIG=$(cat /$SMF_CONFIG_FILE | tr '\n' ';') +fi + if [ "" == "$SMF_CONFIG" ] then echo ">> END SMF_CONFIG not set." diff --git a/script/build.sh b/script/build.sh index 237f564..4eac8d8 100755 --- a/script/build.sh +++ b/script/build.sh @@ -4,7 +4,7 @@ # set -e -OWNER="zixia" +OWNER="jaydouble" NAME="simple-mail-forwarder" IMAGE_NAME="$OWNER/$NAME" From 918732a2336dc367fe0101db4ec4bcecd4d76832 Mon Sep 17 00:00:00 2001 From: Jelte van Woudenbergh Date: Wed, 8 Feb 2023 17:05:50 +0100 Subject: [PATCH 2/4] entrypoint: export config build.sh back to zixia --- entrypoint.sh | 1 + script/build.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 11cd08b..8ac268d 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -356,6 +356,7 @@ else echo ">> END SMF_CONFIG_FILE found. value:[$SMF_CONFIG_FILE]" echo ">> INSERT config file into config var" SMF_CONFIG=$(cat /$SMF_CONFIG_FILE | tr '\n' ';') + export SMF_CONFIG fi if [ "" == "$SMF_CONFIG" ] diff --git a/script/build.sh b/script/build.sh index 4eac8d8..237f564 100755 --- a/script/build.sh +++ b/script/build.sh @@ -4,7 +4,7 @@ # set -e -OWNER="jaydouble" +OWNER="zixia" NAME="simple-mail-forwarder" IMAGE_NAME="$OWNER/$NAME" From d0218a6796ad8a7d2b31da0336440abd9f02670e Mon Sep 17 00:00:00 2001 From: Jelte van Woudenbergh Date: Wed, 8 Feb 2023 17:14:49 +0100 Subject: [PATCH 3/4] added check file exists --- entrypoint.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 8ac268d..00e27f1 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -352,6 +352,8 @@ fi if [ "" == "$SMF_CONFIG_FILE" ]; then echo ">> ENV SMF_CONFIG_FILE not set." +elif [ ! -f "$SMF_CONFIG_FILE" ]; then + echo ">> $SMF_CONFIG_FILE doesn't exists, skipping reading it." else echo ">> END SMF_CONFIG_FILE found. value:[$SMF_CONFIG_FILE]" echo ">> INSERT config file into config var" From 32e7b34965717dbe5c36e8f3826c4351a3850bbc Mon Sep 17 00:00:00 2001 From: Jaydouble Date: Wed, 8 Feb 2023 17:23:48 +0100 Subject: [PATCH 4/4] added readme --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index dca5853..c1ae96b 100644 --- a/README.md +++ b/README.md @@ -172,6 +172,22 @@ You can also forward all emails received by testi@testo.com to multiple destinat export SMF_CONFIG='testi@testo.com:test1@test.com|test2@test.com|test3@test.com' ``` +### `SMF_CONFIG_FILE` Examples + +If you want to have a config file instead of a config variable +You can add it like: +```bash +cat forwards +testi@testo.com:test1@test.com|test2@test.com|test3@test.com +from@testi.com:to@testo.com:ThisIsPassword +EOF +``` + +And then run it: +```bash +docker run -e SMF_CONFIG_FILE=/forwards -v $(pwd)/forwards:/forwards -p 25:25 zixia/simple-mail-forwarder +``` + ### `SMF_RELAYHOST` Examples Here's how to configure a relayhost/smarthost to use for forwarding mail. @@ -190,6 +206,8 @@ If the `SMF_RELAYHOST` require authentication, export SMF_RELAYAUTH='username@relayhost.com:RelayHostPassword' ``` + + TLS (SSL) Certificates --------------------