Postfix Config

Discussion in 'Server Operation' started by bschultz, Jun 6, 2022.

  1. bschultz

    bschultz Member

    The vast majority of spam that gets delivered to my inbox is from emails that the header received by domain does not match the same domain as the reply to address. Is there a way in Postfix, or maybe in a sieve rule, to reject these?

    Here's the header of one spam email I got today.

    Received: from allureagency.com.br (unknown [116.204.181.101])

    But the reply address is from this domain: 24HrGutterReplacementaFWczOYfp.com
     
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Have you checked the good e-mails your server receives, how many of those have this same not matching received from and reply address?
    I'm sure RSPAMD could filter by that criteria, but I do not know how. It has configuration
    Code:
    REPLYTO_DN_EQ_FROM_DN    Reply-To display name matches From
    which looks promising.
     
  3. bschultz

    bschultz Member

    I checked the config file for Postfix...and I did NOT have SORBS in the RBL blacklist. That list seems to add IP's pretty quickly. I had SORBS in the ISPConfig settings, but I must have had something wrong, as the email in the example was in 95% of the RBL blacklists that I looked at.
    I've added it to Postfix, and will report back if this reduces delivered clearly SPAM emails.

    Thanks!
     
  4. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    You want to reject mail where the helo hostname logged in a Received: header doesn't match the "domain" (right hand side) of the sender (or maybe reply-to) address? That will block nearly all email, both spam and not; not a good idea.
     
  5. bschultz

    bschultz Member

    I'd say 99% of the spam that gets into my mailbox is of this type:

    Received: from 000bcc00.glucoinsta.cam (unknown [107.179.46.44]) ------- (UNKNOWN followed by IP address)


    Where a legitimate email will have:

    Received: from mtaout-62034-ewr.dynect.net (mtaout-62034-ewr.dynect.net [208.76.62.34]) ------- (REVERSE DNS followed by IP)


    Can I move all UNKNOWN to the Junk folder automatically? If so, how? Not sure if it's the best method, but I've added this sieve rule:

    elseif header :contains "(unknown ["
    {
    fileinto "Junk";
    }
     
    Last edited: Jun 24, 2022
  6. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    The 'unknown' there indicates a reverse DNS lookup for the client ip did not resolve; that is simple to block in postfix using reject_unkown_client in smtpd_client_restrictions or similar.
     
  7. bschultz

    bschultz Member

    I don't want to reject...I want it in JUNK.

    The syntax I had was wrong though...I think this is working:


    elsif header :contains "Received" "(unknown ["
    {
    fileinto "Junk";
    }
     

Share This Page