Postfix Redis Lookup Table Support
This is a patch for postfix 2.9.x MTA to support redis lookup table. This patch depends on @antirez hiredis client library.
Download the postfix source at http://www.postfix.org/download.html
Extract the file and switch to the source directory.
$ cp dict_redis.c src/global
$ cp dict_redis.h src/global
$ cp hiredis.h src/global
$ patch -p5 < Makefile.in.patch
$ patch -p5 < mail_dict.c.patch
To generate make files run make as follows
$ make makefiles CCARGS="-DHAS_REDIS -I/usr/local/include/hiredis" AUXLIBS="-L/usr/local/lib -lhiredis"
$ make
$ make install
You can clone the code at https://github.com/antirez/hiredis/
$ make
$ make install
Optionally you can also add the folder(/usr/local/lib - default hiredis install folder) to ld.so.conf if required, so that libhiredis.so is resolvable.
To test the lookup table you can postmap the string as follows
$ postmap -q "string" redis:/etc/postfix/lookup.cf
Contents of lookup.cfg:
host = localhost
port = 6379
The configuration file support two attributes, host and port. The default host is 127.0.0.1 and port is 6379.
Example:
host = redisdb.example.com
port = 6379
This project includes works from @antirez.
You can contact me at titus dot nitt at gmail dot com.