How can I make Postfix reject mail transfers based on addresses?

Postfix asked:

I want to learn about running a mail server by running a mail server.

To be somewhat responsible and avoid being an open relay, I want Postfix to reject all mail that is not addressed to <valid user>@<hostname> OR (is from <valid user>@<hostname> AND the connection is coming from localhost). Will it do that by default or do I have to set some configuration?

My answer:

Postfix should be correctly configured to not open relay, out of the box. You would have to explicitly change settings in order to make it an open relay.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.