Thursday, March 6, 2008

What are some tools that I can use to troubleshoot mail delivery issues with Exim on my linux / BSD / unix server?

This article will highlight some of the utilities included with the standard exim installation that assist in troubleshooting mail delivery issues.

Exigrep

Exigrep is very useful when you need to search for specific strings in the exim logfile. The reason for this is that it will look for the search string you specify, match that to a message-ID, and then display all the lines pertaining to that message.

Usage: exigrep /path/to/exim/logfile

Examples:

root@cpdemo [~]# exigrep 1BbLM3-0007fA-0v /var/log/exim_mainlog2004-06-18 10:32:35 1BbLM3-0007fA-0v <= root@cpdemo.example.com U=root P=local S=1037

2004-06-18 10:32:37 1BbLM3-0007fA-0v => /dev/null R=system_aliases T=**bypassed**2004-06-18 10:32:37 1BbLM3-0007fA-0v Completed

Exiwhat

The 'exiwhat' command displays what each running exim process is doing at that given moment. This can be helpful in tracking down the cause for hanging exim processes or monitoring exim processes while they perform certain functions during testing.

Example

:root@cpdemo [~]# exiwhat

2118 daemon: -q1h, listening for SMTP on port 25 (IPv4)

2130 daemon: no queue runs, listening for SMTPS on port 465 (IPv4)

31640 handling incoming connection from [67.19.0.37]

Exim -bh

This section describes another usage of the exim mail server binary with special arguments that allow you to simulate a mail delivery from an external IP as the sender from the local server with the exim installation. This can be very useful when you need to recreate the mail delivery issue and you don't have access to the sender's machine to do so(ex. mail relaying, blacklists, etc.).

Usage: exim -bh

This will create a fake SMTP session which appears to be from . Not only that, but it also displays what exim is doing behind the scenes, and also what it would normally log. Now, bear in mind that this will not actually inject a message into the queue, nor will it actually log anything. This does however require knowledge of SMTP commands, but they are fairly easy. I have highlighted them in bold below for easier reading.

Example:

root@cpdemo [/var/spool/exim/input]# exim -bh 216.87.129.155

**** SMTP testing session as if from host 216.87.129.155

**** but without any ident (RFC 1413) callback.

**** This is not for real!

>>> host in host_lookup? no (option unset)

>>> host in host_reject_connection? no (option unset)

>>> host in sender_unqualified_hosts? no (option unset)

>>> host in recipient_unqualified_hosts? no (option unset)

>>> host in helo_verify_hosts? no (option unset)

>>> host in helo_try_verify_hosts? no (option unset)

>>> host in helo_accept_junk_hosts? yes (matched "*")

220-cpdemo.domain.com ESMTP Exim 4.34 #1 Fri, 18 Jun 2004 16:05:31 -0500

220-We do not authorize the use of this system to transport unsolicited,

220 and/or bulk e-mail.helo bbozo-2.example.com>>> bbozo-2.example.com in helo_lookup_domains? no (end of list)250 cpdemo.domain.com Hello bbozo-2.example.com [216.87.129.155]mail from: ken@bbozo-2.example.com

250 OK

No comments: