# ISPConfig 3.0.3.1 email quota



## xabbu (22. Dez. 2010)

Hallo zusammen,

ich habe bei einem User ein Quota von 1MB eingestellt und ihm eine 3,5 MB große E-Mail verschickt. Diese wurde ohne murren angenommen.
Wie es scheint, greift das Quota nicht. 
Weiß jemand, wo ich genau nachsehen muß, warum dies der Fall ist?
Ich habe kein Festplattenquota eingestellt.

In der Datenbank steht für diesen User: quota=1048576     
Im Frontend steht 1MB

System: OpenSUSE 11.2 (64bit)
ISPConfig: 3.0.3.1
Mailer: Postifx, dovecot, amavisd-new 


Danke und Gruß
Xabbu


----------



## Till (22. Dez. 2010)

Ich denke schon das Quota funktioniert, Du kannst es nur so nicht testen, wie Du es gemacht hast. Es ist ja ein Maildir Quota von Dovecot und eben kein harddisk Quota, welches bei virtuellen usern ja auch keinen Sinn macht, da alle Postfächer unter dem gleichen linux user liegen und somit zum gleichen harddisk Quota gehören. Schick mal eine zweite Datei und schau, ob sie abgewiesen wird.


----------



## xabbu (23. Dez. 2010)

Hallo Till,

ich habe eine 2. und 3. Nachricht verschickt. 
Beide Nachrichten haben 6,1 MB im Anhang und wurden ausgeliefert, owohl ein Quota von 1 MB eingestellt ist.

Jetzt hat mein Testuser  3 Emais mit jeweils 6,1 MB.

Also sieht es so aus, als ob das quota nicht greift.

Gruß
xabbu


----------



## Till (23. Dez. 2010)

Steht irgend was im mail log dazu? Ist das dovecot quota modul geladen (schau mal in die dovecot Konfigurationsdatei)?


----------



## xabbu (23. Dez. 2010)

Hallo Till,
ja das Modul ist in der Config eingetragen:


```
mail_plugins = quota imap_quota
```
ich habe dovecot mal mit 

```
mail_debug=yes
```
gestartet.

Und hier mals das Log, wenn ich etwas schicke:


