On 2014-10-29 at 10:39 -0400, alan@??? wrote:
> I postulate a Linux box, with exim, and with three users,
> alan, ben, and charles. Let us suppose the name of this
> machine is abc.greatbox. Let us also suppose that Alan,
> Ben, and Charles have hired a professional mailserver,
> him.com, to act as a smart host, or relay host.
>
> I want to know how to configure exim to behave as follows:
> if either Alan or Ben or Charles sends mail to simply
> alan, or ben, or charles, or root, exim will simply pass
> that E-mail on to the addressee. If mail is sent to
> 'root', the /etc/aliases file will be used to pass the
> mail on to whichever of alan, ben, or charles is the
> sysadmin. If mail is sent to sophronia, or zephyr,
> an error message will be returned: No such person on
> this machine.
>
> On the other hand, as soon as a '@' is detected. e.g.
> mail to be sent to obama@???, or wherever
> else, a diffent part(router?) takes charge, and
> the mail is passed on up to the mailserver, him.com,
> as coming from alan@???, or ben@???, or
> charles@???, as the case may be.
>
> Can some expert take the time to describe _exactly_ how to
> do this? Which files, in which of the six directories
> acl/ auth/ main/ retry/ rewrite/ router/ transport/
> would have to be changed, and how? I would hope for
> exact prescription of the syntax; for example, is
> foo:bar the same as foo : bar ?
Those directories are not part of Exim's configuration; your OS is using
some kind of configuration build system, not supplied by Exim. I can
tell you what needs to end up in the configuration file.
I can also note that Exim ships with one configuration file, which is
extensively commented and which I think would make it very clear to you
which settings need to be changed. It might be that you have a copy of
this configuration file somewhere (/usr/share/doc/exim4/ ?) and that
there's a platform README which will tell you where you might place this
file to be used to override whatever management system is being used.
So with the caveat that I'm working blind, without access to whatever
your setup is, then:
In the "main" section of the configuration:
# define only hostnames for this box to be locally handled via the
# conventional domainlist used for marking such things:
domainlist local_domains = @
# (that _should_ be the default value; but since I don't know what's
# been done with your configuration, I'm calling it out)
# set the default qualify domain to go on addresses without an @:
qualify_domain = him.com
# but state that the default _recipient_ domain is the main address
# for this box
qualify_recipient = $primary_hostname
The default transports should be fine, and you shouldn't need to touch
acl, auth, retry or rewrite.
In Exim, addresses are handled by trying routers in turn. The default
configuration file provides exactly this commented-out example:
# smarthost:
# driver = manualroute
# domains = ! +local_domains
# transport = remote_smtp
# route_data = MAIL.HOSTNAME.FOR.CENTRAL.SERVER.EXAMPLE
# ignore_target_hosts = <; 0.0.0.0 ; 127.0.0.0/8 ; ::1
# no_more
You want to use that, using route_data to point to your smarthost. The
`domains = ! +local_domains` means that this does not apply for
hostnames matching the local_domains domainlist, which you've set to a
shorthand for hostnames for IP addresses on this box. The `no_more`
means that for domains handled by this router, if the router then
declines the address, don't try any later routers.
So non-local recipient addresses won't try any later routers and will
stop with just this first one.
You then want just the standard /etc/aliases `system_aliases` router
supplied in the default configuration, followed by just the `localuser`
router supplied in the default configuration. It's up to you to make
sure that /etc/aliases _only_ has an entry for root (but I recommend
also including entries for postmaster and mailer-daemon, even though
that's not what you specified in your mail).
Those are the only three routers you want/need. You can comment out the
others (direct DNS lookup, user forward files) and should uncomment the
smarthost alternative, but really what you're asking for here is exactly
handled with the defaults which the Exim Maintainers ship with Exim.
If you want to get _fancy_, you can keep the dnslookup router but put
`verify_only` on it, and put `no_verify` on the smarthost router, so
that you won't even try sending to the smarthost anything for a
recipient which doesn't exist in DNS, which might result in less
backscatter and faster bounces from your own system.
I strongly recommend reading, as a bare minimum:
Chapter 3 - How Exim receives and delivers mail
http://www.exim.org/exim-html-current/doc/html/spec_html/ch-how_exim_receives_and_delivers_mail.html
Chapter 7 - The default configuration file
http://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_default_configuration_file.html
You can skim a bunch of chapter 7, but it will walk you through, in more
detail, the routers referenced above.