From 23362190a8db7b04ebe602bdaf1cefb7d3719501 Mon Sep 17 00:00:00 2001 From: egavard Date: Wed, 5 Aug 2015 11:58:10 +0200 Subject: [PATCH] Trying to separate virtuals from accounts --- postfix/accounts.cf | 2 +- postfix/redirects.cf | 1 + start-mailserver.sh | 10 +++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 postfix/redirects.cf diff --git a/postfix/accounts.cf b/postfix/accounts.cf index 1489b4d7..94896e0d 100644 --- a/postfix/accounts.cf +++ b/postfix/accounts.cf @@ -1 +1 @@ -user@domain.tld|mypassword|alias1,alias2 \ No newline at end of file +user@domain.tld|mypassword \ No newline at end of file diff --git a/postfix/redirects.cf b/postfix/redirects.cf new file mode 100644 index 00000000..40eaea6a --- /dev/null +++ b/postfix/redirects.cf @@ -0,0 +1 @@ +user@domain.tld | otheruser@domain.tld otheruser@otherdomain.tld \ No newline at end of file diff --git a/start-mailserver.sh b/start-mailserver.sh index d4f07b01..c85191b0 100644 --- a/start-mailserver.sh +++ b/start-mailserver.sh @@ -6,7 +6,8 @@ echo "Regenerating postfix 'vmailbox' and 'virtual' for given users" # rm /etc/postfix/vmailbox # rm /etc/postfix/vmailbox.db 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 # Setting variables for better readability @@ -33,6 +34,13 @@ do done < /tmp/postfix/accounts.cf 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" postmap /etc/postfix/vmailbox