Documentation

Plugins

Client libraries

Publishing

FAQs


Karmasphere Plugin for Exim

Configuration

Once you have karmad installed and configured, the following exim configuration will connect Exim to karmad. Karmad in turn connects to Karmasphere and performs the query.

This is version 1.1 of this document, dated 20070713.

karma_rcpt_acl:

    # Check envelope sender

    warn     set acl_m9  = ${readsocket{/tmp/karmad}\
                           {ip=$sender_host_address\nhelo=$sender_helo_name\
                           \nsender=$sender_address\n\n}{20s}{\n}{socket failure}} 

    # Continue quietly on socket error
	# We could replace 'accept' here with 'defer'

    accept   condition   = ${if eq{$acl_m9}{socket failure}{yes}{no}}
             message     = Cannot connect to karmad

    # Prepare answer and get results

    warn     set acl_m9  = ${sg{$acl_m9}{\N=(.*)\n\N}{=\"\$1\" }}
             set acl_m8  = ${extract{value}{$acl_m9}{$value}{unknown}}
             set acl_m7  = ${extract{data}{$acl_m9}{$value}{}}

    # Check for fail

#    deny     condition   = ${if eq{$acl_m8}{bad}{yes}{no}}
#             message     = $acl_m8: $acl_m7
#             log_message = Considered 'bad' by Karma

    warn     message     = X-Karma: $acl_m8: $acl_m7

    accept
You will also need to make sure this ACL is checked by the acl_smtp_rcpt ACL in exim:
# This line (or something similar) is probably in your exim configuration
# already.
acl_smtp_rcpt = acl_check_rcpt

# ...

acl_check_rcpt:
    accept hosts = :
	# ...

	# You need to add this line at the appropriate point in the ACL called
	# by acl_smtp_rcpt. 
	deny !acl = karma_rcpt_acl

Usage

Start karmad
karmad --feedset=karmasphere.email-sender-ip --username=<username> --password=<password> --socketuser=mail

Troubleshooting

If you are experiencing problems, there are a number of possible reasons for your mail not being checked by karmasphere:

If none of that helps, you can use exim interactively to debug your configuration. Running a sample SMTP session over stdin/stdout can be very helpful here.

# exim -bhc 10.0.0.2
...
HELO smtp.example.com
...

This can result in a lot of debugging information on stdout and stderr, so you may want to redirect them to a file for later analysis.