Trying to separate virtuals from accounts

This commit is contained in:
egavard 2015-08-05 11:58:10 +02:00
parent 63caae1e25
commit 23362190a8
3 changed files with 11 additions and 2 deletions

View file

@ -1 +1 @@
user@domain.tld|mypassword|alias1,alias2 user@domain.tld|mypassword

1
postfix/redirects.cf Normal file
View file

@ -0,0 +1 @@
user@domain.tld | otheruser@domain.tld otheruser@otherdomain.tld

View file

@ -6,7 +6,8 @@ echo "Regenerating postfix 'vmailbox' and 'virtual' for given users"
# rm /etc/postfix/vmailbox # rm /etc/postfix/vmailbox
# rm /etc/postfix/vmailbox.db # rm /etc/postfix/vmailbox.db
echo "# WARNING: this file is auto-generated. Do not modify locally" > /etc/postfix/vmailbox echo "# WARNING: this file is auto-generated. Do not modify locally" > /etc/postfix/vmailbox
while IFS=$'|' read -r login pass aliases # Creating users
while IFS=$'|' read -r login pass
do do
# Setting variables for better readability # Setting variables for better readability
@ -33,6 +34,13 @@ do
done < /tmp/postfix/accounts.cf done < /tmp/postfix/accounts.cf
makeuserdb makeuserdb
#creating virtuals
while IFS=$'|' read -r from to
do
echo "from : '$from' aliases: '$to'"
# Let's go!
echo "$from\t$to" >> /etc/postfix/virtual
done < /tmp/postfix/redirects.cf
echo "Postfix configurations" echo "Postfix configurations"
postmap /etc/postfix/vmailbox postmap /etc/postfix/vmailbox