```
Dec 23 15:47:16 otherland postfix/cleanup[9518]: 45A9AC2D6: warning: header Subject: test from local; from=<soeren@mindorf.org>
Dec 23 15:47:16 otherland postfix/cleanup[9518]: 45A9AC2D6: message-id=<b894f90ddb54cab6656f008174b9827e@mindorf.org>
Dec 23 15:47:16 otherland postfix/qmgr[28489]: 45A9AC2D6: from=<soeren@mindorf.org>, size=6430570, nrcpt=1 (queue active)
Dec 23 15:47:19 otherland dovecot: IMAP(soeren@mindorf.org): Disconnected: Logged out bytes=6430480/445
Dec 23 15:47:19 otherland postfix/smtpd[9531]: connect from unknown[127.0.0.1]
Dec 23 15:47:19 otherland dovecot: IMAP(soeren@mindorf.org): rawlog: /var/vmail/mindorf.org/soeren/dovecot.rawlog doesn't exist
Dec 23 15:47:19 otherland dovecot: IMAP(soeren@mindorf.org): Loading modules from directory: /usr/lib64/dovecot/modules/imap
Dec 23 15:47:19 otherland dovecot: IMAP(soeren@mindorf.org): Module loaded: /usr/lib64/dovecot/modules/imap/lib10_quota_plugin.so
Dec 23 15:47:19 otherland dovecot: IMAP(soeren@mindorf.org): Module loaded: /usr/lib64/dovecot/modules/imap/lib11_imap_quota_plugin.so
Dec 23 15:47:19 otherland dovecot: IMAP(soeren@mindorf.org): Effective uid=5000, gid=5000, home=/var/vmail/mindorf.org/soeren
Dec 23 15:47:19 otherland dovecot: IMAP(soeren@mindorf.org): Quota root: name=storage=10240000 backend=maildir args=
Dec 23 15:47:19 otherland dovecot: IMAP(soeren@mindorf.org): Namespace: type=private, prefix=INBOX., sep=., inbox=yes, hidden=no, list=yes, subscriptions=yes
Dec 23 15:47:19 otherland dovecot: IMAP(soeren@mindorf.org): maildir: data=/var/vmail/mindorf.org/soeren/Maildir
Dec 23 15:47:19 otherland dovecot: IMAP(soeren@mindorf.org): maildir++: root=/var/vmail/mindorf.org/soeren/Maildir, index=, control=, inbox=/var/vmail/mindorf.org/soeren/Maildir
Dec 23 15:47:19 otherland dovecot: IMAP(soeren@mindorf.org): Namespace INBOX.: Using permissions from /var/vmail/mindorf.org/soeren/Maildir: mode=0700 gid=-1
Dec 23 15:47:19 otherland dovecot: imap-login: Login: user=<soeren@mindorf.org>, method=PLAIN, rip=85.31.186.156, lip=85.31.186.156, TLS
Dec 23 15:47:19 otherland dovecot: IMAP(soeren@mindorf.org): Disconnected: Logged out bytes=59/531
Dec 23 15:47:19 otherland postfix/smtpd[9531]: D8C7AC2A7: client=unknown[127.0.0.1]
Dec 23 15:47:19 otherland postfix/cleanup[9518]: D8C7AC2A7: message-id=<b894f90ddb54cab6656f008174b9827e@mindorf.org>
Dec 23 15:47:20 otherland postfix/qmgr[28489]: D8C7AC2A7: from=<soeren@mindorf.org>, size=6431187, nrcpt=1 (queue active)
Dec 23 15:47:20 otherland postfix/smtpd[9531]: disconnect from unknown[127.0.0.1]
Dec 23 15:47:20 otherland amavis[14214]: (14214-09) Passed CLEAN, <soeren@mindorf.org> -> <test@mindorf.org>, Message-ID: <b894f90ddb54cab6656f008174b9827e@mindorf.org>, mail_id: LuS-1CsZGwgB, Hits: -, size: 6430570, queued_as: D8C7AC2A7, 3861 ms
Dec 23 15:47:20 otherland dovecot: deliver(test@mindorf.org): Loading modules from directory: /usr/lib64/dovecot/modules/lda
Dec 23 15:47:20 otherland dovecot: deliver(test@mindorf.org): Module loaded: /usr/lib64/dovecot/modules/lda/lib10_quota_plugin.so
Dec 23 15:47:20 otherland dovecot: deliver(test@mindorf.org): Module loaded: /usr/lib64/dovecot/modules/lda/lib90_sieve_plugin.so
Dec 23 15:47:20 otherland postfix/smtp[9523]: 45A9AC2D6: to=<test@mindorf.org>, relay=127.0.0.1[127.0.0.1]:10024, delay=5, delays=1.1/0.02/0.01/3.9, dsn=2.0.0, status=sent (250 2.0.0 Ok, id=14214-09, from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as D8C7AC2A7)
Dec 23 15:47:20 otherland postfix/qmgr[28489]: 45A9AC2D6: removed
Dec 23 15:47:20 otherland dovecot: deliver(test@mindorf.org): auth input: home=/var/vmail/mindorf.org/test
Dec 23 15:47:20 otherland dovecot: deliver(test@mindorf.org): auth input: mail=maildir:/var/vmail/mindorf.org/test/Maildir
Dec 23 15:47:20 otherland dovecot: deliver(test@mindorf.org): auth input: uid=5000
Dec 23 15:47:20 otherland dovecot: deliver(test@mindorf.org): auth input: gid=5000
Dec 23 15:47:20 otherland dovecot: deliver(test@mindorf.org): auth input: quota=maildir:storage=1024
Dec 23 15:47:20 otherland dovecot: deliver(test@mindorf.org): auth input: sieve=/var/vmail/mindorf.org/test/.sieve
Dec 23 15:47:20 otherland dovecot: deliver(test@mindorf.org): Quota root: name=storage=1024 backend=maildir args=
Dec 23 15:47:20 otherland dovecot: deliver(test@mindorf.org): Namespace: type=private, prefix=INBOX., sep=., inbox=yes, hidden=no, list=1, subscriptions=yes
Dec 23 15:47:20 otherland dovecot: deliver(test@mindorf.org): maildir: data=/var/vmail/mindorf.org/test/Maildir
Dec 23 15:47:20 otherland dovecot: deliver(test@mindorf.org): maildir++: root=/var/vmail/mindorf.org/test/Maildir, index=, control=, inbox=/var/vmail/mindorf.org/test/Maildir
Dec 23 15:47:20 otherland dovecot: deliver(test@mindorf.org): sieve: local script path /var/vmail/mindorf.org/test/.sieve doesn't exist (using global script path in stead)
Dec 23 15:47:20 otherland dovecot: deliver(test@mindorf.org): sieve: user has no valid personal script
Dec 23 15:47:20 otherland dovecot: deliver(test@mindorf.org): sieve: no scripts to execute: reverting to default delivery.
Dec 23 15:47:20 otherland dovecot: deliver(test@mindorf.org): Namespace INBOX.: Using permissions from /var/vmail/mindorf.org/test/Maildir: mode=0700 gid=-1
Dec 23 15:47:21 otherland dovecot: IMAP(soeren@mindorf.org): rawlog: /var/vmail/mindorf.org/soeren/dovecot.rawlog doesn't exist
Dec 23 15:47:21 otherland dovecot: IMAP(soeren@mindorf.org): Loading modules from directory: /usr/lib64/dovecot/modules/imap
Dec 23 15:47:21 otherland dovecot: IMAP(soeren@mindorf.org): Module loaded: /usr/lib64/dovecot/modules/imap/lib10_quota_plugin.so
Dec 23 15:47:21 otherland dovecot: IMAP(soeren@mindorf.org): Module loaded: /usr/lib64/dovecot/modules/imap/lib11_imap_quota_plugin.so
Dec 23 15:47:21 otherland dovecot: IMAP(soeren@mindorf.org): Effective uid=5000, gid=5000, home=/var/vmail/mindorf.org/soeren
Dec 23 15:47:21 otherland dovecot: IMAP(soeren@mindorf.org): Quota root: name=storage=10240000 backend=maildir args=
Dec 23 15:47:21 otherland dovecot: IMAP(soeren@mindorf.org): Namespace: type=private, prefix=INBOX., sep=., inbox=yes, hidden=no, list=yes, subscriptions=yes
Dec 23 15:47:21 otherland dovecot: IMAP(soeren@mindorf.org): maildir: data=/var/vmail/mindorf.org/soeren/Maildir
Dec 23 15:47:21 otherland dovecot: IMAP(soeren@mindorf.org): maildir++: root=/var/vmail/mindorf.org/soeren/Maildir, index=, control=, inbox=/var/vmail/mindorf.org/soeren/Maildir
Dec 23 15:47:21 otherland dovecot: imap-login: Login: user=<soeren@mindorf.org>, method=PLAIN, rip=85.31.186.156, lip=85.31.186.156, TLS
Dec 23 15:47:21 otherland dovecot: IMAP(soeren@mindorf.org): rawlog: /var/vmail/mindorf.org/soeren/dovecot.rawlog doesn't exist
Dec 23 15:47:21 otherland dovecot: IMAP(soeren@mindorf.org): Loading modules from directory: /usr/lib64/dovecot/modules/imap
Dec 23 15:47:21 otherland dovecot: IMAP(soeren@mindorf.org): Module loaded: /usr/lib64/dovecot/modules/imap/lib10_quota_plugin.so
Dec 23 15:47:21 otherland dovecot: IMAP(soeren@mindorf.org): Module loaded: /usr/lib64/dovecot/modules/imap/lib11_imap_quota_plugin.so
Dec 23 15:47:21 otherland dovecot: IMAP(soeren@mindorf.org): Effective uid=5000, gid=5000, home=/var/vmail/mindorf.org/soeren
Dec 23 15:47:21 otherland dovecot: IMAP(soeren@mindorf.org): Quota root: name=storage=10240000 backend=maildir args=
Dec 23 15:47:21 otherland dovecot: IMAP(soeren@mindorf.org): Namespace: type=private, prefix=INBOX., sep=., inbox=yes, hidden=no, list=yes, subscriptions=yes
Dec 23 15:47:21 otherland dovecot: IMAP(soeren@mindorf.org): maildir: data=/var/vmail/mindorf.org/soeren/Maildir
Dec 23 15:47:21 otherland dovecot: IMAP(soeren@mindorf.org): maildir++: root=/var/vmail/mindorf.org/soeren/Maildir, index=, control=, inbox=/var/vmail/mindorf.org/soeren/Maildir
Dec 23 15:47:21 otherland dovecot: IMAP(soeren@mindorf.org): Disconnected: Logged out bytes=82/842
Dec 23 15:47:21 otherland dovecot: IMAP(soeren@mindorf.org): Disconnected: Logged out bytes=339/6338
Dec 23 15:47:21 otherland dovecot: imap-login: Login: user=<soeren@mindorf.org>, method=PLAIN, rip=85.31.186.156, lip=85.31.186.156, TLS
Dec 23 15:47:21 otherland dovecot: deliver(test@mindorf.org): msgid=<b894f90ddb54cab6656f008174b9827e@mindorf.org>: saved mail to INBOX
Dec 23 15:47:21 otherland postfix/pipe[9542]: D8C7AC2A7: to=<test@mindorf.org>, relay=dovecot, delay=1.7, delays=0.9/0.02/0/0.79, dsn=2.0.0, status=sent (delivered via dovecot service)
Dec 23 15:47:21 otherland postfix/qmgr[28489]: D8C7AC2A7: removed
```
Gruß
xabbu


