Jonathan's Contribution

Linux Configuration

Henry's Virtual Mail Server


[Home] [Up][Prev][Next]

References

Do not leave home on this one without scouring the Sendail.org web site,  especially the complete sections on Configuration Information, and Vitrtual Hosting.   Presently we use V.8.9.3 of Sendmail.

What do we want to do

Mail virtual hosting here is not extensive. It receives and spools mail for the multiple domains, it is configured to receive from. On the sending mail side, it is incumbent on the smtp client to have a correctly configured email reply address.
 
Basic requirements are to accecpt all emails to novatek.co.nz and cmex.org, permitting an overlap of user names across both domain names (I believe the linuxconf solution does true virtual hosting). In our situation, a mail user on Henry can  receive mail for both domain names, addressed to the same user, unless this is explicitly configured otherwise in /etc/mail/virtusertable.
 
That is a mail user on Henry, say "userbob" for example, will receive mail for both userbob@novatek.co.nz and userbob@cmex.org. Appropriate entries in /etc/mail/virtusertable can direct userbob@novatek.co.nz and userbob@cmex.org to go to different email logins. However the two different logins cannot have the same name (obviously).
 
I believe solutions exist where multiple domains can be fully virtually hosted on the same hardware, including users and filesystems. I do not want to go there yet, the solution presented here is adequate for the needs of the network I managae.
 
In addition, the mail server on Henry is located behind a firewall, Gateway, and has its smtp traffic forwarded to it. All communications arriving from the external world, addressed to the domains novatek.co.nz and cmex.org do so on ip addresses 24.113.94.87 and 24.113.98.164 respectively. Gateway's DNS configuration, makes this magic possible. Gateway's Firewall and Port Forwarding then passes all smtp traffic from 24.113.94.87 and 24.113.98.164 to addresses 192.168.0.204 and 192.168.0.205 respectively. These 192.168.0.x addresses are ip aliased on Henry.
 
This organisation has the advantage of being able to separate out serving to separate boxes later without breaking too many things.
 
The capabilities of this approach is that it receives for multiple domains as set up in DNS MX records, and listed in /etc/mail/relay-domains. Sending of email requires the mail client to be configured with the correct client (novatek.co.nz or cmex.org) as these are the only names we are relaying.

Configuration

First lets do /etc/sendmail.mc
 
>>>>>>>>>>>>>/etc/sendmail.mc
dnl divert(-1)
dnl This is the macro config file used to generate the /etc/sendmail.cf
dnl file. If you modify thei file you will have to regenerate the
dnl /etc/sendmail.cf by running this macro config through the m4
dnl preprocessor:
dnl
dnl        m4 /etc/sendmail.mc > /etc/sendmail.cf
dnl
dnl You will need to have the sendmail-cf package installed for this to
dnl work.
include(`/usr/lib/sendmail-cf/m4/cf.m4')
define(`confDEF_USER_ID',``8:12'')
VERSIONID(`@(#)novatek.m4    8.10 (Novatek) July 25, 99')
OSTYPE(`linux')
undefine(`UUCP_RELAY')
undefine(`BITNET_RELAY')
define(`confAUTO_REBUILD')
define(`confTO_CONNECT', `1m')
define(`confTRY_NULL_MX_LIST',true)
define(`confDONT_PROBE_INTERFACES',true)
define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')
define(`confSMTP_LOGIN_MSG', `mail.$m spoken here; $b')
define(`confPRIVACY_FLAGS', `goaway')
FEATURE(`smrsh',`/usr/sbin/smrsh')
FEATURE(`virtusertable',`hash -o /etc/mail/virtusertable')
FEATURE(redirect)
FEATURE(always_add_domain)
FEATURE(use_cw_file)
FEATURE(local_procmail)
MAILER(procmail)
MAILER(smtp)
FEATURE(rbl)
FEATURE(`access_db')
FEATURE(`blacklist_recipients')
<<<<<<<<<<<<</etc/sendmail.mc
 
It is advised to go over the explaination of each option in the documentation. Especially note that we do not masquerade an address when relaying, we depend on the email client to supply the correct fully qualified email address (abc@cdef.com). Do not forget to:
m4 /etc/sendmail.mc > /etc/sendmail.cf
 
Next let sendmail know about the domains for which we are relaying.
>>>>>>>>>>>>/etc/mail/relay-domains
novatek.co.nz
cmex.org
<<<<<<<<<<<</etc/mail/relay-domains
 
The virtual user table should look something like:
>>>>>>>>>>>>/etc/mail/virtusertable
abc@novatek.co.nz               abc
def@novatek.co.nz               def
#. . . . . . 

@novatek.co.nz                  jon

abc@cmex.org                    abc
# . . . . .
@cmex.org                       jon
<<<<<<<<<<<</etc/mail/virtusertable
 
It is also worth noting what is in /etc/aliases:
 >>>>>>>>>>>>>>/etc/aliases
#
#       @(#)aliases     8.2 (Berkeley) 3/5/94
#
#  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
games:          root
ingres:         root
nobody:         root
system:         root
toor:           root
uucp:           root

# Well-known aliases.
manager:        root
dumper:         root
operator:       root

# trap decode to catch security attacks
decode:         root

# Person who should get root's mail
root:           jonathan

# added by hylafax
faxmaster:      root
<<<<<<<<<<<<<<?etc/aliases
 
Basically what is happening here, is that various email names are aliased to root, and root in turn is aliased to jonathan. To get the aliases to work, run newaliases.
 
With this configuration in place, restart sendmail:
/etc/rc.d/init.d/sendmail restart
 
To check that sendmail works configure some email clients on the same and other hosts to use this email server and attempt to send and recieve emails, experimenting with both domains.
 
Remember to add the new virtual domain names to /etc/sendmail.cw, and ensure FEATURE(use_cw_file) exists in /etc/sendmail.mc.
 

[Home] [Up][Prev][Next]

Last modified: Tue Feb 8 22:00:00 PST 2000
Copyright © Jonathan Marks, 1999, 2000. All rights reserved.
http://jon.novatek.co.nz/linux/config/henry-mail.html.