SASL and LDAP backend for mail/xmpp
retained text
This morning I was debugging some auth-related issue on my XMPP server, and at some point i went off in a side quest on understanding SASL and its interactions with LDAP. TLDR, that lead to one question: Why can't services that use SASL for login (such as imap, smtp, xmpp...) act as a sort of proxy between the end user and the LDAP server (that usually implement SASL auth) I'll try to detail a bit my process of thoughts: A common way to manage centralized authentication is to use LDAP. I want to connect this central authentication to my imap/smtp/jabber server so users can use the same passwords as on every other services. AFAIK there are only 2 approaches to do this: First one, the imap/smtp/jabber have a service account on the LDAP, and it is allowed to get the hashed (sometimes plaintext) passwords of the users. Then, it can perform a SASL non-plain mechanism like DIGEST-MD5 or SCRAM-SHA-\*. The second one doesn't require a service account, and do a simple bind on the LDAP server using the password provided by the user. However this require the PLAIN mechanism, as the imap/smtp/jabber service need the plaintext password to send it to the server. 1st approach means that my imap/smtp/jabber server have a LDAP account that can access hashed passwords, which isn't ideal. The 2nd one means that the password transits plaintext (usually in tls tunnels, so it's not that big of a deal, but still SCRAM-SHA-\* mechs have been created to avoid this) Dumb me look at that problem and see a 3rd approach: My LDAP server already implement SASL auth (as most of them do afaik). The imap/smtp/jabber service can advertises the non-plain SASL mechanism to the clients. When a client try to connect with one of those mechanism, it forwards the messages to the LDAP Server, delegating the SASL process to the ldap server. That way, the plaintext password never leave the client device, and the hashes never leave the LDAP server. But I must be missing something, because I haven't seen any implementation that do something like this. I tried to figure out why for a couple hours now and i can't understand why.
document fetched 2026-10-29 00:39 · canonical https://reddit.com/r/sysadmin/comments/1xhon4v/sasl_and_ldap_backend_for_mailxmpp