From 51bf5662de42e6cfd6e45633108c577f92ce3514 Mon Sep 17 00:00:00 2001 From: Thomas Butter Date: Wed, 14 Oct 2015 16:50:57 +0200 Subject: [PATCH] forward only domains should be added to vhosts --- start-mailserver.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/start-mailserver.sh b/start-mailserver.sh index a03d2fb9..89d84238 100644 --- a/start-mailserver.sh +++ b/start-mailserver.sh @@ -29,7 +29,6 @@ if [ -f /tmp/postfix/accounts.cf ]; then echo ${domain} >> /tmp/vhost.tmp done < /tmp/postfix/accounts.cf makeuserdb - cat /tmp/vhost.tmp | sort | uniq >> /etc/postfix/vhost && rm /tmp/vhost.tmp else echo "==> Warning: '/tmp/postfix/accounts.cf' is not provided. No mail account created." fi @@ -37,10 +36,20 @@ fi if [ -f /tmp/postfix/virtual ]; then # Copying virtual file cp /tmp/postfix/virtual /etc/postfix/virtual + while IFS=$' ' read from to + do + # Setting variables for better readability + domain=$(echo ${from} | cut -d @ -f2) + echo ${domain} >> /tmp/vhost.tmp + done < /tmp/postfix/virtual else echo "==> Warning: '/tmp/postfix/virtual' is not provided. No mail alias created." fi +if [ -f /tmp/vhost.tmp ]; then + cat /tmp/vhost.tmp | sort | uniq > /etc/postfix/vhost && rm /tmp/vhost.tmp +fi + echo "Postfix configurations" touch /etc/postfix/vmailbox && postmap /etc/postfix/vmailbox touch /etc/postfix/virtual && postmap /etc/postfix/virtual