Skip to content

a16bitsysop/postfix_redis

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Now availible on Alpine linux

As the postfix-redis package, so it can be installed without compiling.

Postfix Redis

This is a patch to the postfix 3.4.3+ MTA to add a lookup table for redis database.

This patch depends on hiredis client library.

Apply the patch to a vanilla postfix 3.4.3+ source tree

Copy dict_redis.c and dict_redis.h files to the postfix/src/global directory.

Copy the postfix-redis.patch to the postfix folder and apply with patch -p2 -i postfix-redis.patch

Generate make files

$ make makefiles CCARGS="-DHAS_REDIS $(pkg-config --cflags hiredis)" AUXLIBS_REDIS="$(pkg-config --libs hiredis)" config_directory=/etc/postfix meta_directory=/etc/postfix daemon_directory=/usr/libexec/postfix shlib_directory=/usr/lib/postfix dynamicmaps=yes shared=yes

Compile postfix

$ make

Install postfix

$ make upgrade

Example postfix configuration

main.cf:

virtual_mailbox_domains = redis:/etc/postfix/redis-vdomains.cf
virtual_mailbox_maps = redis:/etc/postfix/redis-vmailbox-maps.cf
virtual_alias_maps = redis:/etc/postfix/redis-valias-maps.cf

Example .cf files

Defaults

host = 127.0.0.1
port = 6379
prefix = (none)

redis-vdomains.cf:

host = 127.0.0.1
port = 6379
prefix = VMD:

redis-vmailbox-maps.cf:

host = 127.0.0.1
port = 6379
prefix = VMM:

redis-redis-valias-maps.cf:

host = 127.0.0.1
port = 6379
prefix = VAM:

Example Redis keys and values:

1) "VMD:example.com" "example.com"
2) "VMM:[email protected]" "[email protected]"
3) "VAM:[email protected]" "[email protected]"

Testing Lookup

To test the lookup table you can postmap the string as follows, and monitor redis with redis-cli monitor.

$ postmap -q "[email protected]" redis:/etc/postfix/redis-valias-maps.cf

Creating Redis database

virtual_mailbox_domains

$ redis-cli set VMD:example.com example.com

virtual_mailbox_maps

virtual_alias_maps

About

Postfix Redis Lookup Table Support / Postfix Redis Map

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 73.2%
  • HTML 26.8%