1

The issue:

Couple of days ago we faced spam attack from external IP that was using a real external domain to send around 7k email to different external domains like yahoo, hotmail, gmail ....etc, that i had to block that ip by the firewall manually,

  • How to only allow defined domains in my "domain" mysql database and reject others (even if they were real having MX and A records) like the reject_unlisted_sender parameter behavior

Configurations:

- /etc/postfix/main.cf

.....
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/sender_access, reject_unlisted_sender, permit_sasl_authenticated, reject_unknown_sender_domain
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
...........

- /etc/postfix/master.cf

smtp      inet  n       -       -       -       -       smtpd
smtps     inet  n       -       -       -       -       smtpd
  -o syslog_name=postfix/smtps
  -o smtpd_tls_wrappermode=yes
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
......
127.0.0.1:10025 inet n - - - - smtpd
        -o content_filter=
        -o local_recipient_maps=
        -o relay_recipient_maps=
        -o smtpd_restriction_classes=
        -o smtpd_client_restrictions=
        -o smtpd_helo_restrictions=
        -o smtpd_sender_restrictions=
        -o smtpd_recipient_restrictions=permit_mynetworks,reject
        -o mynetworks=127.0.0.0/8
        -o strict_rfc821_envelopes=yes
        -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
#        -o smtpd_bind_address=127.0.0.1

Versions:

My mailserver is running on "Ubuntu 12.04, postfix 2.9.6, courier"

1 Answers1

0

Did you try http://www.postfix.org/postconf.5.html#smtpd_reject_unlisted_recipient? I haven't tried it but I think it should work.
Also take a look at http://www.postfix.org/postconf.5.html#smtpd_relay_restrictions

Talal Al-Khalifa
  • 668
  • 5
  • 12