----------



## F4RR3LL (23. Dez. 2010)

```
Quota root: name=storage=10240000 backend=maildir args=
```
quota geht. Er nimmt halt das vom Root.


----------



## xabbu (23. Dez. 2010)

Tja,

wieso, weshalb, warum?
Und root existiert nicht in der DB.

ein sql zeigt es auch richtig an:


```
mysql> SELECT email as user, maildir as home, CONCAT('maildir:', maildir, '/Maildir') as mail, uid, gid, CONCAT('maildir:storage=', floor(quota/1024)) AS quota, CONCAT(maildir, '/.sieve') as sieve FROM mail_user WHERE email = 'test@mindorf.org';
+------------------+-----------------------------+---------------------------------------------+------+------+----------------------+------------------------------------+
| user             | home                        | mail                                        | uid  | gid  | quota                | sieve                              |
+------------------+-----------------------------+---------------------------------------------+------+------+----------------------+------------------------------------+
| test@mindorf.org | /var/vmail/mindorf.org/test | maildir:/var/vmail/mindorf.org/test/Maildir | 5000 | 5000 | maildir:storage=1024 | /var/vmail/mindorf.org/test/.sieve |
+------------------+-----------------------------+---------------------------------------------+------+------+----------------------+------------------------------------+
1 row in set (0.00 sec)
```
hier mal meine Konfig:


