Routers check out addresses to see if they can route them to the proper place. i.e. the routers job is to determine where it can route the address based on criteria of the router definition.
Routers are defined in the configuration file in the routers section. The router section starts with begin routers. The format can be quite simple because all router options, as other drivers, have defaults.
CREATED2016-11-28 15:26:59.0
00-26-DE
UPDATED2016-11-30 21:44:42.0
Return Codes...
When a router is run it executes the driver, applies the prerequisites and ends up with one of four conditions:
accept - The address is good, passed to the transport and all is well. Exim moves on to the next address.
defer - The router could not complete evaluating the prerequisites. For example a mishap in access to a file or a database. The messages delivery is then tried again at a later time or defered.
fail - the address is passed to the next router in line. For this reason routers need to be in a specific order... not true for other drivers.
pass - indicates that the router may have been able to handle the address but doesn't have the information to do so. The address is passed to the next router or the router identified with the pass_router option.
CREATED2016-11-28 15:36:29.0
00-26-DF
UPDATED2016-11-28 15:36:37.0
The Driver...
local_users: Driver = accept check_local_users transport = local_delivery
As stated before the driver is the most important option to any router becuase it indicates a section of Exim code to run. Without it the router definition is useless. This fact makes the driver option required.
A complete list of drivers in Exim:
accept - accepts everything, a catch all, use options to limit its acceptance.
dnslookup - uses DNS to retrieve MX records for MX processing.
ipliteral - accepts IP addresses instead of domains
manualroute - routes using domain list and other information
queryprogram - uses third party software to do its routing
redirect - redirects routing based on lookups and outside information
The driver option should appear as close to the top of the router definition as possible. In fact it should be the very first line. This is because some prerequisites may depend on the driver option in order to accept them.
Routers have two kinds of options. Options that are common to all routers... generic and options specific to each router... private.
Common or generic options, those that apply to all routers, can be broken into two major groups. Options that perform actions and options that provide prerequisites.
All options for routers... and other drivers... have defaults. Therefore, options only need to be specified if their value differs from the default.
This is a list of all common options for routers:
address_data
caseful_local_part
check_local_user
condition
debug_print
domains
driver
errors_to
expn
fail_verify
fail_verify_recipitent
fail_verify_sender
fallback_hosts
group
headers_add
headers_remove
ignore_target_hosts
initgroups
local_part_prefix
local_part_prefix_optional
local_part_suffix
local_part_suffix_optional
local_parts
more
pass_on_timeout
pass_router
redirect_router
require_files
self
senders
transport
transport_current_directory
transport_home_directory
unseen
user
verify
verify_only
verify_recipient
verify_sender
CREATED2016-11-28 16:42:45.0
00-26-E3
UPDATED2016-11-28 16:42:52.0
The More and Unseen Options...
more = false more = no
The more option kind of sits in a catagory all by itself. The more option determines if any more routers are to evaluate the address currently being considered. If a router has the more option set to true, the address being evaluate won't be passed to any other router... even if the current router declines the address.
Because the more option is boolean it may be defined in multiple ways. All of these definitions are the same:
CREATED2016-12-01 21:49:19.0
00-26-F7
UPDATED2016-12-02 01:00:23.0
Action Options...
Router options that perform actions can be divided into six groups:
Verify - Options that Verify a sender or recipient
Message - Options that modify the Message
Run - Options needed to run the transport.
Router - Options to direct the router.
Transport - Options that are passed to the transport.
Other - Options that don't fall in the above groups.
CREATED2016-12-01 01:54:30.0
00-26-EB
UPDATED2016-12-02 00:56:23.0
Verifying Options...
verify = false
When Exim receives a connection from a remote host it uses ACLs to verify the address. This process runs the address through several routers to determine if one will accept it. To turn this off on a specific router the verify option can be set.
CREATED2016-11-28 19:09:59.0
00-26-E4
UPDATED2016-12-02 00:55:25.0
Message Options...
headers_add = Comments: This message was at $primaryhostname... Comments: It was good.. headers_remove = Comments:Comments
Message options are options that modify the message. There are two:
Option
Type
Default
Description
headers_add
String
unset
adds a string to the messages header at routing time.
headers_remove
String
unset
a colon seperated list of header names to remove.
headers_add must conform to RFC 822 headers. The syntax is not checked by Exim.
The string parameter is the header to add.
The parameter for headers_remove is a colon seperated list of headers to remove with no trailing colon.
CREATED2016-12-01 02:21:40.0
00-26-EC
UPDATED2016-12-02 00:55:28.0
Run Options...
Run options are used to run the transport.
Option
Type
Default
Description
user
String
unset
The user to run the router/transport as.
group
String
unset
The group to run the router/transport as.
init_groups
Boolean
false
Adds secondary groups to the users id.
CREATED2016-12-01 02:25:52.0
00-26-ED
UPDATED2016-12-02 00:55:30.0
Router Options...
Router options determine what action to take when the router has an other than successful time of it.
Option
Type
Default
Description
pass_router
String
unset
identifies the next router to initiate in the event of a pass
redirect_router
String
unset
Starts the processing of child addresses with a specific router.
self
String
unset
What to do when routing a remote address points at localhost
When a routers status ends up being pass, pass_router indicates the next router to try. However, the next router definition can not be earlier in the configuration of routers.
Routers declared in the router declaration section are run each in turn. Sometimes it is a waste of recources to run through the routers from the top. The redirect router option allows the direction to be more to the point by not starting all over when an child address is generated from say an alias file. The redirect router option can be set to any declared router instance.
Some routers such as DNSLookup or IPLiteral generate a list of hosts to forward a message to. The self option is used when the generated list of hosts has localhost on the top of it. The self option can have these parameters:
defer - Delivery is tried at a later time.
reroute:[domain] - The domain is changed and the adress is rerun through the routers.
reroute:rewrite:[domain] - Same as rewrite:[domain] except headers are rewriten to reflect the new domain name.
pass - The address is passed to the next router or the router identified in the pass_router option.
CREATED2016-12-01 02:31:48.0
00-26-EE
UPDATED2016-12-02 00:55:32.0
Transport Options...
Each router that employes a transport and not all do, must identify the transport that will send the message with the transport option. If the router is sucessful and the condition is accept, the router passes the address off to its transport for delivery.
Option
Type
Default
Description
transport
String
unset
identifies the transport instance that will deliver the message.
transport_current_directory
String
unset
Sets current directory for the underlying local transport.
transport_home_directory
String
unset
Sets home directory for the underlying local transport.
The transport option is needed if the router intends to deliver a message... not all do. The value of the transport option must be a defined transport instance.
transport_home_directory and transport_current_directory set the indicated directories for the transport. If the transport indicates its own home and current directories those declarations override anything declared in the router.
CREATED2016-11-28 15:03:15.0
00-26-DD
UPDATED2016-12-02 00:55:36.0
Other Options...
Those options that do not fit into any other catagory... there are always a few of us...
Option
Type
Default
Description
caseful_local_part
Boolean
false
Treat the loacl part of an address in a caseful way?
ignore_target_hosts
HostList
unset
A list IP addresses to ignore like 127.0.0.1
errors_to
String
unset
Where to send errors when they occur.
debug_print
String
unset
A string to write to the log when debuggin.
Although Exim looks at the local part of an address in a case insensitive way... it does preserve case. The caseful_local_part option will cause Exim to treat local part of the address in a case sensitive way. This applies to the local part of the address only. The domain is always lowercase.
ignore_target_hosts is a hostlist but secretly contains a list of IP addresses. These are the addresses to... well... ignore. Mostly because they are worthless addresses e.g. 127.0.0.1.
The errors_to option is mainly for mailing lists. When a mailing list contains a bad address instead of creating bounce message the errors_to option identifies an address to send an error message to... like the list manager.
The debug_print options writes debugging information to the log. For example: the value of an address when a router starts... or... ends.
CREATED2016-12-01 02:32:20.0
00-26-EF
UPDATED2016-12-02 00:55:39.0
Prerequisite Options
Prerequisite options are options that are required for the router to accept the addres and route the message to a transport.
CREATED2016-12-02 00:58:01.0
00-26-F8
UPDATED2016-12-02 00:58:25.0
Local Parts...
Option
Type
Default
Description
check_local_user
boolean
false
Match the local part to a user on the system.
local_part_perfix
String
unset
Skip router if the local part does not begin with...
local_part_prefix_optional
Boolean
false
Should local_part_prefix test should be mandantory.
local_part_suffix
String
unset
Skipped if the local part does not end with the given string.
local_part_suffix_optional
Boolean
false
Should local_part_suffix test should be mandantory.
local_parts
String
unset
Restricts the router to given local parts.
CREATED2016-11-28 20:49:30.0
00-26-E5
UPDATED2016-12-02 01:07:44.0
Check Local Users...
check_local_user
The check_local_user option causes Exim to check the local part of an address to a local user on the system. If the local user does not exist the router declines.
check_local_user parses to a boolean value. Valid parameters are yes, no, true or false. Also no parameter:
will activate this prerequisite.
CREATED2016-12-02 01:03:40.0
00-26-F9
UPDATED2016-12-02 01:07:45.0
Require Files...
required_files = /path/to/file1:/path/to/file2
The require_files option checks for the existance of a file or files. The value is a string, a colon seperated list of files. If the value is empty it is ignored.
CREATED2016-12-02 01:07:52.0
00-26-FA
UPDATED2016-12-02 01:17:37.0
Condition...
The condition parameter is a more advanced form of precondition. The condition is a string or expression that should negatively evaluate to 0, false, no or and empty string, causing the router not to decline. A positive return would be 1, 0, yes, or true which would cause the router to run.
CREATED2016-12-02 02:08:39.0
00-26-FB
UPDATED2016-12-02 02:21:26.0
Domains...
domains = +local_domains
The domains option is a domain list, a colon seperated string of domain names (see Named Lists). When this option is used the router declines if the address domain is not in the list.