Incidentally, I did wind up answering my own question. All lua failures
   get logged to the maillog, so it was in fact something simple ****

   --------------------------------------------------------------------------

   From: Andy Baugh <[email protected]>
   Sent: Friday, July 18, 2025 3:31 PM
   To: [email protected] <[email protected]>
   Subject: Anyone have working examples of how one might go about
   *debugging* a userdb/passdb LUA script for authentication?

   Howdy,

   I've been working on upgrading the version cPanel ships to Dovecot 2.4.
   It appears that the "dict" driver for passdb/authdb has been removed per
   your documentation, with a recommendation to use a lua script instead.

   As such I've followed the online documentation to do so and wound up with
   a userdb/passdb section that looks like so:

   passdb cpauthd {
    driver = lua
    lua_file = /usr/local/cpanel/etc/dovecot/cpauthd.lua
    lua_settings {
        socket = /usr/local/cpanel/var/cpdoveauthd.sock
    }
    result_internalfail = continue
    result_failure = return-fail
   }

   userdb cpauthd {

    driver = lua

    lua_file = /usr/local/cpanel/etc/dovecot/cpauthd.lua

   }

   My prospective lua script only takes from the socket arg passed in and
   reads from the socket, delivering back the same kind of answer we would
   have previously got from the auth dict driver (converting
   password_key/user_key to auth_passdb/userdb_get_cache_key in script as
   appears to be suggested).

   Unfortunately, I'm thinking that this entire setup is being ignored, as
   when I do:

   doveadm -D -o auth_debug=yes auth lookup

   for a user I know to be valid on the system with the previous 2.3 setup, I
   don't even see any indication that the lua authentication database is even
   consulted.

   Jul 18 12:32:30 Debug: auth-master: passdb lookup([email protected]):
   Started passdb lookup
   Jul 18 12:32:30 Debug: auth-master: conn
   unix:/var/run/dovecot/auth-userdb: Connecting
   Jul 18 12:32:30 Debug: auth-master: conn unix:/var/run/dovecot/auth-userdb
   (pid=800187,uid=0): Client connected (fd=9)
   Jul 18 12:32:30 Debug: auth-master: conn unix:/var/run/dovecot/auth-userdb
   (pid=800187,uid=0): auth input:
   Jul 18 12:32:30 Error: auth-master: passdb lookup([email protected]):
   Auth PASS lookup failed
   Jul 18 12:32:30 Debug: auth-master: passdb lookup([email protected]):
   auth PASS input:
   Jul 18 12:32:30 Debug: auth-master: passdb lookup([email protected]):
   Passdb lookup failed
   Jul 18 12:32:30 Error: cmd auth lookup: passdb lookup failed for
   [email protected]
   Jul 18 12:32:30 Debug: auth-master: conn unix:/var/run/dovecot/auth-userdb
   (pid=800187,uid=0): Disconnected: Connection closed (fd=9)

   Similarly, in my lua script, I try to use the
   "dovecot.auth.log_debug/log_info" etc. functions in documentation within
   the scope of auth_passdb_lookup or auth_userdb_lookup, yet I never see any
   debug prints even if I add a debug line to the start of the function to
   indicate entry.

   What I would like to know is whether there is some debug flag I'm missing
   to see the routing from config -> lua script. Does this actually exist? I
   didn't see anything enlightening in the man pages or online documentation.
   Hopefully I'm just missing something simple.

   Cheers,
   --
   Thomas "Andy" Baugh | Software Development Engineer IV
   [email protected]
   [1]www.webpros.com

References

   Visible links
   1. http://www.webpros.com/
_______________________________________________
dovecot mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to