```
otherland:~ # dovecot -n
# 1.2.9: /etc/dovecot/dovecot.conf
# OS: Linux 2.6.31.14-0.4-desktop x86_64 openSUSE 11.2 (x86_64) ext3
log_timestamp: %Y-%m-%d %H:%M:%S 
protocols: imaps pop3s
ssl_cert_file: /etc/courier/key1.pem
ssl_key_file: /etc/courier/imap.pem
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
first_valid_uid: 5000
last_valid_uid: 5000
first_valid_gid: 5000
last_valid_gid: 5000
mail_location: maildir:/var/vmail/%d/%n/Maildir
mail_debug: yes
mail_executable(default): /usr/lib/dovecot/rawlog /usr/lib/dovecot/imap
mail_executable(imap): /usr/lib/dovecot/rawlog /usr/lib/dovecot/imap
mail_executable(pop3): /usr/lib/dovecot/rawlog /usr/lib/dovecot/pop3
mail_plugins(default): quota imap_quota
mail_plugins(imap): quota imap_quota
mail_plugins(pop3): quota
mail_plugin_dir(default): /usr/lib64/dovecot/modules/imap
mail_plugin_dir(imap): /usr/lib64/dovecot/modules/imap
mail_plugin_dir(pop3): /usr/lib64/dovecot/modules/pop3
imap_client_workarounds(default): outlook-idle
imap_client_workarounds(imap): outlook-idle
imap_client_workarounds(pop3): 
namespace:
  type: private
  separator: .
  prefix: INBOX.
  inbox: yes
  list: yes
  subscriptions: yes
lda:
  postmaster_address: postmaster@example.com
  mail_plugins: sieve quota
  mail_plugin_dir: /usr/lib64/dovecot/modules/lda
  auth_socket_path: /var/run/dovecot/auth-master
auth default:
  mechanisms: plain login
  passdb:
    driver: pam
  passdb:
    driver: sql
    args: /etc/dovecot/dovecot-sql.conf
  userdb:
    driver: passwd
  userdb:
    driver: sql
    args: /etc/dovecot/dovecot-sql.conf
  socket:
    type: listen
    client:
      path: /var/spool/postfix/private/auth
      mode: 432
      user: postfix
      group: postfix
    master:
      path: /var/run/dovecot/auth-master
      mode: 384
      user: vmail
plugin:
  quota: maildir
  sieve: ~/.dovecot.sieve
  sieve_dir: ~/sieve
otherland:~ #
```
Und dovecot-sql.conf:

