How to protect mail server from bulk senders?

Discussion in 'General' started by Ventzy, Aug 24, 2013.

  1. Ventzy

    Ventzy New Member

    I have ispconfig with many sites and mail accounts. I have problem with many (60k) mails in mail queue. This mails comes from different mail addresses like this [email protected]. existsing-domain.tld have few real mail boxes. Maybe credentials to one of his mailboxes have been stolen. I have cleared mail queue, but I need to prevent this from happening again.

    1. How can I reject mails send from non existing users. I tried in /etc/postfix/
    smtpd_sender_restrictions =
        check_sender_access mysql:/etc/postfix/,
    but it does not seems to work.

    2. How can I prevent sending mails from different domain? As I tested I found that if I log in mail server with [email protected] I can send email from [email protected].

    3. How can I restrict users from sending more than X mails an hour, and every mail after that to be rejected and not get in to the queue altogether?

    I suppose those are common issues, but I couldn't find guide which address them.
  2. concept21

    concept21 Member

    Try configuring Spamassusin. Find a good e-book first.

    It is my way to solve problem. :)
  3. concept21

    concept21 Member

    Last edited: Aug 27, 2013
  4. crt

    crt New Member


    You can install postgrey as well, I think it could be useful.
  5. Turbanator

    Turbanator Member HowtoForge Supporter

  6. Ventzy

    Ventzy New Member

    Thanks for your suggestions guys.

    I will share my findings to my specific questions.

    This will limit sent messages and number of recipients per time interval. Default time interval is 1min, so smtpd_client_message_rate_limit = 5 won't allow more than 5 messages sent per minute.
    smtpd_client_message_rate_limit = 5
    smtpd_client_recipient_rate_limit = 50
    Those two have common answer. I find guides here:

    1. Add " $smtpd_sender_login_maps" at the end of proxy_read_maps. Mine looks like
    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
    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 $smtpd_sender_login_maps
    2. Add
    smtpd_sender_login_maps = proxy:mysql:/etc/postfix/
    3. Create /etc/postfix/ with following content:
    user = ispconfig
    password = XXX
    dbname = dbispconfig
    hosts =
    query = select destination from mail_forwarding where source = '%s' and active = 'y' and type = 'alias' and server_id = 1 union select email from mail_user where email = '%s' and postfix = 'y' and server_id = 1;
    Replace XXX with your password, which could be found in other /etc/postfix/mysql-*.cf file
  7. PVasileff

    PVasileff Member

    Can you add this options in next stable release of ISPConfig?? Till?
    Last edited: Sep 17, 2013
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    The above setup will not work for many mail systems e.g. when ispconfig is used as mail filter in front of internal mail servers (e.g. exchange servers) or when some of your clients send newsletters over this server. So thats no setup which can be applied as default, but we might add this as option in the mail server config setup.

    If you like to see the above setup as option in one of the next relaeses, make a feature request for it in the bugtracker and link to this page so we can find the implementation. If it gets enough votes, it will get added to the roadmap.
  9. PVasileff

    PVasileff Member

  10. PVasileff

    PVasileff Member

Share This Page