Posted by mike Filed Under Multiple Domains with Comments Off
Virtual aliases can map to addresses that do not terminate on the local system while regular aliases can only map to addresses which terminate on the local system.
Virtual Alias Domains
You will need to add these lines to the main.cf file.
virtual_alias_domains = example.com
If you were going to add a number of domains you would want to create a map file. Create the file /etc/postfix/virtual_alias_domains and enter one domain on each line and include the creation date on the right. Postfix will ignore the creation date but remember map files must have two sides.
myexample.com 20070608
example.com 20070801
newexample.com 20070803
Now create the db out of this file with this command:
postmap hash:/etc/postfix/virtual_alias_domains
If you use a database file as illustrated above you will need the parameter changed to this:
virtual_alias_domains = hash:/etc/postfix/virtual_alias_domains
Warning!
If you set up a domain as virtual DO NOT put it in the mydestination parameter.
Now you need to create the recipient address map. Create a file called:
/etc/postfix/virtual_alias_maps
The file will then create the mappings of the virtual address on the left and the address, local or remote that you want it to go to on the right column. The names are separated by a TAB.
test@myexample.com test@example.com
mike@example.com mike@another_example.com
joe@newexample.com joe@last_example.com
Save the file.
Execute the command to create the db file.
postmap hash:/etc/postfix/virtual_alias_maps
Add this line in the main.cf.
virtual_alias_maps = hash:/etc/postfix/virtual_alias_maps
service postfix reload
Testing the Virtual Alias Settings
Enter a mail address that you have listed in your virtual_alias_maps file to test.
echo testing | /usr/sbin/sendmail test@myexample.com
Posted by mike Filed Under Installation with Comments Off
Aliases
It is important for Postfix to be able to use the alias file on the server (/etc/aliases). To ensure that it is in a format that Postfx can use run the newaliases command.
newaliases
or run this command
postalias
The alias file is created in a database that can be used both by Sendmail and Postfix. This has been done so that if you migrate from a Sendmail installation you will be able to move easily to Postfix and use the same aliases. The alias database is designated by the alias_maps parameter.
An important point to note is that the alias file is system dependent. That means that you will need to know the type of database that is used by the alias file as well as the location of the file. Postfix makes this easier for you by listing the options which are typical. Just uncomment the correct option. CentOS, Suse and RHEL will use the hash database and place it in /etc/aliases. The Postfix example is listed below.
#alias_maps = dbm:/etc/aliases
alias_maps = hash:/etc/aliases
#alias_maps = hash:/etc/aliases, nis:mail.aliases
#alias_maps = netinfo:/aliases
The alias_database parameter specifies the alias database that is built with the newaliaeses command. This configuration is separate from the alias_maps because the two may be different and alias_maps may be controlled by another program.
#alias_database = dbm:/etc/aliases
#alias_database = dbm:/etc/mail/aliases
alias_database = hash:/etc/aliases
#alias_database = hash:/etc/aliases, hash:/opt/majordomo/aliases
How an Alias is Used
When you create an alias you are converting mail from one user to another user account. This method may be used to create an alias for one user or for an email list.
Here is a look at a default /etc/aliases file: (Note this file may vary with distro but concepts are similar)
#
# Aliases in this file will NOT be expanded in the header from
# Mail, but WILL be visible over networks or from /bin/mail.
#
# >>>>>>>>>> The program "newaliases" must be run after
# >> NOTE >> this file is updated for any changes to
# >>>>>>>>>> show through to sendmail.
#
# Basic system aliases -- these MUST be present.
mailer-daemon: postmaster
postmaster: root
# General redirections for pseudo accounts.
bin: root
daemon: root
ad m: root
lp: root
sync: root
shutdown: root
halt: root
mail: root
news: root
uucp: root
operator: root
games: root
gopher: root
ftp: root
nobody: root
radiusd: root
nut: root
dbus: root
vcsa: root
canna: root
wnn: root
rpm: root
nscd: root
pcap: root
apache: root
webalizer: root
dovecot: root
fax: root
quagga: root
radvd: root
pvm: root
amanda: root
privoxy: root
ident: root
named: root
xfs: root
gdm: root
mailnull: root
postgres: root
sshd: root
smmsp: root
postfix: root
netdump: root
The alias file may contain several kinds of alias forms. Each form is followed by a colon.
Mary_Thompson: mary
The name Mary_Thompson was converted to the local user mary.
tech: mary,john,fred
Here by sending an email to tech it actually sends to three users who are involved in tech.
tech_users: :include: /usr/local/techlist
This email will convert to a list of users that was created in the techlist.
nobody: /dev/null
This email nobody will send all mail to trash.
edit: ¨|/usr/local/bin/edit¨
This email will actually send the email to interact with a program. Notice the pipe symbol which sends the email to the edit program.
Mike: mike@somewhereelse.com
This allows you to send mail send to mike@bigstrike.org to mike@somewherelese.com
Note that names are not case-sensitive.
Once you have edited this file you need to rebuild that alias database with this command:
newaliases
This tells the system and Postfix to rebuild the alias database.
Copyright CyberMontana Inc. and Postfixmail.com
All rights reserved. Cannot be reproduced without written permission. Box 1262 Trout Creek, MT 59874