[Dovecot] help about quota config

fy fy at 5dshu.com
Wed Jul 25 12:18:24 EEST 2012


hi all :
mysql mailbox below :
CREATE TABLE `mailbox` (
  `username` varchar(255) NOT NULL DEFAULT '',
  `uid` varchar(255) NOT NULL DEFAULT '',
  `password` varchar(255) NOT NULL DEFAULT '',
  `clearpwd` varchar(128) NOT NULL DEFAULT '',
  `name` varchar(255) NOT NULL DEFAULT '',
  `mailhost` varchar(255) NOT NULL DEFAULT '',
  `maildir` varchar(255) NOT NULL DEFAULT '',
  `homedir` varchar(255) NOT NULL DEFAULT '',
  `quota` varchar(16) NOT NULL DEFAULT '0',
  `netdiskquota` varchar(16) NOT NULL DEFAULT '0',
  `domain` varchar(255) NOT NULL DEFAULT '',
  `uidnumber` int(6) NOT NULL DEFAULT '1000',
  `gidnumber` int(6) NOT NULL DEFAULT '1000',
  `createdate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `expiredate` date NOT NULL DEFAULT '0000-00-00',
  `active` smallint(1) NOT NULL DEFAULT '1',
  `disablepwdchange` smallint(1) DEFAULT NULL,
  `disablesmtpd` smallint(1) DEFAULT NULL,
  `disablesmtp` smallint(1) DEFAULT NULL,
  `disablewebmail` smallint(1) DEFAULT NULL,
  `disablenetdisk` smallint(1) DEFAULT NULL,
  `disableimap` smallint(1) DEFAULT NULL,
  `disablepop3` smallint(1) DEFAULT NULL,
  `question` text NOT NULL,
  `answer` text NOT NULL,
  PRIMARY KEY (`username`),
  KEY `username` (`username`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='ExtMail - Virtual Mailboxes' 

dovecot config below :
root at mail:/etc/dovecot# dovecot -n
# 1.2.15: /etc/dovecot/dovecot.conf
# OS: Linux 2.6.32-5-686 i686 Debian 6.0.5 ext3
log_path: /var/log/dovecot.log
log_timestamp: %Y-%m-%d %H:%M:%S 
protocols: imap imaps pop3 pop3s managesieve
listen(default): *
listen(imap): *
listen(pop3): *
listen(managesieve): *:2000
disable_plaintext_auth: no
login_dir: /var/run/dovecot/login
login_executable(default): /usr/lib/dovecot/imap-login
login_executable(imap): /usr/lib/dovecot/imap-login
login_executable(pop3): /usr/lib/dovecot/pop3-login
login_executable(managesieve): /usr/lib/dovecot/managesieve-login
mail_privileged_group: mail
mail_uid: vuser
mail_gid: vgroup
mail_location: maildir:/home/data/domains/%d/%n/Maildir
mail_debug: yes
mbox_write_locks: fcntl dotlock
mail_executable(default): /usr/lib/dovecot/imap
mail_executable(imap): /usr/lib/dovecot/imap
mail_executable(pop3): /usr/lib/dovecot/pop3
mail_executable(managesieve): /usr/lib/dovecot/managesieve
mail_plugins(default): quota
mail_plugins(imap): quota
mail_plugins(pop3): quota
mail_plugins(managesieve): 
mail_plugin_dir(default): /usr/lib/dovecot/modules/imap
mail_plugin_dir(imap): /usr/lib/dovecot/modules/imap
mail_plugin_dir(pop3): /usr/lib/dovecot/modules/pop3
mail_plugin_dir(managesieve): /usr/lib/dovecot/modules/managesieve
managesieve_logout_format(default): bytes=%i/%o
managesieve_logout_format(imap): bytes=%i/%o
managesieve_logout_format(pop3): bytes=%i/%o
managesieve_logout_format(managesieve): bytes(in=%i/out=%o)
lda:
  postmaster_address: fy at 5dshu.com
  mail_plugins: sieve quota
  mail_plugin_dir: /usr/lib/dovecot/modules/lda
  auth_socket_path: /var/run/dovecot/auth-master
auth default:
  mechanisms: plain login
  verbose: yes
  debug: yes
  passdb:
    driver: sql
    args: /etc/dovecot/dovecot-sql.conf
  socket:
    type: listen
    client:
      path: /var/spool/postfix/private/auth
      mode: 384
      user: postfix
      group: postfix
    master:
      path: /var/run/dovecot/auth-master
      mode: 384
      user: vuser
      group: vgroup
plugin:
  quota: dict:user::proxy::quota
  sieve_dir: /home/data/domains/%d/%n/sieve
  sieve: /home/data/domains/%d/%n/.dovecot.sieve
dict:
  quota: mysql:/etc/dovecot/dovecot-dict-sql.conf

/etc/dovecot/dovecot-dict-sql.conf  file :
connect = host=localhost dbname=extmail user=root password=bamwei 
map {
  pattern = priv/quota/storage
  table = mailbox
  username_field = username
  value_field =quota 
}
map {
  pattern = priv/quota/messages
  table = mailbox
  username_field = username
  value_field = uid
}
in the dovecot-sql.conf:
user_query= SELECT homedir AS home, maildir, uidnumber AS uid, gidnumber AS gid ,CONCAT(  '*:storage=', quota,  'B' ) AS quota_rule FROM mailbox WHERE username ='%u'
password_query= SELECT username,domain,password,homedir AS home, maildir, uidnumber AS uid, gidnumber AS gid, CONCAT(  '*:storage=', quota,  'B' ) AS userdb_quota_rule FROM mailbox WHERE username ='%u'

when is seting quota_rule=*:storage=10M:messages=1000  in plugin quote, all user get 10MB quota.
when i comment it .quota  no enable .
i see the  http://wiki1.dovecot.org/Quota/Dict ,but unknow to get Correct setup...thanks !



fy


More information about the dovecot mailing list