Open alexmv opened 3 years ago
If we add an outgoing_enabled
setting, I think we should mark it as clearly deprecated and plan to remove it in a future release. Writing a reasonable outgoing Postfix configuration for the modern internet has become a freakishly complicated endeavor with SPF, DKIM, DMARC, DANE, TLSA, MTA-STS, TLS-RPT…and this has nothing to do with our core product.
On hosts which include
zulip::postfix_localmail
, a localpostfix
service is installed, to allow incoming mail to be fed into Zulip. In service of this,puppet/zulip/templates/postfix/main.cf.erb
gets written out as/etc/postfix/main.cf
.In
main.cf
, thesmtpd_relay_restrictions
andsmtpd_recipient_restrictions
lines control what connections are allowed to deliver email to where. Postfix's configuration is complicated by the fact that it is designed to deal with accepting incoming mail, as well as send outgoing email -- a connection from localhost is "outgoing mail" and should support any destination, and a connection from anywhere else is "incoming mail" and should only be accepted if Zulip itself is the destination.The current configuration in
puppet/zulip/templates/postfix/main.cf.erb
is meant for a server that can function in both those use cases --permit_mynetworks
in bothsmtpd_relay_restrictions
andsmtpd_recipient_restrictions
allows connections from localhost to try to deliver to anywhere. This is more permissive than is strictly necessary -- it means that the configuration supportsEMAIL_HOST = 'localhost'
, but also means that misconfigurations which expose 127.0.0.1:25 to an external IP address create an open relay. Not allowing outgoing mail from localhost is also in line with ensuring that Zulip does not offer any unprotected IP-ACL'd services by default.We should:
/etc/zulip/zulip.conf
(e.g.postfix.outgoing_enabled
) which defaults to falsepermit_mynetworks
insmtpd_relay_restrictions
andpermit_mynetworks
permit_sasl_authenticated
fromsmtpd_relay_restrictions
-- we don't do any SASL authentication, so it's meaningless to include itlocalhost
withzulip::postfix_localmail
is supported ifpostfix.outgoing_enabled
is set in/etc/zulip/zulip.conf
zulip::postfix_localmail
configuration no longer allows outgoing mail, and how to adjustzulip.conf
to re-enable it.