[Exim] Mail Hub - Check aliases but forward to another host

Top Page
Delete this message
Reply to this message
Author: Kevin W. Reed
Date:  
To: exim-users
Subject: [Exim] Mail Hub - Check aliases but forward to another host
Exim 3.3X

Is it possible to have mail for the default domain checked against an
aliases file, but still have it smarthosted elsewhere.

It appears that the only way I can check the systems aliases file is if
the address is local, but I don't want any local mail to be stored on the
machine, but rather smarthosted to another box.

If I setup the domain as non-local the smart hosting works, but there is
no way to check the aliases file.

Example.. for a server with the domain oldco.com, mail would arrive for

oncall-admin@??? the systems aliases file has an entry like:

oncall-admin: person@???

so the result would be mail bound for person@???, that would be sent
on to the smarthost for the oldco.com domain.

I've done something like this with Virtual hosts, but any resulting local
addresses were stored on the same box. In this configuration no mail is
stored on the box for users, their mailboxes are elsewhere.

We have a lot of boxes in a firewall that send out email without knowing
who the current person to contact is. The mail hub's aliases file is
updated daily with the current contact for certain functions.

With the exception of the aliases file checking all other mail routing
works the way it needs to now with the following configuration.

Note that there are no virtual hosts on this host now. I am not using the
domain as a local host since it would not be processed by the domainlist
to smart host those users to the exchange server.

Configure Info...

######################################################################
#                    MAIN CONFIGURATION SETTINGS                     #
######################################################################


primary_hostname = mailhub.oldco.com
qualify_domain = oldco.com
# NOTE no virtual hosts are setup on this machine so local_domains =
local_domains = partial-lsearch;/usr/local/exim/DOMAINS
forbid_domain_literals
trusted_users = root
log_all_parents
log_file_path = /var/log/exim/%s.log
log_received_recipients
log_refused_recipients
log_received_sender
log_smtp_confirmation
ignore_errmsg_errors_after = 2d
timeout_frozen_after = 5d


######################################################################
#                      TRANSPORTS CONFIGURATION                      #
######################################################################


remote_smtp:
    driver = smtp


local_delivery:
    driver = appendfile
    file = /var/mail/$local_part
    delivery_date_add
    envelope_to_add
    return_path_add
#    group = mail
    mode = 0600
    mode_fail_narrower = false


address_pipe:
    driver = pipe
    return_output
    user = exim
    use_shell = true


address_file:
    driver = appendfile
    delivery_date_add
    envelope_to_add
    return_path_add


address_reply:
    driver = autoreply



######################################################################
#                      DIRECTORS CONFIGURATION                       #
######################################################################


#No virtual domains so this is not used at this time.
virtual_aliases:
        driver = aliasfile
        domains = "partial-lsearch;/usr/local/exim/DOMAINS"
        file_transport = address_file
        pipe_transport = address_pipe
        file = /usr/local/exim/vdomain/${domain_data}
        search_type = "lsearch*"


system_aliases:
    domains = oldco.com
    driver = aliasfile
    file = /etc/aliases
    search_type = lsearch
    user = exim
    group = mail
#     return_fail_output = false
    file_transport = address_file
    pipe_transport = address_pipe


userforward:
    domains = oldco.com
    driver = forwardfile
    file = .forward
    no_verify
    no_expn
    check_ancestor
#    filter
    file_transport = address_file
    pipe_transport = address_pipe
    reply_transport = address_reply


localuser:
    domains = oldco.com
    driver = localuser
    transport = local_delivery


# Tried to do something like below so that if
# local_domain = oldco.com
# it would forward to remote_smtp......
#
#localuser:
#    domains = oldco.com
#    driver = smtp
#    transport = remote_smtp
#
# which of course didn't work.



######################################################################
#                      ROUTERS CONFIGURATION                         #
######################################################################


#Catch various different hostname combinations and their specific
#delivery locations. See below for what is in Routes...

checkfor_special:
     driver = domainlist
    transport = remote_smtp
    route_file = /usr/local/exim/Routes
    search_type = partial-lsearch


# if it doesn't match and of the above, then smart host the rest
# to the outside mail server.

smart_route:
    driver = domainlist
    transport = remote_smtp
    route_list = * mailhost.newco.com  bydns_mx


# I don't think this ever gets here now
lookuphost:
    driver = lookuphost
    transport = remote_smtp
    ignore_target_hosts = 127.0.0.0/8



######################################################################

The /usr/local/exim/Routes file contains:

# Match specific hosts for routing to processing server

attfax.oldco.com:    processor.oldco.com      bydns_a
atttelex.oldco.com:    processor.oldco.com      bydns_a
vsifax.oldco.com:    processor.oldco.com      bydns_a
skytel.oldco.com:    processor.oldco.com      bydns_a
pagenet.oldco.com:    processor.oldco.com      bydns_a
attinvf.oldco.com:    processor.oldco.com      bydns_a
attinvt.oldco.com:    processor.oldco.com      bydns_a


# Route any mail for any other user@??? to that
# unix host via A record

*.oldco.com:        $domain            bydns_a


# Catch any username@??? and send it to the exchange server

oldco.com:        inboundmail.oldco.com    byname


--
Kevin