Verifying LDAP configuration from command line ?
Dovecot version : 2.3.x - using RedHat build
Years ago I had a Dovecot install that was setup to perform certificate based authentication for clients that worked well - part of that setup was creating a passdb that pointed to a flat file that contained entries like this:
cool.joe.c:{PLAIN}::::::username=cooljc
and the passdb definition looked like this:
passdb { driver = passwd-file args = scheme=plain /etc/dovecot/users.external skip = authenticated mechanisms = EXTERNAL default_fields = uid=vmail gid=vmail nopassword=1 }
That worked and we had a cron job that would build that users.external file and keep it up to date.
Now, a few years down the road, I've setup a new Dovecot server that is working wonderfully but I'd like to add the same functionality but also use a direct LDAP query instead of managing a flat file to maintain the list of users.
I have another passdb entry that is using LDAP that works great for username/password auth, but I'd like to test what I think is a proper LDAP configuration specific for this passdb,
But for the life of me I can't find out how to test the configuration file without having to actually update my dovecot configuration to use it. I'm looking for something like the Postfix 'postmap' tool that I can provide my configuration file for the LDAP lookup, give a username input to and it will show me the results from the configuration, including the return values.
Is there such a tool ? Or do I have to setup a test server, add it to the config, and debug it ? Sorry if this is FAQ or dumb question - I've been reading documentation on the official Dovecot site looking for the answer but I'm either missing it or I'm reading the wrong docs.
On 05/06/2025 22:12, BuzzSaw Code via dovecot wrote:
But for the life of me I can't find out how to test the configuration file without having to actually update my dovecot configuration to use it. I'm looking for something like the Postfix 'postmap' tool that I can provide my configuration file for the LDAP lookup, give a username input to and it will show me the results from the configuration, including the return values.
Hi
not sure if it will work for your use case, but have you looked into "doveadm auth test" command?
I know it requires a password but not sure what happens if you don't need one.
There is a -o setting that can override configurations from your existing config.
John
Am 06.06.25 um 19:03 schrieb John Fawcett via dovecot:
On 05/06/2025 22:12, BuzzSaw Code via dovecot wrote:
But for the life of me I can't find out how to test the configuration file without having to actually update my dovecot configuration to use it. I'm looking for something like the Postfix 'postmap' tool that I can provide my configuration file for the LDAP lookup, give a username input to and it will show me the results from the configuration, including the return values.
Hi
not sure if it will work for your use case, but have you looked into "doveadm auth test" command?
I know it requires a password but not sure what happens if you don't need one.
There is a -o setting that can override configurations from your existing config.
John
doveadm user <username>
Will output all user infomration without the need for a password.
Ralf
-- Ralf Becker EGroupware GmbH [www.egroupware.org] Handelsregister HRB Kaiserslautern 3587 Geschäftsführer Birgit und Ralf Becker Leibnizstr. 17, 67663 Kaiserslautern, Germany Telefon +49 631 31657-0
participants (3)
-
BuzzSaw Code
-
John Fawcett
-
Ralf Becker