forward only domains should be added to vhosts

This commit is contained in:
Thomas Butter 2015-10-14 16:50:57 +02:00
parent c3c711afd0
commit 51bf5662de

View file

@ -29,7 +29,6 @@ if [ -f /tmp/postfix/accounts.cf ]; then
echo ${domain} >> /tmp/vhost.tmp echo ${domain} >> /tmp/vhost.tmp
done < /tmp/postfix/accounts.cf done < /tmp/postfix/accounts.cf
makeuserdb makeuserdb
cat /tmp/vhost.tmp | sort | uniq >> /etc/postfix/vhost && rm /tmp/vhost.tmp
else else
echo "==> Warning: '/tmp/postfix/accounts.cf' is not provided. No mail account created." echo "==> Warning: '/tmp/postfix/accounts.cf' is not provided. No mail account created."
fi fi
@ -37,10 +36,20 @@ fi
if [ -f /tmp/postfix/virtual ]; then if [ -f /tmp/postfix/virtual ]; then
# Copying virtual file # Copying virtual file
cp /tmp/postfix/virtual /etc/postfix/virtual 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 else
echo "==> Warning: '/tmp/postfix/virtual' is not provided. No mail alias created." echo "==> Warning: '/tmp/postfix/virtual' is not provided. No mail alias created."
fi fi
if [ -f /tmp/vhost.tmp ]; then
cat /tmp/vhost.tmp | sort | uniq > /etc/postfix/vhost && rm /tmp/vhost.tmp
fi
echo "Postfix configurations" echo "Postfix configurations"
touch /etc/postfix/vmailbox && postmap /etc/postfix/vmailbox touch /etc/postfix/vmailbox && postmap /etc/postfix/vmailbox
touch /etc/postfix/virtual && postmap /etc/postfix/virtual touch /etc/postfix/virtual && postmap /etc/postfix/virtual