# HG changeset patch # User Pascal Volk # Date 1297034267 0 # Node ID d3a97f7fb98abb56c027ba0b796bca3abfaec631 # Parent ac5ac03b58da1898f4d8ce20f36cf2d3558ce0bc VMM/config: Added quota_bytes and quota_messages settings. Updated …/man5/vmm.cfg.5 and vmm.cfg. diff -r ac5ac03b58da -r d3a97f7fb98a VirtualMailManager/config.py --- a/VirtualMailManager/config.py Fri Feb 04 23:45:34 2011 +0000 +++ b/VirtualMailManager/config.py Sun Feb 06 23:17:47 2011 +0000 @@ -14,7 +14,7 @@ from cStringIO import StringIO from VirtualMailManager.common import VERSION_RE, \ - exec_ok, expand_path, get_unicode, lisdir, version_hex + exec_ok, expand_path, get_unicode, lisdir, size_in_bytes, version_hex from VirtualMailManager.constants import CONF_ERROR from VirtualMailManager.errors import ConfigError, VMMError from VirtualMailManager.maillocation import known_format @@ -347,6 +347,9 @@ check_version_format), 'password_scheme': LCO(str, 'CRAM-MD5', self.get, verify_scheme), + 'quota_bytes': LCO(str, '0', self.get_in_bytes, + check_size_value), + 'quota_messages': LCO(int, 0, self.getint), 'transport': LCO(str, 'dovecot:', self.get), }, } @@ -406,6 +409,11 @@ value to an int.""" return version_hex(self.get(section, option)) + def get_in_bytes(self, section, option): + """Converts the size value (e.g.: 1024k) from the *option*'s + value to a long""" + return size_in_bytes(self.get(section, option)) + def unicode(self, section, option): """Returns the value of the `option` from `section`, converted to Unicode.""" @@ -449,6 +457,11 @@ if not known_format(value): self._missing['mailbox'] = ['format: ' +\ _(u"Unsupported mailbox format: '%s'") % value] + # section misc + try: + value = self.dget('misc.quota_bytes') + except (ValueError, TypeError), err: + self._missing['misc'] = [u'quota_bytes: ' + str(err)] def is_dir(path): @@ -491,6 +504,18 @@ get_unicode(format)) +def check_size_value(value): + """Check if the size value *value* has the proper format, e.g.: 1024k. + Returns the validated value string if it has the expected format. + Otherwise a `ConfigValueError` will be raised.""" + try: + tmp = size_in_bytes(value) + except (TypeError, ValueError), err: + raise ConfigValueError(_(u"Not a valid size value: '%s'") % + get_unicode(value)) + return value + + def check_version_format(version_string): """Check if the *version_string* has the proper format, e.g.: '1.2.3'. Returns the validated version string if it has the expected format. diff -r ac5ac03b58da -r d3a97f7fb98a man/de/man5/vmm.cfg.5.rst --- a/man/de/man5/vmm.cfg.5.rst Fri Feb 04 23:45:34 2011 +0000 +++ b/man/de/man5/vmm.cfg.5.rst Sun Feb 06 23:17:47 2011 +0000 @@ -413,6 +413,24 @@ Passwort-Schemata zu erhalten, für Sie das Kommando **dovecotpw -l** (Dovecot v1.x) oder **doveadm pw -l** (Dovecot v2.0) aus. +.. _misc.quota_bytes: + +``quota_bytes (Vorgabe: 0)`` : *String* + Quota Limit in Bytes. 0 bedeutet unbegrenzt. Dieses Limit wird bei allen + neu angelegten Domains angewendet. + + Der Wert dieser Option kann als Integer-Wert, zum Beispiel **20480** + geschrieben werden. Es ist auch möglich dem Wert eines der folgenden + Suffixe anzuhängen: **b** (Bytes), **k** (Kilobytes), **M** (Megabytes) + oder **G** (Gigabytes). + **1024** entspricht **1024b** oder **1k**. + +.. _misc.quota_messages: + +``quota_messages (Vorgabe: 0)`` : *Int* + Quota Limit als Anzahl von Nachrichten. 0 bedeutet unbegrenzt. Dieses + Limit wird bei allen neu angelegten Domains angewendet. + .. _misc.transport: ``transport (Vorgabe: dovecot:)`` : *String* @@ -436,6 +454,8 @@ password_scheme = SHA512-CRYPT transport = dovecot: dovecot_version = 2.0.beta4 + quota_bytes = 100M + quota_messages = 10000 DATEIEN diff -r ac5ac03b58da -r d3a97f7fb98a man/man5/vmm.cfg.5.rst --- a/man/man5/vmm.cfg.5.rst Fri Feb 04 23:45:34 2011 +0000 +++ b/man/man5/vmm.cfg.5.rst Sun Feb 06 23:17:47 2011 +0000 @@ -394,6 +394,23 @@ execute the command **dovecotpw -l** (Dovecot v1.x) or **doveadm pw -l** (Dovecot v2.0). +.. _misc.quota_bytes: + +``quota_bytes (default: 0)`` : *String* + Quota limit in bytes. 0 means unlimited. This limit will be applied to + all newly created domains. + + The option's value can be written as an integer value, e.g.: **20480**. + Its also possible to append one of the following suffixes to the limit: + **b** (bytes), **k** (kilobytes), **M** (megabytes) or **G** (gigabytes). + **1024** is the same as **1024b** or **1k**. + +.. _misc.quota_messages: + +``quota_messages (default: 0)`` : *Int* + Quota limit in number of messages. 0 means unlimited. This limit will be + applied to all newly created domains. + .. _misc.transport: ``transport (default: dovecot:)`` : *String* @@ -417,6 +434,8 @@ password_scheme = SHA512-CRYPT transport = dovecot: dovecot_version = 2.0.beta4 + quota_bytes = 100M + quota_messages = 10000 FILES diff -r ac5ac03b58da -r d3a97f7fb98a vmm.cfg --- a/vmm.cfg Fri Feb 04 23:45:34 2011 +0000 +++ b/vmm.cfg Sun Feb 06 23:17:47 2011 +0000 @@ -6,8 +6,24 @@ # Database settings # [database] +; The Python PostgreSQL database adapter module to be used (String) +; Supported modules are: +; * psycopg2 +; * pyPgSQL +module = psycopg2 ; Hostname or IP address of the database server (String) host = localhost +; The TCP port, on which the database server is listening for connections (Int) +port = 5432 +; SSL mode for the database connection (String) +; Possible values are: +; * disabled +; * allow +; * prefer (default) +; * require +; * verify-ca (PostgreSQL >= 8.4) +; * verify-full (PostgreSQL >= 8.4) +sslmode = prefer ; Database user name (String) user = dbuser ; Database password (String) @@ -95,11 +111,27 @@ [misc] ; The base directory for all domains/accounts (String) base_directory = /srv/mail -; Password scheme to use (see also: dovecotpw -l) (String) -password_scheme = CRAM-MD5 -; default transport for domains and accounts (String) -transport = dovecot: +; Number of encryption rounds for the password_scheme BLF-CRYPT (Int) +crypt_blowfish_rounds = 5 +; Number of encryption rounds for the password_scheme SHA256-CRYPT (Int) +crypt_sha256_rounds = 5000 +; Number of encryption rounds for the password_scheme SHA512-CRYPT (Int) +crypt_sha512_rounds = 5000 ; the version number from `dovecot --version` (String) ; e.g. 1.1.18; 1.2.11; 2.0.beta4 dovecot_version = 1.2.11 +; Password scheme to use (see also: dovecotpw -l) (String) +password_scheme = CRAM-MD5 +; Quota limit in bytes. 0 means unlimited (String) +; The value can have one of the suffixes: +; * b: bytes +; * k: kilobytes +; * M: megabytes +; * G: gigabytes +; 1024 is the same as 1024b or 1k +quota_bytes = 0 +; Quota limit in number of messages. 0 means unlimited (Int) +quota_messages = 0 +; default transport for domains and accounts (String) +transport = dovecot: