Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

How do I configure the Postfix mail submission agent to only allow emails to be sent out from a user on localhost , but allow the Postfix mail transfer agent to receive mail from anywhere?

Martin

share|improve this question

1 Answer 1

up vote 9 down vote accepted

The simplest way is to make sure you have only localhost defined in mynetworks:

mynetworks = 127.0.0.0/8, [::1]/128

By default smtpd_recipient_restrictions is set as:

smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination

This will allow hosts defined in mynetworks (localhost, as above) to send anywhere, while everything else is rejected unless it's destined for your box or otherwise explicitly allowed (relay domains, virtual domains, or whatever other configurations you're allowing.)

share|improve this answer
    
With the above, this seems to have stopped me sending to external domains. When sending I now get 554 5.7.1 <user@domain.com>: Relay access denied –  Martin Smith Apr 21 '11 at 12:11
    
My bad! Doing this logged in to the box works fine. It was failing when I was trying to do this by tunnelling via ssh to the mail server. I thought this would have been equivalent to being on the box. –  Martin Smith Apr 21 '11 at 12:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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