ldap_auth.pl for qmail

ldap_auth.pl is a Perl program that is a substitute for Dan Bernstein's checkpassword. It uses the same error codes and interface as checkpassword. But, it authenticates against an LDAP server with options specified within the program.

Why? qmail-LDAP is a very robust qmail+LDAP installation. It's a lot more than I needed. I just wanted to authenticate people to an already existing LDAP server. I didn't want to interact with LDAP in any other way. qmail-LDAP isn't made for that. So, I wrote this simple program that does one thing, authenticates against an LDAP server.

I put in a ton of comments so it should be clear how it works.

Email me


Instructions

After downloading, untar it and put it in /var/qmail/bin.

Set its permissions to 755 (chmod 755 ldap_auth.pl).
Set ownership to root:qmail (chown root:qmail ldap_auth.pl).

Modify your /var/qmail/supervise/qmail-smtpd/run file like so:

Before:

exec /usr/local/bin/softlimit -m 16700000 \
   /usr/local/bin/tcpserver -v -R -l "$LOCAL" -x /etc/tcp.smtp.cdb \
   -c "$MAXSMTPD" -u "$QMAILDUID" -g "$NOFILESGID" 0 smtp \
   /usr/local/bin/rblsmtpd -rsbl-xbl.spamhaus.org \
   /var/qmail/bin/qmail-smtpd 2>&1

After:

exec /usr/local/bin/softlimit -m 16700000 \
   /usr/local/bin/tcpserver -v -R -l "$LOCAL" -x /etc/tcp.smtp.cdb \
   -c "$MAXSMTPD" -u "$QMAILDUID" -g "$NOFILESGID" 0 smtp \
   /usr/local/bin/rblsmtpd -rsbl-xbl.spamhaus.org \
   /var/qmail/bin/qmail-smtpd \
   /var/qmail/bin/ldap_auth.pl /bin/true 2>&1

The above is just an example. rblsmtpd is not related to this program. The relevant part is the last two lines.

Download ldap_auth.pl for qmail

000webhost logo