[exim] Data gathering in Exim using Readsocket and socat

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Marc Perkel
Date:  
À: exim users
Sujet: [exim] Data gathering in Exim using Readsocket and socat
Just want to share a trick I'm using with you all to gather data for
black/white lists and such. This is direct simple, works, and doesn't
require scanning and parsing logs files. It uses the Exim readsocket
command to send one line messages to a server that collects these one
line messages into a text file that is then processed with whatever
scripts you want to run.

First - on the Exim side:

set acl_c_socket = ${readsocket{inet:1.2.3.4:567}{black
$sender_host_address\n}{2s}{}{}}

This send the message "black" followed by the IP address to server
1.2.3.4 on port 567

now - on the receiving side:

socat -u TCP4-LISTEN:567,reuseaddr,fork OPEN:/tmp/karma.log,creat,append&

This will receive messages from multiple servers. What I do then is
gather up the files once a minute and process them into my black lists.
It works well for me and I'm sure a lot of you will find it interesting
and useful.