Scenario: I'm testing an SMTP server on my local network, and I now need to check that it can send emails out to the net. The problem is, of course, that I'm going out via my ISP, and my ISP-assigned fixed IP address is not on DNS (I could put it on DNS, of course, but I couldn't set the reverse lookup, so it wouldn't help).
To get around this, I have Postfix set up on a remote server, and I'm trying to relay my outgoing messages through this server, to a local recipient on that server. This looks like it should be straightforward, but I'm obviously missing something. This is a new Postfix 3.6.4 setup, and main.cf
contains:
mynetworks = 127.0.0.0/8, 93.184.216.34/32
smtpd_helo_restrictions = permit_mynetworks, ...
smtpd_client_restrictions = permit_mynetworks, ...
93.184.216.34
is my ISP-assigned address, and my local network is dummy-domain.com
. When I try to send an email to the server I get a failure, and the server log file says:
Oct 16 13:24:42 titan postfix/smtpd[19103]: connect from my-isp[93.184.216.34]
Oct 16 13:24:42 titan postfix/smtpd[19103]: NOQUEUE: reject: RCPT from my-isp[93.184.216.34]: 450 4.1.8 <[email protected]>: Sender address rejected: Domain not found; from=<[email protected]> to=<a-local-recipient-address> proto=ESMTP helo=<dummy-domain.com>
Oct 16 13:24:42 titan postfix/smtpd[19103]: lost connection after RCPT from my-isp[93.184.216.34]
postconf
confirms mynetworks
, but it also says this:
compatibility_level = 0
smtpd_relay_restrictions = ${{$compatibility_level} <level {1} ? {} : {permit_mynetworks, permit_sasl_authenticated, defer_unauth_destination}}
Which I understand, perhaps incorrectly, to say that the default smtpd_relay_restrictions
does not include permit_mynetworks
, contrary to the documentation. So I explicity set this in main.cf
:
smtpd_relay_restrictions = permit_mynetworks
Restarted, And postconf
now reports exactly the line above. However, it still doesn't work, and the server logfile still shows the same message. Any ideas? And how do I get postconf
to show me the current real settings, without having to worry about the compatibility level? Thanks.
EDIT
as per anx's answer, it turns out that smtpd_client_restrictions = permit_mynetworks
("Permit the request when the client IP address matches any network or network address listed in $mynetworks") isn't sufficient. You also need
smtpd_sender_restrictions = permit_mynetworks
with permit_mynetworks
before reject_unknown_sender_domain
. This all works without any changes to /etc/hosts
, or any need to add anything to DNS.