Quota doesn't work

Discussion in 'HOWTO-Related Questions' started by chris82, Jan 23, 2006.

  1. chris82

    chris82 New Member

    Hi there,

    it's about the tutorial: Virtual Users + Domains With Postfix, Courier + MySQL (+SMTP-AUTH, SpamA, ClamAV) - i followed it without installing spam-filters.

    Everything works fine, except that quota doesn't work. If i set the quota to 1 and send then an email to this mail account, the mail is normally delivered to the maildir.

    same thing if i copy an email from another imap-mailbox to this mailbox: no quota error.... :confused:

    can anyone help me?

    thank you :eek:
    chris
     
  2. falko

    falko Super Moderator Howtoforge Staff

  3. chris82

    chris82 New Member

    Thank you, i've read this thread but it didn't help me...

    postconf | grep size gets:
    Code:
    berkeley_db_create_buffer_size = 16777216
    berkeley_db_read_buffer_size = 131072
    body_checks_size_limit = 51200
    bounce_size_limit = 2000
    header_size_limit = 102400
    mailbox_size_limit = 102400000
    message_size_limit = 10240000
    Am i mixing up real system users and virtual users maybe? How can i tell postfix to use virtual_mailbox_limit_maps?
     
  4. falko

    falko Super Moderator Howtoforge Staff

    Is the recipient domain of your virtual user also listed in mydestination in /etc/postfix/main.cf?
     
  5. chris82

    chris82 New Member

    No, it is not:

    mydomain = server193xxxxxxx.serverpool.info
    myhostname = server193xxxxxxx.serverpool.info
    mydestination = $myhostname, localhost.$mydomain, $mydomain
     
  6. falko

    falko Super Moderator Howtoforge Staff

    Are you sure you exceeded the quota of 1MB with this email?

    You mean you copied the email on the command line with the cp command? This doesn't work!
     
  7. chris82

    chris82 New Member

    Hm, is it really 1 MB and not 1 KB or 1 Byte? I have 1 as value for the quota in the user-table for this email-account.

    I changed now the database password in the mysql-virtual_mailbox_limit_maps.cf to a wrong password but i'm not getting any errors when i send a mail to this account.

    If i e.g change the pwd to a wrong pwd in mysql-virtual_mailboxes.cf i get the error:
    Code:
    warning: connect to mysql server 127.0.0.1: Access denied for user 'provider_admin'@'localhost' (using password: YES)
    

    No, i copied the email with IMAP to another folder. I have courier-imap. But that's not as important as the postfix quota.
     
    Last edited: Jan 26, 2006
  8. falko

    falko Super Moderator Howtoforge Staff

    It's 1 MB.

    I'm not quite sure if I understand what you mean here...
     
  9. chris82

    chris82 New Member

    Hi,

    my mysql-virtual_mailbox_limit_maps.cf looks like:

    Code:
    user = provider_admin
    password = mypasswd
    dbname = provider
    table = users
    select_field = quota
    where_field = email
    hosts = 127.0.0.1
    As password i've tried to enter a wrong value. So when postfix accesses this file and reads the quota, it should get in the mail-log a warning about the wrong database-password.
    But i don't get any errors (i do get an error if i change the password e.g. from mysql-virtual_mailboxes.cf to a wrong one). So i think, postfix doesn't access this file. But why? Is it possible that it's not the patched version that is running but the old version?
    Before i installed postfix + vda i've had an old version, installed via apt-get.

    Do u understand me? Thank you very much for your help!
     
  10. falko

    falko Super Moderator Howtoforge Staff

    Please post your /etc/postfix/main.cf.
     
  11. chris82

    chris82 New Member

    main.cf:
    Code:
    smtpd_banner = $myhostname ESMTP $mail_name
    biff = no
    
    # appending .domain is the MUA's job.
    append_dot_mydomain = no
    
    # Uncomment the next line to generate "delayed mail" warnings
    delay_warning_time = 4h
    
    mydomain = server193xxxxxxx.serverpool.info
    myhostname = server193xxxxxxx.serverpool.info
    mydestination = $myhostname, localhost.$mydomain, $mydomain
    mynetworks = 127.0.0.0/8
    virtual_alias_domains =
    alias_maps =
    virtual_alias_maps = mysql:/etc/postfix/mysql-virtual_forwardings.cf mysql:/etc/postfix/mysql-virtual_email2email.cf
    virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual_domains.cf
    virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual_mailboxes.cf
    
    virtual_create_maildirsize = yes
    virtual_mailbox_extended = yes
    
    virtual_overquota_bounce = yes
    # virtual_mailbox_limit_inbox = yes
    virtual_mailbox_limit_override = yes
    virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf
    virtual_maildir_limit_message = "Sorry, the user's maildir has overdrawn his diskspace quota, please try again later."
    virtual_trash_count = yes
    virtual_trash_name = .Trash
    
    virtual_mailbox_base = /home/vmail
    virtual_uid_maps = static:5000
    virtual_gid_maps = static:5000
    smtpd_sasl_auth_enable = yes
    broken_sasl_auth_clients = yes
    #smtpd_sasl2_auth_enable = yes
    smtpd_sasl_security_options = noanonymous
    smtpd_sasl_local_domain = $myhostname
    
    smtpd_use_tls = yes
    smtpd_tls_cert_file = /etc/postfix/smtpd.cert
    smtpd_tls_key_file = /etc/postfix/smtpd.key
    smtpd_tls_loglevel = 1
    smtpd_tls_received_header = yes
    smtpd_tls_session_cache_timeout = 3600s
    tls_random_source = dev:/dev/urandom
    
    delay_warning_time = 4
    bounce_size_limit = 2000
    # mailbox_size_limit = 102400000
    maximal_queue_lifetime = 3d
    local_destination_concurrency_limit = 2
    default_destination_concurrency_limit = 20
    smtpd_helo_required = yes
    
    disable_vrfy_command = yes
    
    smtpd_error_sleep_time = 10
    smtpd_soft_error_limit = 5
    smtpd_hard_error_limit = 10
    
    smtpd_helo_restrictions = permit_mynetworks, reject_non_fqdn_hostname, reject_invalid_hostname
    # smtpd_recipient_restrictions = permit
    smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
    smtpd_sender_restrictions = reject_unknown_sender_domain, reject_non_fqdn_sender, permit_mynetworks, permit_sasl_authenticated, reject_rhsbl_sender rhsbl.sorbs.net, reject_rhsbl_sender dsn.rfc-ignorant.org, permit
    smtpd_data_restrictions = permit_mynetworks, reject_unauth_pipelining, permit
    smtpd_etrn_restrictions = reject
    
     
  12. falko

    falko Super Moderator Howtoforge Staff

    The file looks as if you didn't run all the postconf commands mentioned on http://www.howtoforge.com/virtual_postfix_mysql_quota_courier_p2

    You should run the following commands now and restart Postfix afterwards:

    Code:
    postconf -e 'mynetworks = 127.0.0.0/8'
    postconf -e 'virtual_alias_domains ='
    postconf -e ' virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, proxy:mysql:/etc/postfix/mysql-virtual_email2email.cf'
    postconf -e 'virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf'
    postconf -e 'virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf'
    postconf -e 'virtual_mailbox_base = /home/vmail'
    postconf -e 'virtual_uid_maps = static:5000'
    postconf -e 'virtual_gid_maps = static:5000'
    postconf -e 'smtpd_sasl_auth_enable = yes'
    postconf -e 'broken_sasl_auth_clients = yes'
    postconf -e 'smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination'
    postconf -e 'smtpd_use_tls = yes'
    postconf -e 'smtpd_tls_cert_file = /etc/postfix/smtpd.cert'
    postconf -e 'smtpd_tls_key_file = /etc/postfix/smtpd.key'
    postconf -e 'transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf'
    postconf -e 'virtual_create_maildirsize = yes'
    postconf -e 'virtual_mailbox_extended = yes'
    postconf -e 'virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf'
    postconf -e 'virtual_mailbox_limit_override = yes'
    postconf -e 'virtual_maildir_limit_message = "The user you are trying to reach is over quota."'
    postconf -e 'virtual_overquota_bounce = yes'
    postconf -e 'proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps'
     
  13. chris82

    chris82 New Member

    Hi,

    i executed now these commands but it's stil the same problem.

    Is there any way to find out if i am using the vda patched verison or not?


    Bye,
    Chris
     
  14. falko

    falko Super Moderator Howtoforge Staff

    I'm not quite sure if there's a way to find this out. Maybe the output of
    Code:
    postconf -d
    gives you some clues. However, if you did exactly as described in the tutorial, it should work without problems.
     
  15. savkar

    savkar New Member

    Interesting. The only thing not working in my setup is the quota function. I too patched postfix, everything went fine, but I see no indication that quota is working.

    In fact I am using the quota_notify script and it indicates no quotas on anyone. The Daily Quota report just has the header but no list of users & quota %.

    Note that I did decide to bypass delivery into the maildirs with Postfix and use Maildrop instead since I wanted to do some advanced filtering. Could this screw something up?

    When I looked at the link you suggested, I saw nothing that made me think the situation there was applicable.

    Sunil
     
  16. savkar

    savkar New Member

    Strike my last email. After quite a bit more time I realized that for Maildir quota support, you need to have a completely different setup for the quota field! namely you need varchar(20), and then slightly different configurations for the mysql db.

    Well, if anyone is curious how to set up with maildrop and courier-imap support, go to http://www.xs4all.nl/~jaspersl/quota/ and you will find an explanation for setup which works brilliantly.

    Sunil
     
  17. chris82

    chris82 New Member

    That's great savkar, i have done alle the things in the Howto and now the quota works perfectly :)
    Thank you very much!!
     

Share This Page