Igor Stroh wrote:
> Hi there,
> 
> I'm trying to set up qmail (with qmail-ldap patch) with dbmail.
> I installed dbmail2-pgsql-ldap from http://debian.nfgd.net/debian
> (Had to recompile it though, since qmail-smtpd segfaultet
> every time it was called).
> Now if I understood it correctly, the ldap support in dbmail
> allows it to have users in LDAP and their corresponding
> mailboxes in a RDBMS. The authentication works pretty smooth:
> the imap login works as desired - but only if I add a user to
> dbmail_users with a user_idnr = [value of uidNumber attr in LDAP].
> Is that the way it's supposed to work (that's how it's usually
> done in qmail-ldap and courier-ldap)?

Shadow users are created in the db table if and when required; inserting a
message for a user will create a shadow entry in the dbmail_users table, and
create an entry in the mailboxes table before injecting the message.

If you have an existing userbase in sql you will have to make sure the user_idnr
values correspond to the values in uidNumber, just like you discovered.

So your basic test is: add a dbmailUser to your ldap instance, it should show up
with dbmail-users -l foobar. Next try injecting mail for that user using
dbmail-smtp -u foobar. Now you should have a new record in dbmail_users.


> 
> Alas, injecting incoming mail does not work. In order to tell
> qmail to forward incoming mail to dbmail-smtp I altered my run
> script for qmail-send as following:
> 
> ---------[/service/qmail-send/run]------------------------------
> #!/bin/sh
> exec 2>&1
> exec env - PATH="/var/qmail/bin:$PATH" \
>     /var/qmail/bin/qmail-start "| /usr/local/bin/dbmail_wrapper"
> ----------------------------------------------------------------
> 
> where /usr/local/bin/dbmail_wrapper is a simple script that just calls
> dbmail-smtpd:
> 
> ---------[/usr/local/bin/dbmail_wrapper]------------------------
> #!/bin/sh
> LOGGER="/usr/bin/logger"
> INJECTOR="/usr/sbin/dbmail-smtp"
> 
> do_log() {
>     $LOGGER -i -p mail.info -t DBMAIL_WRAPPER $1
> }
> 
> # USER is supplied by qmail environment, same as uid attribute in
> # corresponding ldap record
> do_log "running $INJECTOR for $USER"
> $INJECTOR -d $USER
> ----------------------------------------------------------------
> 
> Looking at the log output of dbmail I see this:
> 
> -----------------------------------------------------------------------
> Jul 23 00:28:43 belphegor DBMAIL_WRAPPER[19787]: running
> /usr/sbin/dbmail-smtp for foobar
> [...]
> Jul 23 00:28:44 belphegor dbmail/smtp[19788]: db.c,db_user_find_create:
> found username for user_idnr [999 -> foobar
> 
> Jul 23 00:28:44 belphegor dbmail/smtp[19788]: dbpgsql.c,db_query:
> executing query [SELECT user_idnr FROM dbmail_users WHERE userid='foobar']
> 
> Jul 23 00:28:44 belphegor dbmail/smtp[19788]: dbpgsql.c, db_query: Error
> executing query [SELECT user_idnr FROM dbmail_users WHERE userid='foobar']
> : [ERROR:  current transaction is aborted, commands ignored until end of
> transaction block ]
> 
> Jul 23 00:28:44 belphegor dbmail/smtp[19788]: db.c,db_user_exists: could
> not select user information
> 
> Jul 23 00:28:44 belphegor dbmail/smtp[19788]: db.c,db_find_create_mailbox:
> unable to find or create sql shadow account for useridnr [999]
> [...]
> -----------------------------------------------------------------------
> 
> 
> It looks like dbmail expects to find the user info in the SQL db, although
> it already got this info from LDAP.
> 
> What exactly do I have to add to my postgres DB for each user in order to
> be able to inject mails?
> 
> TIA,
> Igor
> 
> [0]:
> _______________________________________________
> Dbmail mailing list
> Dbmail@dbmail.org
> https://mailman.fastxs.nl/mailman/listinfo/dbmail
> 


-- 
  ________________________________________________________________
  Paul Stevens                                  mailto:[EMAIL PROTECTED]
  NET FACILITIES GROUP                     PGP: finger [EMAIL PROTECTED]
  The Netherlands________________________________http://www.nfg.nl

Reply via email to