aaah now I understand. You did not like the _naming_ of the access file.
I of course do not use any client maps or recipient maps, only sender maps.
So I found it wise to call the file just "access".
Of course, if I start using client maps or recipient maps, files will be
renamed accordingly.
About the test:
The test I linked is excellent to test all possible permutations of a access
policy, so you can be sure it works the way you want.
In my access policy, there is 8 possible permutations, whose 4 can be tested
by the tool, and the 4 other can be tested using telnet.
outside mynetworks, known sender, known recipient (did fail as it should)
outside mynetworks, unknown sender, known recipient (did success as it
should)
outside mynetworks, known sender, unknown recipient (did fail as it should)
outside mynetworks, unknown sender, unknown recipient (did fail as it
should)
inside mynetworks, known sender, known recipient (did success as it should)
inside mynetworks, unknown sender, known recipient (did success as it
should)
inside mynetworks, known sender, unknown recipient (did success as it
should)
inside mynetworks, unknown sender, unknown recipient (did fail as it should)
(successing this would make the server open relay)
About the "forgetting" of the purpose of the access file:
Did put a comment block in the access file:
#NEVER EVER PUT ANYTHING YOU DONT WANT TO BE OPEN RELAY FOR IN THIS FILE#
#ONLY USE PERMIT_MYNETWORKS OR SIMILIAR RESTRICTIONS#
sebbe.eu permit_mynetworks, reject
Then I will never forget, and successors of me wont break the open relay
prevention system.
-----Ursprungligt meddelande-----
From: Viktor Dukhovni
Sent: Wednesday, May 07, 2014 8:51 PM
To: [email protected]
Subject: Re: Configure postfix to reject forged mail?
On Wed, May 07, 2014 at 08:33:18PM +0200, Sebastian Nielsen wrote:
I know. "check_sender_access" does always check MAIL_FROM, regardless of
in
which access context they are in. (else it would be check_recipient_access
or check_client_access)
When using "check_sender_access" use a separate lookup table whose
keys are sender addresses/domains, DO NOT use a single generic file
called "access" for everything. This just leads to trouble.
But a sender access policy cannot contain a recipient policy (like
reject_unauth_destination) because MAIL_FROM comes before RCPT_TO (unless
smtpd_delay_reject is set to yes)
You SHOULD have smtpd_delay_reject set to "yes".
Did test the policy carefully both using a external tool (that queries the
server externally) and internally, and all test cases did pass thorugh
with
the result I wanted.
Sure, it works now, but it is fragile, and will land you or your
successor in trouble some day.
This tool is GREAT to test complex relay restrictions:
http://smtper.nanogenesis.fr/
Tests only report things that are already broken. Only
design reviews report things that are fragile.
Of course, I will never put anything else than something I want to relay,
in
the "access" file, eg only "permit_mynetworks" and such.
Some day you will forget, or someone else won't know the constraints.
--
Viktor.