```
driver = mysql
connect = host=localhost dbname=dbispconfig user=ispconfig password=**
default_pass_scheme = CRYPT

password_query = SELECT password FROM mail_user WHERE email = '%u' AND disable%Ls = 'n'
user_query = SELECT email as user, maildir as home, CONCAT('maildir:', maildir, '/Maildir') as mail, uid, gid, CONCAT('maildir:storage=', floor(quota/1024)) AS quota, CONCAT(maildir, '/.sieve') as sieve FROM mail_user WHERE email = '%u' AND disable%Ls = 'n'
```
Kann es sein, dass mir eine Konfig fehlt?
Ich sehe keine Abfrage der quota...
mir fehlt irgendwie die dovecot-dict-sql.conf.
Ich habe nur eine example und dort steht keine Verbindung zur SQL-DB drin.
Oder liege ich da falsch und ich brauche die Datei gar nicht???

Danke und Gruß
xabbu


----------



## xabbu (26. Dez. 2010)

Ersteinmal frohe Weihnachten,

und jetzt zur Lösung meines Problems.

Ich habe das Query geändert und siehe da, es funktioniert!


```
user_query = SELECT email as user, maildir as home, CONCAT(maildir, '/Maildir') as mail, uid, gid, concat('*:storage=', quota, 'B') AS quota_rule, CONCAT(maildir, '/.sieve') as sieve FROM mail_user WHERE email = '%u' AND disable%Ls = 'n'
```
gefunden habe ich es hier im Forum, über google, leider nicht über die Suche hier...

http://www.howtoforge.de/forum/archive/index.php/t-3498.html

Danke an alle.

Gruß
xabbu


----------

