This is not possible with a single smtpd instance, but you can configure multiple smtpd instances through master.cf, as you already should have one instance for handling incoming mail on port 25 and another for outbound mail on port 465 (implicit TLS per RFC 8314, 3) or 587 for submission with plain text & STARTTLS.
I would suggest configuring the port 587 for the legacy clients, as it already supports plain text and TLS is only available through STARTTLS, whereas on port 465 TLS handshake begins immediately – which goes perfectly with the requirements for your new domain.
Let's assume example.com is the legacy domain and example.net the protected one.
The key is to:
- use different
myhostname configurations
- limit the allowed sender address(es) with
smtpd_sender_restrictions=reject_unlisted_sender
In master.cf:
# Legacy access on submission port 587 for example.com
submission inet n - - - - smtpd
-o myhostname=example.com
-o smtpd_tls_security_level=may
-o smtpd_sasl_auth_enable=yes
-o smtpd_sasl_type=dovecot
-o smtpd_sasl_path=private/auth
-o smtpd_sasl_security_options=noanonymous
-o smtpd_sasl_local_domain=$myhostname
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
-o smtpd_sender_restrictions=reject_unlisted_sender
-o { smtpd_recipient_restrictions=
reject_non_fqdn_recipient,
reject_unknown_recipient_domain,
permit_sasl_authenticated, reject }
# Client certificate required on port 465 for example.net
smtps inet n - - - - smtpd
-o myhostname=example.net
-o smtpd_tls_wrappermode=yes
-o smtpd_tls_req_ccert=yes
-o smtpd_sasl_auth_enable=yes
-o smtpd_sasl_type=dovecot
-o smtpd_sasl_path=private/auth
-o smtpd_sasl_security_options=noanonymous
-o smtpd_sasl_local_domain=$myhostname
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
-o smtpd_sender_restrictions=reject_unlisted_sender
-o { smtpd_recipient_restrictions=
reject_non_fqdn_recipient,
reject_unknown_recipient_domain,
permit_sasl_authenticated, reject }
You could even enforce that certain users can only use certain addresses, which works with both configurations, e.g.,
-o smtpd_sender_login_maps=hash:/etc/postfix/virtual
-o { smtpd_sender_restrictions =
reject_unlisted_sender,
reject_sender_login_mismatch }