From 3d8586702e6e267e5b68957c7db847d5f4db477f Mon Sep 17 00:00:00 2001
From: Michael Kroes <michael@kroes.email>
Date: Tue, 16 Jul 2019 21:40:40 +0200
Subject: [PATCH] Update whitelist and check if custom whitelist exists

---
 conf/postgrey_whitelist_clients | 1 +
 setup/mail-postfix.sh           | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/conf/postgrey_whitelist_clients b/conf/postgrey_whitelist_clients
index 8c94d2eb..364155f5 100644
--- a/conf/postgrey_whitelist_clients
+++ b/conf/postgrey_whitelist_clients
@@ -3,3 +3,4 @@
 /^mta-aws\d+\.sanomacorp\.net$/
 /^mail.*\.mandrillapp\.com$/
 /^mail\d+\.ikea.com$/
+/^webgride\d+\.emsecure.net$/
diff --git a/setup/mail-postfix.sh b/setup/mail-postfix.sh
index e17b78ba..0c7829d9 100755
--- a/setup/mail-postfix.sh
+++ b/setup/mail-postfix.sh
@@ -254,7 +254,9 @@ if [ ! -f /etc/postgrey/whitelist_clients ] || find /etc/postgrey/whitelist_clie
         # before moving it into place
         if [ \$(file -b --mime-type /tmp/postgrey_whitelist_clients) == "text/plain" ]; then
             mv /tmp/postgrey_whitelist_clients /etc/postgrey/whitelist_clients
-            cat /root/mailinabox/conf/postgrey_whitelist_clients >> /etc/postgrey/whitelist_clients
+            if [ -f /root/mailinabox/conf/postgrey_whitelist_clients ] ; then
+               cat /root/mailinabox/conf/postgrey_whitelist_clients >> /etc/postgrey/whitelist_clients
+            fi
 	else
             rm /tmp/postgrey_whitelist_clients
         fi