Results 1 to 5 of 5

Thread: Rejecting backscatter with Postfix

  1. #1
    Join Date
    Oct 2006
    Beans
    4,628
    Distro
    Kubuntu 18.10 Cosmic Cuttlefish

    Rejecting backscatter with Postfix

    I've recently been getting a lot of backscatter on my email server. How can I make Postfix reject emails to a non-existent user on my server instead of sending back a bounce message??
    Blog | Ubuntu User #15350 | Zsh FTW | Ubuntu Security | Nothing to hide?
    AMD Phenom II X6 1075T @ 3GHz, Nvidia GTX 650, 8GB DDR3 RAM, 1 X 1TB, 2 X 3TB HDD
    Please don't request support via PM


  2. #2
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: Rejecting backscatter with Postfix

    In principle you can't, because the SMTP protocol specifications require a non-deliverable notice be sent.
    The second step in the procedure is the RCPT command.

    RCPT TO:<forward-path> [ SP <rcpt-parameters> ] <CRLF>

    The first or only argument to this command includes a forward-path
    (normally a mailbox and domain, always surrounded by "<" and ">"
    brackets) identifying one recipient. If accepted, the SMTP server
    returns a 250 OK reply and stores the forward-path. If the recipient
    is known not to be a deliverable address, the SMTP server returns a
    550 reply
    , typically with a string such as "no such user - " and the
    mailbox name (other circumstances and reply codes are possible).
    My outbound mail queues often have some number of non-deliverable notices that cannot be delivered to the bogus sender addresses used by spammers. Eventually the NDNs expire. I stopped worrying about problems like these some time ago.

    What are you using for spam filtering? If the message gets quarantined or deleted by the spam filter before delivery, it won't generate nondeliverable notices.
    Last edited by SeijiSensei; May 8th, 2015 at 01:56 PM.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  3. #3
    Join Date
    Jul 2010
    Location
    Suffolk, UK
    Beans
    31
    Distro
    Ubuntu

    Re: Rejecting backscatter with Postfix

    What about...

    Code:
    ## Restrictions
    smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
    smtpd_client_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_rbl_client b.barracudacentral.org, reject_rbl_client sbl.spamhaus.org, reject_rbl_client zen.spamhaus.org
    Along with Spamassasin.
    I hope it helps
    Kind regards

    Lloyd

  4. #4
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: Rejecting backscatter with Postfix

    I use these in main.cf:
    Code:
    smtpd_client_restrictions = reject_unknown_client_hostname, sleep 3, reject_unauth_pipelining
    smtpd_sender_restrictions = reject_unknown_sender_domain
    Reject_unknown_client_hostname is the most effective, but also the most stringent. It blocks connections from any machine that does not have proper DNS resolution. Nearly every legitimate mail server has correct forward and reverse resolution configured these days, so the likelihood of false positives is still pretty low.

    The "sleep3, reject_unauth_pipelining" pair tell the server to wait three seconds after the client connects before displaying its "banner" in the SMTP exchange. Though their numbers are declining, some spam programs don't wait for the banner and start spewing right away. "Reject_unauth_pipelining" tells Postfix to hang up the phone of any such clients.

    "Reject_unknown_sender_domain" applies to the email address sent with the "MAIL FROM" command in the SMTP dialogue (known as the "envelope sender"). That rule requires the email address be @ a valid domain. Non-deliverable notices are sent to that address so it could have some, though I suspect small, effect of reducing NDNs to bogus addressees. Note that the sending server isn't asked to validate that the message comes from a workign address (since it often can't); the only check is whether the sender's domain exists.

    You should also browse the possibilities in: http://www.postfix.org/ADDRESS_VERIFICATION_README.html
    Last edited by SeijiSensei; May 9th, 2015 at 06:39 PM.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  5. #5
    Join Date
    Oct 2006
    Beans
    4,628
    Distro
    Kubuntu 18.10 Cosmic Cuttlefish

    Re: Rejecting backscatter with Postfix

    So my problem ended up being a misconfiguration. Even though I changed
    Code:
    -o smtpd_reject_unlisted_recipient=yes
    in master.cf it wasn't working then I realized I had
    Code:
    virtual_mailbox_maps = hash:/etc/postfix/virtual_mailbox_maps
    commented out in main.cf.

    Found this that helped. A lot of the other things I've read don't work anymore with recent versions of Postfix
    http://wiki2.dovecot.org/LDA/Postfix

    Now it gives a 550 for unlisted addresses in virtual_mailbox_maps.
    Blog | Ubuntu User #15350 | Zsh FTW | Ubuntu Security | Nothing to hide?
    AMD Phenom II X6 1075T @ 3GHz, Nvidia GTX 650, 8GB DDR3 RAM, 1 X 1TB, 2 X 3TB HDD
    Please don't request support via PM


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •