0

How to block sending mail from domain?

I tried

main.cf  
    smtpd_sender_access = hash:/etc/postfix/access

access  
    blabla.com REJECT

But when i send mail from blabla.com to somedomain, it still sends the mail.

4
  • Could you post some more information? Where does the mail come from?
    – mgabriel
    Jun 23 '13 at 19:14
  • I use easySCP open source hosting management system. One domain was hacked through Joomla and sending out spam mail. So I need to block all outgoing mails from this domain. Jun 23 '13 at 19:23
  • if that domain is still hacked, you should fight the root cause and disable that domain completely. it will be hacked again quite fast.
    – mgabriel
    Jun 24 '13 at 20:41
  • use postfwd, homepage here: postfwd.org configuration example here: nooblet.org/blog/2010/postfwd-example-configuration
    – user318893
    Oct 27 '15 at 6:40
3

I think that you don't have the problem with domain... It can only be the email account (or several accounts). Change passwords for all compromised accounts, use Policyd to limit number of messages which any user can send and before anything, apply the fix to close the security hole which is used to compromise the account(s)

If you still want to blacklist domain, try the next

Create new file with

nano /etc/postfix/rbl_blacklist

Add domain

domain.com REJECT

Save file, exec

postmap /etc/postfix/rbl_blacklist

Find the

smtpd_recipient_restrictions

line and add

check_sender_access hash:/etc/postfix/rbl_blacklist

into it.

smtpd_recipient_restrictions = check_sender_access hash:/etc/postfix/rbl_blacklist

If you have several other directives, move this one to the top and restart Postfix. Remmember that if your site is hacked, this won't help.

2
  • So has anyone had success with this method? I have not been able to block a domain sender from sending - and see them sending via the logs. Just wondered if there's an updated way?
    – Lee Fuller
    Jul 31 '15 at 16:51
  • 1
    This method worked for me. But you can find more precise instructions here: nacko.net/… Jun 29 '17 at 15:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.