Herramientas de usuario

Herramientas del sitio


es:squeeze:email:imap:dovecot_quota

P�gina desactualizada Esta p�gina contiene una versi�n anterior de esta gu�a que puede estar desactualizada. Para ver la versi�n m�s reciente, haga clic aqu�.

5.1.2 Quotas

Objetivo

Establecer un límite a la capacidad de almacenamiento de e-mails en el servidor IMAP.

A partir de las especificaciones de nuestro servidor, el sistema de cuotas será implementado teniendo el cuenta lo siguiente: # 1. Como nuestro servidor sólo dispone del protocolo imap, 1. sólo debe activarse el sistema de cuotas asociado a este protocolo. Sin embargo, dovecot también soporta cuotas en el protocolo pop3. # 2. El límite de la cuota tendrá como base el espacio disponible en el disco. Sin embargo, el sistema de cuotas de dovecot 2. acepta como límites una cantidad de mensajes. # 3. La limitación se aplica a todos los usuarios por igual, aunque dovecot soporta la definición de cuotas por usuario.

Configuración

El sistema de cuotas en dovecot se realiza con plugins. Basta con activar esos plugins y configurar sus opciones.

Son necesarios 2 plugins: # quota: 1. se encarga de todo el sistema de gestión de cuotas; # imap_quota: 2. reporta información sobre las cuotas, usando el protocolo imap.

Toda la configuración se efectúa en el archivo de configuración/etc/dovecot/dovecot.conf:

/etc/dovecot/dovecot.conf
# [...]

##
## IMAP specific settings
##

protocol imap {
  # Login executable location.
  #login_executable = /usr/lib/dovecot/imap-login

  # IMAP executable location. Changing this allows you to execute other
  # binaries before the imap process is executed.
  #
  # This would write rawlogs into user's ~/dovecot.rawlog/, if it exists:
  #   mail_executable = /usr/lib/dovecot/rawlog /usr/lib/dovecot/imap
  # </usr/doc/dovecot-common/wiki/Debugging.Rawlog.txt>
  #
  # This would attach gdb into the imap process and write backtraces into
  # /tmp/gdbhelper.* files:
  #   mail_executable = /usr/lib/dovecot/gdbhelper /usr/lib/dovecot/imap
  #
  #mail_executable = /usr/lib/dovecot/imap

  # Maximum IMAP command line length in bytes. Some clients generate very long
  # command lines with huge mailboxes, so you may need to raise this if you get
  # "Too long argument" or "IMAP command line too large" errors often.
  #imap_max_line_length = 65536

  # Maximum number of IMAP connections allowed for a user from each IP address.
  # NOTE: The username is compared case-sensitively.
  #mail_max_userip_connections = 10

  # Support for dynamically loadable plugins. mail_plugins is a space separated
  # list of plugins to load.
  #mail_plugins =

  mail_plugins = quota imap_quota

  #mail_plugin_dir = /usr/lib/dovecot/modules/imap

# [...]

En seguida, debe definirse el tipo y los valores de la cuota. En este ejemplo es impuesto un límite de 20 Mb de almacenamiento en el maildir de cada usuario.

La configuración también está almacenada en /etc/dovecot/dovecot.conf.

/etc/dovecot/dovecot.conf
# [...]

##
## Plugin settings
##

plugin {
  # Here you can give some extra environment variables to mail processes.
  # This is mostly meant for passing parameters to plugins. %variable
  # expansion is done for all values.

  # Quota plugin. Multiple backends are supported:
  #   dirsize: Find and sum all the files found from mail directory.
  #            Extremely SLOW with Maildir. It'll eat your CPU and disk I/O.
  #   dict: Keep quota stored in dictionary (eg. SQL)
  #   maildir: Maildir++ quota
  #   fs: Read-only support for filesystem quota
  #
  # Quota limits are set using "quota_rule" parameters, either in here or in
  # userdb. It's also possible to give mailbox-specific limits, for example:
  #   quota_rule = *:storage=1048576
  #   quota_rule2 = Trash:storage=102400
  # User has now 1GB quota, but when saving to Trash mailbox the user gets
  # additional 100MB.
  #
  # Multiple quota roots are also possible, for example:
  #   quota = dict:user::proxy::quota
  #   quota2 = dict:domain:%d:proxy::quota_domain
  #   quota_rule = *:storage=102400
  #   quota2_rule = *:storage=1048576
  # Gives each user their own 100MB quota and one shared 1GB quota within
  # the domain.
  #
  # You can execute a given command when user exceeds a specified quota limit.
  # Each quota root has separate limits. Only the command for the first
  # exceeded limit is excecuted, so put the highest limit first.
  # Note that % needs to be escaped as %%, otherwise "% " expands to empty.
  #   quota_warning = storage=95%% /usr/local/bin/quota-warning.sh 95
  #   quota_warning2 = storage=80%% /usr/local/bin/quota-warning.sh 80
  #quota = maildir

  quota = maildir
  quota_rule = *:storage=20M

# [...]

Reiniciar el servidor:

root@server:~# /etc/init.d/dovecot restart

Verificación

Verificar que el servicio IMAP soporta las cuotas:

root@server:~# telnet 127.0.0.1 imap
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
  * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE STARTTLS AUTH=PLAIN] Dovecot ready.
a001 capability
  * CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS MULTIAPPEND UNSELECT IDLE CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS QUOTA STARTTLS AUTH=PLAIN
a001 OK Capability completed.
a002 logout
  * BYE Logging out
a002 OK Logout completed.
Connection closed by foreign host.

La respuesta al comandocapability debe mostrar que el servicio soporta las cuotas.

Clientes

La mayor parte de los clientes de e-mail actuales pueden proveerle al usuario informaciones sobre cuotas. En el caso de thunderbird, este soporte está proveído por add-ons, Para esto, debe buscar: “quotas” en el sitio https://addons.mozilla.org/thunderbird.

Después de la instalación, es posible obtener otras informaciones acerca del estado del buzón de correo con relación al límite impuesto por las cuotas:

En muchos clientes, borrar un e-mail implica una copia en la carpeta “Trash” y no borrar el original. Si la cota ya haya sido superada, esta operación podrá ser negada con un error “Cuota Excedida”. En este caso, el mensaje debe ser borrado directamente sin la copia en “Trash”. En el thunderbird, las teclas Shift + Del permiten borrar un mensaje sin enviarlo al “Trash”.

Referencias

es/squeeze/email/imap/dovecot_quota.txt · Última modificación: 2024-02-15 01:05 por 127.0.0.1