Menu

Block e-mail address(es)?

Haravikk
2016-02-03
2016-02-04
  • Haravikk

    Haravikk - 2016-02-03

    So first of all, just wanted to say thanks for postfix admin, it made setting up my e-mail accounts much, much easier!

    However, one of my personal domains uses a catch-all, as this enables me to create per-site e-mail addresses just by typing in whatever I like when I register somewhere, but I've now started getting spam on one of these addresses.

    I know I could create a sieve rule to delete messages received by that address, but I'm curious whether there's a better alternative offered by postfix admin? I couldn't find an obvious option for blocking an e-mail address or configuring it to always delete or bounce messages, but perhaps I've missed it?

     
    • Charles

      Charles - 2016-02-04

      Catchalls are the worst thing you can do. It breaks SMTP in a big way
      (senders don't get notification they typo'd an email address, and you
      lose email).

      Postfix (as do pretty much all of the big SMTP servers out there except
      for Microsoft Exchange/Office 365) supports something called
      plus-addressing, this is a much better solution. It allows you to create
      aliases on the fly (without having to pre-create them on the server).

      Yes, some sites won't let you enter a plussed address, but that seems to
      be less and less of a problem these days, so not enough to worry about.

      On 2/3/2016 4:41 AM, Haravikk haravikk@users.sf.net wrote:

      So first of all, just wanted to say thanks for postfix admin, it made
      setting up my e-mail accounts much, much easier!

      However, one of my personal domains uses a catch-all, as this enables me
      to create per-site e-mail addresses just by typing in whatever I like
      when I register somewhere, but I've now started getting spam on one of
      these addresses.

      I know I could create a sieve rule to delete messages received by that
      address, but I'm curious whether there's a better alternative offered by
      postfix admin? I couldn't find an obvious option for blocking an e-mail
      address or configuring it to always delete or bounce messages, but
      perhaps I've missed it?

       
  • Simon Hobson

    Simon Hobson - 2016-02-03

    You could create your own postfix table(s) and check it before anything else. I have that at home - allows me to blacklist certain things such as helo names that match my own systems. For a while I set it to bounce mail from AOL with a "I can't reply because AOL is broken and rejects my mail, so complaint to AOL and find another way to contact me" type message.

    For example, I have this in main.cf

    smtpd_recipient_restrictions =
      ...
      check_client_access cidr:/etc/postfix/host_access,
    

    And host_access contains things like :

    192.168.0.52    OK
    192.168.0.123   REJECT
    193.0.0.0.0/0   DUNNO
    

    The help pages over at postfix.org should give you the syntax needed to achieve what you want - you'll need a different check to match destination email, but the above should give you the jist.

     

    Last edit: Simon Hobson 2016-02-03
  • Christian Boltz

    Christian Boltz - 2016-02-03

    This is not supported by PostfixAdmin itsself (implementing it should be easy, but I don't have plans to do it. If you want to do it and need some help to get started, feel free to ask here or on IRC freenode#postfixadmin)

    That said - it's easy to do on the Postfix level.

    First, add "check_recipient_access hash:/etc/postfix/access" to your smtpd_recipient_restrictions:

    smtpd_recipient_restrictions =
        # [... whatever checks you want to do before blocking those addresses ...]
        check_recipient_access hash:/etc/postfix/access,
        # [... more checks ...]
    

    Then add the addresses you want to block to /etc/postfix/access (you can use "REJECT" or a 5xx reject code - or a 4xx code to keep the spammer's queue filled ;-)

    spam@example.com        REJECT No spam please
    more_spam@example.com   555 No spam please
    

    Finally, run "postmap /etc/postfix/access"

     

Log in to post a comment.