Linux – How to test non-smtp ACLs in exim

access-control-listeximlinux

Exim provides the option to test your ACLs via CLI using exim -bh. However, this method opens an SMTP connection and you can only test SMTP ACLs. I wish to debug and test the acl_not_smtp ACL – is there any similar way of doing this?

Alternatively, if anybody knows why this does not work in acl_not_smtp:

deny
      message = Outgoing email is blocked for this domain. Please contact support for assistance.
      senders = /etc/exim_blacklist_users

That would be extremely helpful. This does work in acl_smtp_rcpt.

Best Answer

Exim does not have a testing mode for local the way that the -bh mode simulates an smtp connection. So you'll have to do it with a real message.

I would create a sample message with full headers and body, "sample.eml". Make it to an address that you control, a test mailbox or something. Make it from the address that you want it to reject. Pass the message to Exim using the simple commandline:

# No real output
exim -bm -t < "sample.eml"
# Get verbose output, but still not much
exim -v -bm -t < "sample.eml"
# Here's where we figure things out: debug
exim -d+all -bm -t < "sample.eml"

That last one will product a LOT of output, so maybe redirect it to a text file and view that file. Look to see how it's processing that non-smtp acl when it processes this message. You'll find the answer there. Or update the question with that debug output for that ACL and we'll refine our answer.

Another option would be to configure your app that is sending those messages to send using SMTP to 127.0.0.1 port 25, instead of passing a message to /usr/sbin/sendmail (which is the sendmail compatibility wrapper for exim). Then it would use the smtp rcpt acl.