[Dovecot] Lda does not query pgsql

Tognini Samuele samuele at cli.di.unipi.it
Thu Feb 8 15:12:06 UTC 2007


Hi,
I don't know if it's a bug or my configuration fault, but LDA does not 
work as i expect.
Dovecot auth connects to a pgsql database that mirrors Nis users infos, 
but it has also quota settings  because i'd like to use a per-user quota 
environment.
Mailserver and Postfix authenticates users with Nis (through PAM), while 
imap and local delivery (with the postfix  mailbox_command setting) are 
left to dovecot mechanism.
Imap works perfectly,  dovecot retrieves authentication and quota 
setting from database, but dovecot LDA seems to not query any database 
(and nothing is logged) , so that quota is not retrived and message is 
not bounced when user is overquota.

You can see it in the verbose log:

deliver(tognini): 2007-02-08 12:25:02 Info: Loading modules from directory: /usr/lib/dovecot/modules/lda
deliver(tognini): 2007-02-08 12:25:02 Info: Module loaded: /usr/lib/dovecot/modules/lda/lib10_quota_plugin.so
deliver(tognini): 2007-02-08 12:25:02 Info: Module loaded: /usr/lib/dovecot/modules/lda/lib90_cmusieve_plugin.
so
deliver(tognini): 2007-02-08 12:25:02 Info: mbox: data=/home/t/tognini:INBOX=/var/spool/mail/tognini
deliver(tognini): 2007-02-08 12:25:02 Info: mbox: root=/home/t/tognini, index=/home/t/tognini, inbox=/var/spool/mail/tognini
deliver(tognini): 2007-02-08 12:25:02 Info: cmusieve: Using sieve path: /home/t/tognini/.dovecot.sieve
deliver(tognini): 2007-02-08 12:25:02 Info: msgid=<20070208112502.7706B3273D6 at arturo.cli.di.unipi.it>: saved mail to INBOX


If i set quota variable in dovecot.conf, still no query but the global 
variable is used for all users:

...
deliver(tognini): 2007-02-07 12:33:04 Info: dirsize quota limit = 1024kB
...


My Debian server packages are:

dovecot-common/unstable                1.0.rc22-1
postfix/testing                        2.3.6-1
postgresql/testing                     7.5.22


Dovecot.conf:

protocols = imap imaps
log_path = /var/log/dovecot.log
log_timestamp = "%Y-%m-%d %H:%M:%S "
login_greeting = Server ready.
mail_location = mbox:%h:INBOX=/var/spool/mail/%u
mail_extra_groups = mail
mail_debug = yes
mbox_read_locks = dotlock fcntl
mbox_write_locks = dotlock fcntl
protocol imap {
  mail_plugins = quota imap_quota
  imap_client_workarounds = outlook-idle tb-extra-mailbox-sep
}

auth_verbose = yes
auth_debug = yes
auth_debug_passwords = yes

auth default {
  user = root
  mechanisms = plain
  passdb sql {
    args = /etc/dovecot/dovecot-sql.conf
  }

  userdb sql {
    args = /etc/dovecot/dovecot-sql.conf
  }

  userdb prefetch {
  }

  socket listen {
     master {
       path = /var/run/dovecot/auth-master
       mode = 0600
       user = mail # User running Dovecot LDA
       group = mail # Or alternatively mode 0660 + LDA user in this group
     }
  }

}

protocol lda {
  postmaster_address = samuele at example.org
  mail_plugins = quota cmusieve
  log_path = /var/log/dovecot-deliver.log
  info_log_path = /var/log/dovecot-deliver.log
}

plugin {  
#quota = dirsize:storage=1024   # every user gets this quota, but it's not what i want.
}

Dovecot-sql.conf:

driver = pgsql
connect = host=192.168.1.2 dbname=dovecot user=myuser password='mypasswd'
default_pass_scheme = CRYPT
password_query = SELECT password, home as userdb_home, uid as userdb_uid, gid as userdb_gid, 'dirsize:storage='||quota as userdb_quota FROM user_accounts WHERE username = '%u' AND active = '1'
#user_query = SELECT home, uid, gid, quota FROM user_accounts WHERE username = '%u'
user_query = SELECT home, uid, gid, 'dirsize:storage=' || quota AS quota FROM user_accounts WHERE username = '%u'


Postfix main.cf:

...
mailbox_size_limit = 0
recipient_delimiter = +
mailbox_command = /usr/lib/dovecot/deliver
....

Postgresql table:

         Table "public.user_accounts"
  Column  |          Type          |          Modifiers
----------+------------------------+------------------------------
 username | character varying(12)  | not null
 uid      | integer                | not null
 gid      | integer                | not null
 password | character varying(32)  |
 home     | character varying(255) | not null
 active   | character(1)           | not null default 'Y'::bpchar
 quota    | integer                | not null default 512


Thanks in advance for any help or suggestion,
Samuele


More information about the dovecot mailing list