I figured out how to get Sendmail to use Postgres to read ALL of it configuration information.
Here is how I did it:
It is also configured to support Milters, TLS, SASL authentication (via Postgres of course)
and supports not having user accounts on the machine.
Original patches are from Blue Lab's. I tried to contact them about bug fixes and
minor changes to support the local-host-names file, but never heard back.
For more information on Blue Lab's visit their web site: http://blue-labs.org/software/sm-pgsql/
1) SASL support via cyrus-sasl version 2.x
./configure --with-pgsql --enable-sql --enable-login
sql_statement: SELECT [password_field] FROM [table_name] WHERE [domain_field]='%r' and [username_field] ='%u'
2) Database - Postgres
You will need to enable plpgsql on the database you are using for the sendmail configuration data:
createlang -U postgres plpgsql [db_name]
Load the table:
psql [db_name] < schema.txt
This file doesn't have any user restrictions setup.
Please review and make security changes as needed.
This patch was build using sendmail 8.13.2. This is the Blue Labs patch with a few changes:
1) Bug fix in the pgsql_map_lookup code (off by one buffer over run fix)
2) Added support for query results larger than MAXNAME for local-host-names support
3) Escapes input string because it is user data
4) Bug fix in the pgsql_map_lookup code (memory leak)
From within the sendmail directory (email if you are interested in the patch):
patch -p0 < bjf.patch
Edit your devtools/Site/site.config.m4 file and add the needed lines from pgsql-build.mc file.
Generate your sendmail.cf file and add the needed lines from pgsql-config.mc file.
Add/Edit/Removing information from the database will update sendmail immediately,
but if you Add/Edit/Remove anything from the hostnamestable you will need to HUP or restart sendmail.
This is the only table that is loaded at start up and is static, everything else is dynamic (on the fly) lookups.