Prevent Backscatter from over quota

Discussion in 'Feature Requests' started by e100, Sep 25, 2010.

  1. e100

    e100 New Member

    I have just started using ispconfig.
    Using Debian Lenny with postfix and dovecot with ispconfig 3.0.3 beta

    One problem I noticed is that the Dovecot LDA is what generates bounces messages for over quota users.
    If dovecot was using mysql to store quota information it would be a piece of cake to handle this in postfix and prevent backscatter.

    I have another system setup that uses postfix, postfixadmin and dovecot.
    It is setup so postfix rejects messages for users who are over quota. It even matches alias domains and user aliases(forwards).

    I could create the quota table and change the postfix and dovecot configs to add this feature to ispconfig. But it looks like customizing the ispconfig DB and certain config files is a bad idea.

    Below is how my other system is setup, can someone point me in the right direction on the proper way to make these changes with ispconfig?
    I do not want to make some change that gets blown away with each ispconfig update!


    Quota Dictionary table:
    Code:
    mysql> describe quota2;
    +----------+--------------+------+-----+---------+-------+
    | Field    | Type         | Null | Key | Default | Extra |
    +----------+--------------+------+-----+---------+-------+
    | username | varchar(100) | NO   | PRI | NULL    |       |
    | bytes    | bigint(20)   | NO   |     | 0       |       |
    | messages | int(11)      | NO   |     | 0       |       |
    +----------+--------------+------+-----+---------+-------+


    dovecot.conf:
    Code:
    plugin {
      quota = dict:user:Proxy::quotadict
      quota_rule = *:storage=10M:messages=1000
    }
    dict {
      quotadict = mysql:/etc/dovecot-dict-sql.conf
    }


    /etc/dovecot-dict-sql.conf
    Code:
    connect = host=localhost dbname=XXXXXXX user=XXXXXX password=XXXXXXXXXXX
    map {
      pattern = priv/quota/storage
      table = quota2
      username_field = username
      value_field = bytes
    }
    map {
      pattern = priv/quota/messages
      table = quota2
      username_field = username
      value_field = messages
    }



    postfix main.cf:

    Code:
    smtpd_recipient_restrictions =
            check_recipient_access mysql:/etc/postfix/mysql-virtual_over_quota.cf,


    /etc/postfix/mysql-virtual_over_quota.cf
    Code:
    hosts = localhost
    user = XXXXXXXXXX
    password = XXXXXXXXXXXXX
    dbname = XXXXXXXXXXXX
    query = (select IF((quota-quota2.bytes)<102400,'552 5.2.2 Quota exceeded (mailbox for user is full)','OK') as available from mailbox join quota2 on mailbox.username = quota2.username where (select goto from alias where (address = '%u@%d' OR address = CONCAT('%u@',(select target_domain from alias_domain where alias_domain = '%d' limit 1)) )    ) REGEXP mailbox.username ) order by available limit 1;


    The query is confusing, but basically it returns "552 5.2.2 Quota exceeded (mailbox for user is full)" for any recipient where the final destination has less than 102400 Bytes remaining in their mailbox.

    Obviously that query would need changed to work with ispconfig's schema.

    Is there a way to do this without breaking the ispconfig upgrade?
     

Share This Page