Thursday, January 20, 2011

Postfix on development server, allow only mail to be send to one domain

We have postfix on our development server, and I'd like it to be able to only send mail to our domain, not to other domains, preventing accidentily mailing outside users from receiving mail from our development server. I searched through the docs, tried several things but it's still sending to all domains...

  • Have you tried header_checks(5)?

    datadevil : no, checking that out now
    From 0x44
  • You can easily restrict the recipients with standard smtpd_recipient_restrictions or more precisely check_recipient_access.

    Just create an access(5) table with the following content (example.com being the domain you want to allow to send mail to):

    example.com    OK
    

    Don't forget to hash the file after editing it with postmap(1).

    Now put the following recipient restrictions in your main.cf and reload Postfix:

    smtpd_recipient_restrictions = hash:/etc/postfix/my_access, reject
    
    Jacek Konieczny : That will work for mail sent via SMTP, not via /usr/lib/sendmail command and local processes can do both. It seems the 'authorized_submit_users' setting may be used to block local submission with sendmail/postdrop, then the smtpd restrictions will be enough.
    From joschi

0 comments:

Post a Comment