Sendmail MTA (Mail Transfer Agent) has support for different kinds of database maps (e.g. LDAP, Berkeley DB). It also supports socketmap "databases" that use a simple socketmap protocol. In other words, we can freely create our own custom programs that:

Socketmaps can provide:

or indeed any custom databases you might have in your sendmail.cf configuration. The communication between Sendmail and programs providing socketmap databases happens using a Netstring based protocol.

We can implement almost any kind of logic for key-value lookups in our programs.

LDAP Socketmap Daemon

I had to write ldapsockmapd because the existing alternatives could not handle my needs. ldapsockmapd serves as a kind of a proxy to an LDAP service provided by OpenLDAP servers.

So ldapsockmapd stands for words "LDAP Socketmap Daemon". It is a real-world program that can serve as an example of a Unix daemon providing socketmap service. ldapsockmapd source code is available for you to study, use and modify as free software under GNU GPLv2 license.

You can download ldapsockmapd-1.0.1.tar.xz.

This program has been tested on Red Hat Enterprise Linux 7 and it also contains its own custom Security-Enhanced Linux policy module. I run ldapsockmapd confined in an ldapsockmapd_t SELinux security domain.

I do not want to duplicate program documentation here. After unpacking the tar.xz archive, please read:

Sendmail configuration

Unfortunately the classic Sendmail O'Reilly "Batbook" (4th edition), as great as it is, contains very little information about the socketmaps. I use ldapsockmapd for providing Sendmail's aliasesdb database. For that purpose, my /etc/mail/sendmail.mc has the following m4 configuration line:

define(`ALIAS_FILE', `socket: inet:9999@')dnl


It is very unlikely that ldapsockmapd would be useful to you as it is. But I hope its source code could serve as an example of how to:

If you find any bugs, or have ideas for enhancements, please send me email. Have fun!

Kalevi Kolttonen <kalevi@kolttonen.fi>
Helsinki, Finland
March 8th, 2019