Rejecting mail dorm a domain to specific user

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Rejecting mail dorm a domain to specific user

@lbutlr
Is it possible to reject a mail from a specific domain to a specific user?

Obviously, there are other ways to deal with this, but I have a case where I’d prefer to reject the mail before it is received but I do not want to block the domain for other users.

--
Apple broke AppleScripting signatures in Mail.app, so no random signatures.

Reply | Threaded
Open this post in threaded view
|

Re: Rejecting mail dorm a domain to specific user

Dominic Raferd
On 22 November 2017 at 12:52, @lbutlr <[hidden email]> wrote:
> Is it possible to reject a mail from a specific domain to a specific user?
>
> Obviously, there are other ways to deal with this, but I have a case where I’d prefer to reject the mail before it is received but I do not want to block the domain for other users.

Untested concept only, so corrections/improvement are welcome. Use a
restriction list that is not used otherwise (here:
smtpd_client_restrictions):

/etc/postfix/main.cf:
<snip>
# using smtpd_client_restrictions you must have
#   smtpd_delay_reject = yes (the default) so it is evaluated
#   at the time of the RCPT TO command, otherwise
#   check_sender_access and check_recipient_access won't work
smtpd_delay_reject = yes
smtpd_client_restrictions =
  check_sender_access pcre:/etc/postfix/sender_access.pcre
  check_recipient_access hash:/etc/postfix/recipient_access
  permit
<snip>

/etc/postfix/sender_access.pcre:
/^[hidden email]$/ DUNNO
/.*/ OK

/etc/postfix/recipient_access:
[hidden email] REJECT
Reply | Threaded
Open this post in threaded view
|

Re: Rejecting mail dorm a domain to specific user

Viktor Dukhovni
In reply to this post by @lbutlr


> On Nov 22, 2017, at 7:52 AM, @lbutlr <[hidden email]> wrote:
>
> Is it possible to reject a mail from a specific domain to a specific user?

With a policy service or smtpd restriction classes (which don't scale to
to complex combinatorial policies):

    http://www.postfix.org/RESTRICTION_CLASS_README.html
    http://www.postfix.org/SMTPD_POLICY_README.html

--
        Viktor.